Skip to content
Bridge Broadlink RM Devices with MQTT and API for e.g. OpenHAB
JavaScript HTML Shell Dockerfile
Branch: master
Clone or download
Latest commit 025a489 Jun 25, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode All files Sep 29, 2018
config finish up auto install. Oct 12, 2018
github try to fix image 3 Oct 9, 2018
html allow rescan of devices Dec 9, 2018
installers upgrade node packages Jun 25, 2019
.dockerignore add config Sep 30, 2018
.eslintrc.json change play: to play- Nov 4, 2018
.gitignore fix readme May 7, 2019
.jshintrc change play: to play- Nov 4, 2018
Dockerfile add dockerfile May 3, 2019 fix readme May 7, 2019
device.js make sure rescan only runs one at the time Dec 20, 2018
index.js short log didnt work Apr 5, 2019
package-lock.json upgrade node packages Jun 25, 2019
package.json upgrade node packages Jun 25, 2019

Yet another MQTT - Broadlink Bridge

This one is built specifically with OpenHAB on a Raspberry PI in mind. However it can be used in other scenarios installation outside RPI.

It has a Admin GUI for helping record IR / RF signals. You will be able with the filetree see all recorded actions, delete actions and if a disclamation mark occures, this means that the action is a duplicate of another (has same binary content).

admin gui


  • Node > 8 (installed on RPI OpenHAB)
  • MQTT (mosquitto in OpenHAB)
  • Broadlink device e.g. RM 3 PRO


Raspberry PI AutoInstaller

SSH into your RPI then run the command

bash -c "$(curl -sL"

This will install the broadlink-mqtt-bridge project in /srv/openhab2-conf/broadlink-mqtt-bridge/. At the end of the installer you will have an option to make the project run automatic at boot.

To upgrade to latest version just run the script again.

You can control the service with

// Start service
sudo systemctl start broadlinkbridge.service
// Stop service
sudo systemctl stop broadlinkbridge.service
// Restart service
sudo systemctl restart broadlinkbridge.service


docker run --network=host \
  -v "$PWD/config/local.json:/broadlink-mqtt-bridge/config/local.json" \
  -v "$PWD/commands:/broadlink-mqtt-bridge/commands" \

Docker Compose

version: "3.7"
    image: "fbacker/broadlink-mqtt-bridge"
    restart: always
    network_mode: host
      - "./config/local.json:/broadlink-mqtt-bridge/config/local.json"
      - "./commands:/broadlink-mqtt-bridge/commands"


// install
cd /srv/openhab2-conf/
git clone
cd broadlink-mqtt-bridge
npm install

// test run the app
node index.js

// add to run at reboot
// example for linux (e.g. openhab2 on RPI)
crontab -e
@reboot cd /home/openhabian/broadlink-mqtt-bridge && node index.js < /dev/null &

// To upgrade to latest version
git pull


in ./config there's a couple of options in default.json. Do not change this. This is the default settings that can be overwritten. Make your own file ./config/local.json and only add and change values that you want.

NOTE: Changing the default.json will break updates.

NOTE2: mqtt node properties that can be used, look here:


There's a couple of ways to interact. Web GUI, Websockets, Rest API and with MQTT.

Web (best for Recording)

Most output and simple is running the web gui. This will output everything from logs and GUI to trigger actions. Possible to change port in config.


Multiple devices You need to specify the broadlink id in the form input field. You can list connected devices with the 'devices' button.

MQTT (best for playing)

Send play, recordir or recordrf to a topic.

// Example play an action
Topic: broadlink/fan/light;
Message: play;

If using multiple device add the device id in the message.

// Play action on specific broadlink device
Topic: broadlink/fan/light;
Message: play-bdh3hi;

Rest API

It's possible to use api to calls for play and recording actions. Note that recording wont give help information as when using the web api.

Multiple devices If using multiple broadlink devices, you need to specify the unique id with the post. Add it with {"id":"myid}. The ID is found in the webconsole or with /api/devices

// Play a recorded action
curl --header "Content-Type: application/json" \
  --request POST \
  --data '{"topic":"broadlink/tv/samsung/power"}' \

// Record IR device
curl --header "Content-Type: application/json" \
  --request POST \
  --data '{"topic":"broadlink/tv/samsung/power"}' \

// Record RF device
curl --header "Content-Type: application/json" \
  --request POST \
  --data '{"topic":"broadlink/fan/light"}' \

// Tree of files
curl --header "Content-Type: application/json" \
  --request GET \

curl --header "Content-Type: application/json" \
  --request DELETE \
  --data '{"file":"commands/fan/light"}' \

// List connected devices
curl --header "Content-Type: application/json" \
  --request GET \

// Rescan for devices
curl --header "Content-Type: application/json" \
  --request GET \


Could be good for something right?

Look at ./html/index.html for example. You can call actions and listen to logs.

    <script src="http://localhost:3000/"></script>
        var socket = io();
        socket.on('connection', function (socket) {
            // connected
        socket.on('log', function (msg) {
            // output logs
        socket.on('config', function (msg) {
            // config file, will trigger on client connect
        socket.on('actions', function (msg) {
            // all saved actions, trigged with
            // socket.emit('getActions');
        socket.on('devices', function(devices) {
            // all connected devices, triggered with
            // socket.emit('getDevices');

         * action
         *  - play
         *  - recordIR
         *  - recordRF
         * topic
         *  Path to record / play
        socket.emit('action', { action, topic });

        **Multiple Devices**
        If using multiple broadlink devices you need to add the id of the device you want to use.
        Use with play-{id}, e.g. play-ds9323d
        Available devices is found with socket.emit('getDevices'); and listening to socket.on('devices', function(devices) =>

Using With OpenHAB

After recorded a couple of actions it's possible to use with OpenHAB. Use same MQTT server in config settings.

Look at OpenHab documentation how to configure openhab with MQTT

/// EXAMPLE ON/OFF device
Switch OutdoorLight1 "Outdoor Porch" {mqtt=">[mqtt:broadlink/switches/outdoor/garden1/on:command:ON:play],>[mqtt:broadlink/switches/outdoor/garden1/off:command:OFF:play]"}

// EXAMPLE Swap light
Switch FanLights "Fan Lights" {mqtt=">[mqtt:broadlink/fan/light:command:ON:play]"}
// or specific broadlink device
Switch FanLights "Fan Lights" {mqtt=">[mqtt:broadlink/fan/light:command:ON:play-23fdsd]"}

// .sitemap
Frame label="Fan Livingroom"  {
    Switch item=OutdoorLight1 label="Outdoor"
    Switch item=FanLights label="Swap light" mappings=[ON="Swap"]

// Change fan speed, 6 recorded actions

// .items
Number FanSpeed "Fan Speed [%d]"

// .rules
rule "FanSpeed"
    Item FanSpeed changed
    if (FanSpeed.state == "NULL") return; // If NULL do nothing
    val topic = "broadlink/fans/livingroom/speed-" + FanSpeed.state
    publish("mqtt", topic, "play")

// .sitemap
Selection item=FanSpeed mappings=[1="1", 2="2", 3="3", 4="4", 5="5", 6="6"]
You can’t perform that action at this time.