vpctorr / broadlink-rm-http

A Web server to control IR & RF devices using Broadlink RM.
https://npmjs.com/package/broadlink-rm-http
MIT License
9 stars 11 forks source link

broadlink-rm-http

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).

npm version npm downloads

Getting started

Install this package by running:

npm install broadlink-rm-http

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

"use strict";

const BroadlinkServer = require('broadlink-rm-http');
const commands = require('./commands');

const port = process.env.PORT || 1880;
const key = "YOUR_SECRET";

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

let app = BroadlinkServer(commands, key, rooms);
app.listen(port);

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

Create a file named commands.js and add:

module.exports = [
{"command":"COMMAND_A","group":"GROUP_NAME","data":"IR_OR_RF_CODE"},
{"command":"COMMAND_B","group":"GROUP_NAME","data":"IR_OR_RF_CODE"}
];

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

Adding devices

Learning codes & making commands

Creating groups

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:

Setting up Google Assistant with IFTTT: