npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

broadlink-rm-server

v0.0.6

Published

This is a simple server that allows you to connect your Broadlink (tested with the RM mini 3) to your IFTTT account.

Downloads

4

Readme

Broadlink RM Server for IFTTT control

This is a simple server that allows you to connect your Broadlink (tested with the RM mini 3) to your IFTTT account.

Setup

  • Get a IFTTT account and enable the Maker Webhooks: https://ifttt.com/maker_webhooks
  • Download and install ngrok: https://ngrok.com/
  • Install this repository by running npm install broadlink-rm-server
  • Install the Broadlink app and setup your home Wifi (I asume your Broadlink is connected to the same network as your server from now on)
  • Download the RM Bridge app (Android only). This is needed to learn the IR codes for your appliances.

Running with NPM

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

"use stict";
const PORT = process.env.PORT || 1880;

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

let app = BroadlinkServer(commands);
    app.listen(PORT);

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

Create a file named commands.js and add:

module.exports = [];

Configure this commands.js file with your commands and IP/Mac address of the BroadlinkRM (see below).

Now run node index and the server should start. You will see in the console your Broadlink IP address, we will use it later.

Learn IR codes

Learning codes is now built in with the server, in order to enable it, edit your index file and modify the line:

let app = BroadlinkServer(commands);

After commands, set TRUE to enable the learning mode.

let app = BroadlinkServer(commands, true);

Now run the server with node index and open your browser, go to your server url and add /learn/command/MAC_OR_IP, point your remote to the Broadlink and press the key you want to attach to the command. You will get a response like this:

{
    command: "Projector",
    secret: "dnja9kdtn",
    mac: "34:ea:34:bb:16:1a",
    ip: false,
    data:"260058000001289413121213111413121213111413121114113911391238113911391238111412381114123811141213111411141212121410391214103912391237113912391237110005490001264b12000c5e0001264b11000d05"
}

Add this command to your command.js array and save. Remember to disable the learning mode by removing the true or setting it to false.

Ngrok

In order to connect IFTTT to the PC/server running this code (like a Raspberry Pi), you will need a URL that tunnels to your device, this is done with ngrok.

After installing ngrok, run: ngrok http 1880

IFTTT

For this instructions I'm going to setup my Google Home with the Broadlink, on IFTTT search for Google Assistant and enable it (https://ifttt.com/google_assistant). Then, create a new applet: https://ifttt.com/create.

Trigger setup

  • Click on +this and search for the Google Assistant.
  • Select Say a simple phrase
  • Set What do you want to say? with a command like "TV on".
  • Set What do you want the Assistant to say in response? with a custom response like "Turning the TV on"
  • Click on Create trigger

Action setup

  • Click on +that and search for Maker Webhooks
  • Select Make a web request
  • In the URL field, set your Ngrok URL and add at the end /command/YOUR_COMMAND_NAME
  • Method should be POST
  • Content Type select application/json
  • For the body set: {"secret":"YOUR_COMMAND_SECRET_HERE"}
  • Click Create Action

You should now be able to say Ok Google, TV ON and IFTTT will send a request to your local server that will relay the action to the Broadlink and turn on your TV!.

Credits:

Some parts of the code are from @lprhodes Homebridge Broadlink: https://github.com/lprhodes/homebridge-broadlink-rm

Also his module for the communication is used.