Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including broadlink-rm-http with all npm packages installed. Try it out:

var broadlinkRmHttp = require("broadlink-rm-http")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

broadlink-rm-http v1.0.3


A Web server to control IR & RF devices using Broadlink RM. Can be used for custom applications or with IFTTT to add Google Home, Alexa & HomeKit support (tutorial below).

Getting started

Install this package by running:

npm install broadlink-rm-http

Create a file named index.js and add the following code:

"use stict";
const PORT = process.env.PORT || 1880;
const BroadlinkServer = require('broadlink-rm-http');
const commands = require('./commands');

const key = "YOUR_SECRET";

var rooms = [];
rooms["ROOM_NAME"] = {host:"MAC_OR_IP",groups:["GROUP_A", "GROUP_B"]};

let app = BroadlinkServer(commands, key, rooms);

console.log('Server running, go to http://localhost:' + PORT);

Create a file named commands.js and add:

module.exports = [

Alternatively, you can move index.js and commands.js from node_modules/broadlink-rm-http/example to the main directory

Adding devices

  • Add your Broadlink RM devices to the Broadlink e-Control app
  • Write down their Mac (recommended) or IP addresses (or copy them by running node index) and create rooms in the index.js file using these informations
  • Additionally, set a key/secret to prevent unwanted command executions (especially if you will open this to the Internet), but don't leave it blank

Learning codes & making commands

  • If not done already, start the server with node index and visit http://localhost:1880/learn/YOUR_SECRET/HOST replacing HOST with the Mac or IP address (not room !) of the device that will be used for learning codes
  • Now, you have 15 seconds to press the desired button on your infrared or radio remote controller ; if you run out of time just refresh the page
  • Once done add the result to your commands.js file and fill the placeholders accordingly

Creating groups

  • Groups allow you to restrict a set of commands to one or multiple rooms
  • This is particulary useful if you have different sets of remotes used across multiple rooms
  • The commands.js allows you to add commands to a group while the index.js allows you to bind rooms to one or more groups
  • You can bypass this feature by setting groups according to room names or by making one single group (not recommended as you are more likely to make mistakes)

Running commands & using IFTTT

Executing commands

To run commands simply visit http://localhost:1880/execute/YOUR_SECRET/ROOM/COMMAND

Opening the server to the Internet:

  • We will use localtunnel because it is quick and secure, but you can also use ngrok or configure your modem to do so
  • Install localtunnel by running npm install -g localtunnel and start it with lt --port 1880 (if your server's port is 1880)
  • You can now execute commands from the Internet via
  • It is also recommended to set a unique subdomain using lt --port 1880 --subdomain SOMETHING_UNIQUE to make sure it remains the same
  • You can start localtunnel automatically using its API

Setting up Google Assistant with IFTTT:

  • Visit IFTTT and create an account or log in, then go to My Applets and make a New Applet
  • Click on +this, search for Google Assistant, link your Google account and select Say a simple phrase
  • Set What do you want to say? to a command like "Turn the TV on"
  • Set What do you want the Assistant to say in response? to a response like "Turning the TV on"
  • Set your language and press Create trigger
  • Click on +that, search for Webhooks, connect and select Make a web request
  • Fill URL with and press Create action (leave everything else as is)
  • Disable notifications and press Finish, you can now try your new Google Assistant command !
  • You can also make advanced commands with Say a phrase with a number or with a text ingredient to control your AC for example


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free