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

Learning doesn't seem to work #3

Open alexmuntean opened 6 years ago

alexmuntean commented 6 years ago

Hi,

I really like the idea but I can't get it working. I want to achieve exactly what you're describing - "IFTTT" :)

I've tried using http://localhost:1880/learn/a/192.168.1.108 while index is


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

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

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

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

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

but it isn't working

The output of index.js is "Discovered Broadlink RM device at 77:0f:78:18:02:e8 (192.168.1.108)" which actually is a broadlink rm pro plus or something like that...

For RF learning I saw that it has to be in 2 steps because the device has is scanning 2 bands - one for 300-something RF and one for 433 mhz (the one I need)

I finally managed to use your server and it works ok but the learning isn't. I do the rf433 learning like this:

"use strict";

let Broadlink = require('broadlinkjs-rm');

const bl = new Broadlink();
bl.discover();

bl.on("deviceReady", (device) => {
    console.log(device);

    device.on("rawData", (message) => {
        console.log("rawData", message.toString('hex'));
        device.cancelLearn();
    });

    device.on("rawRFData", (message) => {
        console.log("rawRFData", message.toString('hex'));

        device.enterLearning();
        setTimeout(() => {
            device.checkData();
        }, 1000);

    });

    setTimeout(() => {
        console.log("entering sweep mode");
        device.enterRFSweep();

        setTimeout(() => {
            console.log("checking rf data - press multiple times longer");
            device.checkRFData();
        }, 5000);

    }, 2000);

});

Thanks a lot for your contribution, Alex

rabh commented 3 years ago

I'm also seeing the same issue, it discovers my Broadlink RM Pro+, but it just hangs on the learning, and eventually I get the timeout, on trying to learn a 433 Mhz RF command. It's definitely reaching the Broadlink, as when I hit the learning url, the red light on the broadlink comes on.

Did you manage to resolve this @alexmuntean?