mlfunston / node-red-contrib-broadlink-control

Set of node-red nodes to manage the Broadlink home automation device suite
MIT License
44 stars 24 forks source link

Noob question: Can someone help me get started? #13

Closed win22jim closed 5 years ago

win22jim commented 5 years ago

I have been trying to get this to work for quite some time now, and I am struggling. I am new to NodeRed so I am still learning. Can someone please help me understand how to use this? I am using the RM mini 3. I have successfully used the learn command and the discover node. Getting the buttons from the app on my phone didn't work, so I am trying to do it programmatically. I can get the array from the learn node, but I don't know how to use it. I have the device configured right in the RM node (Mac address, and IP are correct).

What I have been doing: I have an inject node going into a function node which goes into the RM node. The function node contains the following code: msg.action = 'send'; msg.data = [38,0,236,0,152,148,17,17,15,18,15,18,15,18,15,51,12,54,21,13,14,19,14,51,15,51,16,50,16,50,16,18,15,18,14,19,15,15,18,149,16,17,15,19,14,19,15,18,14,19,15,18,15,18,15,50,16,50,16,50,16,48,18,18,15,50,16,50,17,49,16,18,15,18,15,18,16,17,20,45,16,0,7,32,148,149,15,19,15,14,19,16,17,18,15,50,14,52,17,17,15,18,15,50,16,50,17,49,17,49,16,18,15,18,22,11,15,17,17,148,17,17,16,17,15,18,15,18,15,18,16,17,20,13,15,51,15,50,15,50,18,49,16,18,15,51,15,51,16,50,15,18,16,17,23,8,25,9,16,51,16,0,7,32,148,149,21,12,49,15,18,18,16,49,16,50,16,17,16,18,15,50,17,49,16,51,16,49,17,17,21,11,16,15,18,18,17,147,17,16,17,17,15,18,15,18,21,12,22,10,17,15,17,50,16,50,16,51,16,50,16,17,15,51,15,51,16,50,15,19,17,16,22,9,50,50,17,0,13,5,0,0,0,0,0,0,0,0,0,0,0,0]; return msg; I have also tried sending the array as msg.payload, but both ways I haven't had any success. Can someone please help me understand how to use these node? I tried following the examples, but this is all very new to me and it was confusing; I didn't understand how to implement it.

mlfunston commented 5 years ago

Try the example code for learn and send data.

Click on the hamburger button in node red in the top right corner, select import, then examples, then broadlink-control and pick learn and send data.

Example Code

In the Send Data example you will find a function node with the following code. You can paste your data in like follows:

//Insert learning code here
var data = [38,0,140,0,77,21,18,22,38,21,17,22,17,22,38,21,18,21,18,22,37,22,17,22,18,21,18,22,17,0,3,99,77,21,18,22,38,21,17,22,18,21,38,21,18,22,17,22,38,21,18,21,18,22,17,22,17,0,3,99,77,21,18,22,37,22,17,22,18,21,38,21,18,22,17,22,37,22,18,21,18,22,17,22,18,0,3,100,76,22,18,21,38,21,18,22,17,22,37,22,18,21,18,22,37,22,17,22,18,21,18,22,17,0,3,101,76,22,18,21,39,20,18,22,17,22,37,22,18,21,18,22,37,22,17,22,18,21,18,22,17,0,13,5,0,0,0,0,0,0,0,0,0,0,0,0];

msg.payload={
    //"mac":"MAC address of your broadlink rm",
    //"host":"IP address of your broadlink rm",
    "action":"send",
    "data":data,
    "repeat":2
};

return msg;

The keys that need to populate are actually msg.payload.action and msg.payload.data.

Hope this helps.

win22jim commented 5 years ago

Try the example code for learn and send data.

Click on the hamburger button in node red in the top right corner, select import, then examples, then broadlink-control and pick learn and send data.

Example Code

In the Send Data example you will find a function node with the following code. You can paste your data in like follows:

//Insert learning code here
var data = [38,0,140,0,77,21,18,22,38,21,17,22,17,22,38,21,18,21,18,22,37,22,17,22,18,21,18,22,17,0,3,99,77,21,18,22,38,21,17,22,18,21,38,21,18,22,17,22,38,21,18,21,18,22,17,22,17,0,3,99,77,21,18,22,37,22,17,22,18,21,38,21,18,22,17,22,37,22,18,21,18,22,17,22,18,0,3,100,76,22,18,21,38,21,18,22,17,22,37,22,18,21,18,22,37,22,17,22,18,21,18,22,17,0,3,101,76,22,18,21,39,20,18,22,17,22,37,22,18,21,18,22,37,22,17,22,18,21,18,22,17,0,13,5,0,0,0,0,0,0,0,0,0,0,0,0];

msg.payload={
    //"mac":"MAC address of your broadlink rm",
    //"host":"IP address of your broadlink rm",
    "action":"send",
    "data":data,
    "repeat":2
};

return msg;

The keys that need to populate are actually msg.payload.action and msg.payload.data.

Hope this helps.

Worked Perfect. Thanks for your help!