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

Is there a possibility to implement base64 IR / RF codes? #32

Closed tibehrius closed 4 years ago

tibehrius commented 4 years ago

Many people already have automations with scripts in the Home Assistant with code compiled in base64. Is it possible to insert this function in the nodes of this addon?

Tks

mlfunston commented 4 years ago

Possibly, do you have some sample codes or scripts for testing? I'll have a look and see if I can work it out.

mlfunston commented 4 years ago

@tibehrius - Have added the Base64 decode capability. So if you can download the repository and test before I push to NPM that would be good. You can send in the data in the msg.payload.data property into the RM node.

mreyad commented 4 years ago

Tested with multiple Base64 codes and it works, but now the array code from e-control is not working. This is still fine, since most of people who integrate broadlink with home automation systems, convert all codes from "e-control" format to either HEX or base64, but sinceit was already there, it is good to keep it compatible with both "base64 and e-control format"

Thank you very much and appreciate your efforts.

mlfunston commented 4 years ago

@mreyad - It works fine for me as an array. Below is the sample I used which works when fed into the RM node. It also works when using the data from the e-control json files from the catalog.

var data = [38,0,76,2,115,55,16,41,16,41,16,13,16,12,17,13,15,41,16,12,16,13,16,41,15,42,16,13,15,41,16,13,16,13,16,40,16,41,16,13,16,40,18,40,16,12,17,12,16,41,17,12,16,12,16,41,16,13,16,12,16,13,16,13,16,12,16,13,16,13,16,13,15,14,15,13,15,13,16,13,15,13,16,13,16,13,17,12,15,13,16,12,17,12,16,12,17,40,16,13,16,12,16,13,16,13,16,12,17,40,16,41,16,13,16,12,17,12,16,41,15,42,16,12,16,41,16,14,15,12,18,11,17,12,16,13,16,40,17,40,17,12,16,41,16,41,16,12,16,13,16,41,16,12,16,13,16,40,17,12,16,13,16,41,16,12,17,40,17,12,16,41,15,13,16,13,16,41,15,42,16,12,16,13,16,12,16,13,16,13,15,13,16,13,16,12,17,12,16,12,17,13,15,14,15,12,17,12,16,12,16,13,16,13,16,12,16,13,16,12,16,13,17,12,16,13,16,12,16,14,15,13,16,13,16,12,16,12,16,13,16,13,16,12,17,12,16,12,16,13,16,12,16,14,15,12,17,12,16,13,15,13,16,13,16,12,17,13,14,14,16,12,17,12,17,12,16,12,16,13,16,13,16,40,16,41,16,41,16,41,16,12,17,12,16,0,2,50,119,56,16,40,16,41,16,13,17,12,16,13,15,41,17,12,16,13,15,42,16,40,16,13,16,41,16,13,16,12,17,40,16,41,16,12,17,40,16,41,16,13,16,12,16,41,16,13,16,12,16,41,16,13,16,13,16,12,16,13,16,13,15,13,16,13,15,13,17,12,16,12,17,12,16,13,15,13,17,13,15,13,16,12,16,13,15,13,16,13,16,13,16,40,17,12,16,12,16,13,16,13,16,12,16,41,17,40,16,13,16,12,17,12,16,41,16,41,16,12,17,40,17,12,16,13,16,12,16,13,16,12,16,41,16,41,16,13,16,41,16,40,16,13,16,13,16,40,17,12,16,13,16,40,17,12,16,13,16,40,17,12,16,41,16,12,16,41,16,13,16,12,17,40,16,41,17,12,16,12,17,12,16,13,16,12,17,12,16,13,16,13,15,13,15,13,17,12,16,12,17,12,16,13,16,12,16,13,16,12,17,12,16,13,16,12,16,13,16,12,16,13,16,13,16,12,16,13,16,13,16,12,16,13,16,12,16,13,16,13,16,12,16,13,16,12,16,13,16,13,17,11,18,11,17,12,16,12,17,12,16,13,16,12,17,12,16,13,16,13,15,13,17,12,16,12,16,13,16,41,15,42,16,41,16,41,16,12,16,13,16,0,13,5,0,0,0,0,0,0,0,0,0,0,0,0];

msg.payload={
    "action":"send",
    "data":data,
    "repeat":2
};

return msg;