ioBroker / ioBroker.rflink

Support of RFLink
MIT License
11 stars 11 forks source link

set state of my blind after receiving serial data from remote control #32

Closed fred0815 closed 4 years ago

fred0815 commented 4 years ago

Hi,

currently I am not able to analyse different kind of commands recieving by remote control.... and I wish to do that...

After pressing the "up" button on my blind remote control, rflink set a status in the current channel. Rflink is doing this for "stop" and "down" commands too, but always the "false" value.... It would be nice, if RFLink will set the "true" value for the "up" command....

iobroker Log: rflink.0 2020-08-05 11:40:48.445 debug (28916) Set state "rflink.0.channels.Warema_2.BLIND_03": false rflink.0 2020-08-05 11:40:48.444 debug (28916) Serial data received: 20;07;Warema;ID=c6b8;SWITCH=03;CMD=UP;

rflink.0 2020-08-05 11:40:50.616 debug (28916) Set state "rflink.0.channels.Warema_2.BLIND_03": false rflink.0 2020-08-05 11:40:50.615 debug (28916) Serial data received: 20;08;Warema;ID=c6b8;SWITCH=03;CMD=STOP;

rflink.0 2020-08-05 11:40:56.024 debug (28916) Set state "rflink.0.channels.Warema_2.BLIND_03": false rflink.0 2020-08-05 11:40:56.022 debug (28916) Serial data received: 20;0A;Warema;ID=c6b8;SWITCH=03;CMD=DOWN;

May be it would be possible to enhance the code or give me a hint where I can change the code locally.

Thanks a lot for your help.

fred0815 commented 4 years ago

found a solution on my own..

evanes68 commented 4 years ago

Fred, could you share your solution? I am experiencing the same problem on Somfy RTS remote.

fred0815 commented 4 years ago

I have made the following changes.

In the file "main.js" line 454 from if (frame.blind) { stateId = id + '.BLIND' + frame.SWITCH; } else if (frame.all) { stateId = id + '.ALL' + frame.SWITCH; } else if (frame.chime) { stateId = id + '.CHIME_' + frame.SWITCH; } else if (frame.set_level) { stateId = id + '.SETLEVEL' + frame.SWITCH; } else { stateId = id + '.SWITCH' + frame.SWITCH; } to if (frame.blind && !frame.stop) { stateId = id + '.BLIND' + frame.SWITCH; } else if (frame.blind && frame.stop) { stateId = id + '.BLINDSTOP' + frame.SWITCH;
} else if (frame.all) { stateId = id + '.ALL' + frame.SWITCH; } else if (frame.chime) { stateId = id + '.CHIME' + frame.SWITCH; } else if (frame.set_level) { stateId = id + '.SETLEVEL' + frame.SWITCH; } else { stateId = id + '.SWITCH_' + frame.SWITCH; }

file "parse.js" line 8 from
CMD: function (value) { if (value.indexOf('SET_LEVEL') !== -1) { return parseInt(value.split('=')[1], 10); } else { if (value[0] >= '0' && value[0] <= '9') return parseInt(value, 10); return value.indexOf('ON') !== -1; } }, to CMD: function (value) { if (value.indexOf('SET_LEVEL') !== -1) { return parseInt(value.split('=')[1], 10); } else { if (value === "UP" || value === "STOP") return true; if (value[0] >= '0' && value[0] <= '9') return parseInt(value, 10); return value.indexOf('ON') !== -1; } },

evanes68 commented 4 years ago

Thank you.

I see your changes to the parse code will change the state from false to true when you press the UP or STOP button. But pressing the DOWN button does not change the state?

fred0815 commented 4 years ago

the default value is false...so, if you press neither UP nor STOP the function returns false...