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

the power reading on SP2 #69

Open mitjaromih opened 3 years ago

mitjaromih commented 3 years ago

the power reading on SP2 in "contrib-broadlink-controlne" does not work except sp3s this works. In this "contrib-broadlink" it works SP2 but it doesn't work SP3s. So I would ask you if you can arrange for SP2 to work in "contrib-broadlink-controlne"

molodec100 commented 2 years ago

I made changes in SP2.js

WAS

case 0x08:
                    if (Number.isInteger(payload[7])) //possible fix for issue #7
                    {
                        this.emit("energy", { energy: (payload[7] * 256 + payload[6]) + payload[5] / 100.0}); 
                    }
                    else
                    {
                        this.emit("energy", { energy: (payload[7].charCodeAt(0) * 256 + payload[6].charCodeAt(0)) + payload[5].charCodeAt(0) / 100.0}); 
                    }
                    break;

NOW

case 0x08:
                   this.emit("energy", { energy:  (payload[7].toString(16)+ payload[6].toString(16)+payload[5].toString(16))/100});
                   break;

Now the SP3S shows a power similar to the readings from IHS.