openHAB 2.4.0 Build #1326
Hi!
When changing the state of the switch, the event is triggered 3 times instead of one, pay attention to the log:
2018-08-10 19:33:09.806 [DEBUG] [home.handler.XiaomiDeviceBaseHandler] - Device 158d0001f2766d on channel mihome:ctrl_ln1:158d0001f2766d:ch1 received command OFF
2018-08-10 19:33:09.811 [DEBUG] [g.mihome.handler.XiaomiBridgeHandler] - Send to bridge mihome:bridge:286c078921f5: {"cmd": "write", "sid": "158d0001f2766d", "data": "{\"channel_0\": \"off\", \"key\": \"E22EACEF4CEC8EC343F4E98C5B1275EC"}"}
2018-08-10 19:33:09.818 [DEBUG] [.mihome.internal.socket.XiaomiSocket] - Received Datagram from 192.168.215.140:9898 on Port 9898
2018-08-10 19:33:09.819 [DEBUG] [g.mihome.handler.XiaomiBridgeHandler] - Device 158d0001f2766d honored write request
2018-08-10 19:33:09.820 [DEBUG] [home.handler.XiaomiDeviceBaseHandler] - Item got update: {"cmd":"write_ack","model":"ctrl_ln1.aq1","sid":"158d0001f2766d","short_id":21497,"data":"{\"voltage\":3600,\"channel_0\":\"on\"}"}
2018-08-10 19:33:09.919 [DEBUG] [.mihome.internal.socket.XiaomiSocket] - Received Datagram from 192.168.215.140:4321 on Port 9898
2018-08-10 19:33:09.920 [DEBUG] [home.handler.XiaomiDeviceBaseHandler] - Item got update: {"cmd":"report","model":"ctrl_ln1.aq1","sid":"158d0001f2766d","short_id":21497,"data":"{\"channel_0\":\"off\"}"}
2018-08-10 19:33:10.691 [DEBUG] [.mihome.internal.socket.XiaomiSocket] - Received Datagram from 192.168.215.140:4321 on Port 9898
2018-08-10 19:33:10.692 [DEBUG] [home.handler.XiaomiDeviceBaseHandler] - Item got update: {"cmd":"report","model":"gateway","sid":"286c078921f5","short_id":0,"data":"{\"rgb\":0,\"illumination\":423}"}
2018-08-10 19:33:10.957 [INFO ] [.eclipse.smarthome.model.script.RULE] - <-- OFF light
2018-08-10 19:33:10.962 [INFO ] [.eclipse.smarthome.model.script.RULE] - <-- OFF light
2018-08-10 19:33:10.969 [INFO ] [.eclipse.smarthome.model.script.RULE] - <-- OFF light
2018-08-10 19:33:36.578 [DEBUG] [home.handler.XiaomiDeviceBaseHandler] - Device 158d0001f2766d on channel mihome:ctrl_ln1:158d0001f2766d:ch1 received command ON
2018-08-10 19:33:36.583 [DEBUG] [g.mihome.handler.XiaomiBridgeHandler] - Send to bridge mihome:bridge:286c078921f5: {"cmd": "write", "sid": "158d0001f2766d", "data": "{\"channel_0\": \"on\", \"key\": \"E6FF670C3C7BA6E6106A74D442E07ECA"}"}
2018-08-10 19:33:36.582 [INFO ] [.eclipse.smarthome.model.script.RULE] - <-- ON light
2018-08-10 19:33:36.623 [DEBUG] [.mihome.internal.socket.XiaomiSocket] - Received Datagram from 192.168.215.140:9898 on Port 9898
2018-08-10 19:33:36.624 [DEBUG] [g.mihome.handler.XiaomiBridgeHandler] - Device 158d0001f2766d honored write request
2018-08-10 19:33:36.625 [DEBUG] [home.handler.XiaomiDeviceBaseHandler] - Item got update: {"cmd":"write_ack","model":"ctrl_ln1.aq1","sid":"158d0001f2766d","short_id":21497,"data":"{\"voltage\":3600,\"channel_0\":\"off\"}"}
2018-08-10 19:33:36.628 [INFO ] [.eclipse.smarthome.model.script.RULE] - <-- OFF light
2018-08-10 19:33:36.727 [DEBUG] [.mihome.internal.socket.XiaomiSocket] - Received Datagram from 192.168.215.140:4321 on Port 9898
2018-08-10 19:33:36.735 [DEBUG] [home.handler.XiaomiDeviceBaseHandler] - Item got update: {"cmd":"report","model":"ctrl_ln1.aq1","sid":"158d0001f2766d","short_id":21497,"data":"{\"channel_0\":\"on\"}"}
2018-08-10 19:33:36.741 [INFO ] [.eclipse.smarthome.model.script.RULE] - <-- ON light
Switch room_light_switch Lights[%s]" <switch> { channel="mihome:ctrl_ln1:158d0001f2766d:ch1" }
rule "switch light room"
when
Item room_light_switch changed from OFF to ON or
Item room_light_switch changed from ON to OFF
then
if(room_light_switch.state == ON) {
logInfo("RULE","<-- ON light")
} else {
logInfo("RULE","<-- OFF light")
}
end
Am I doing something wrong?
Thank you!
UPD: This is made of paper, if you physically press the switch, then everything is ok.