openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.9k stars 3.59k forks source link

[Xiaomi / MiHome] Aqara Wall Switch Left button fire redundancy events #3100

Closed Vanshava closed 6 years ago

Vanshava commented 6 years ago

Hi community,

I have several Xiaomi devices running on Openhab2. Everything are running well including Door Sensor, Remote button & motion sensor.

The issue is; when left button "AqaraWallSwitch1" received command from IOS, Web or Rule sendCommand either ON/OFF. It will fire 3 events. As below trace log. When received command ON, it fire 3 events ON, OFF, then ON continuously . "Received command OFF" are oppositely, it will fire OFF, ON then OFF sequently.

Right button is running good. Pushing physical buttons are also no problem. it fire 1 event as expected.

Tried to create new openhab docker container just have only gateway and switch and without any rule. But still no luck.

Xiaomi Gateway firmware: 1.4.1_151.0143 185 │ Active │ 90 │ 2.2.0.201712161137 │ openHAB Core 219 │ Active │ 80 │ 2.2.0.201712161137 │ Xiaomi Mi Smart Home Binding

11:51:37.996 [TRACE] [smarthome.event.ItemCommandEvent     ] - Received event of type 'ItemCommandEvent' under the topic 'smarthome/items/XiaomiAqaraWallSwitch2Button_Button1/command' with payload: '{"type":"OnOff","value":"ON"}'      
11:51:37.999 [DEBUG] [ihome.handler.XiaomiDeviceBaseHandler] - Device 158d0001XXXXXX on channel mihome:ctrl_neutral2:158d0001XXXXXX:ch1 received command ON                                                                                
11:51:38.027 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'XiaomiAqaraWallSwitch2Button_Button1' received command ON                                                                                                             
11:51:38.053 [TRACE] [smarthome.event.ItemStateEvent       ] - Received event of type 'ItemStateEvent' under the topic 'smarthome/items/XiaomiAqaraWallSwitch2Button_Button1/state' with payload: '{"type":"OnOff","value":"ON"}'          
11:51:38.064 [INFO ] [smarthome.event.ItemStateEvent       ] - XiaomiAqaraWallSwitch2Button_Button1 updated to ON                                                                                                                          
11:51:38.074 [TRACE] [smarthome.event.ItemStateChangedEvent] - Received event of type 'ItemStateChangedEvent' under the topic 'smarthome/items/XiaomiAqaraWallSwitch2Button_Button1/statechanged' with payload: '{"type":"OnOff","value":"ON","oldType":"OnOff","oldValue":"OFF"}'                                                                                                                                                                                                    
11:51:38.080 [DEBUG] [ng.mihome.handler.XiaomiBridgeHandler] - Send to bridge mihome:bridge:7811dcdXXXXX: {"cmd": "write", "sid": "158d0001XXXXXX", "data": "{\"channel_0\": \"on\", \"key\": \"B7E2XXXXX2763C239FXXXXXXXXXXXXXX"}"}       
11:51:38.083 [INFO ] [smarthome.event.ItemStateChangedEvent] - XiaomiAqaraWallSwitch2Button_Button1 changed from OFF to ON                                                                                                                 
11:51:38.094 [TRACE] [g.mihome.internal.socket.XiaomiSocket] - Sending message: {"cmd": "write", "sid": "158d0001XXXXXX", "data": "{\"channel_0\": \"on\", \"key\": \"B7E2XXXXX2763C239FXXXXXXXXXXXXXX"}"} to /192.168.1.62:9898           
11:51:38.126 [DEBUG] [g.mihome.internal.socket.XiaomiSocket] - Received Datagram from 192.168.1.62:9898 on Port 9898                                                                                                                       
11:51:38.129 [TRACE] [ng.mihome.handler.XiaomiBridgeHandler] - Received message {"cmd":"write_ack","model":"ctrl_neutral2","sid":"158d0001XXXXXX","short_id":88,"data":"{\"voltage\":3300,\"channel_0\":\"off\",\"channel_1\":\"on\"}"}    
11:51:38.129 [TRACE] [ng.mihome.handler.XiaomiBridgeHandler] - Updated "last time seen" for device 158d0001XXXXXX                                                                                                                          
11:51:38.132 [DEBUG] [ng.mihome.handler.XiaomiBridgeHandler] - Device 158d0001XXXXXX honored write request                                                                                                                                 
11:51:38.144 [DEBUG] [ihome.handler.XiaomiDeviceBaseHandler] - Item got update: {"cmd":"write_ack","model":"ctrl_neutral2","sid":"158d0001XXXXXX","short_id":88,"data":"{\"voltage\":3300,\"channel_0\":\"off\",\"channel_1\":\"on\"}"}    
11:51:38.146 [TRACE] [g.mihome.internal.socket.XiaomiSocket] - Data received and notified 1 listeners                                                                                                                                      
11:51:38.153 [TRACE] [g.mihome.internal.socket.XiaomiSocket] - Thread Thread[Thread-70,5,main] waiting for data on port 9898                                                                                                               
11:51:38.147 [TRACE] [smarthome.event.ItemStateEvent       ] - Received event of type 'ItemStateEvent' under the topic 'smarthome/items/XiaomiAqaraWallSwitch2Button_Button1/state' with payload: '{"type":"OnOff","value":"OFF"}'         
11:51:38.164 [INFO ] [smarthome.event.ItemStateEvent       ] - XiaomiAqaraWallSwitch2Button_Button1 updated to OFF                                                                                                                         
11:51:38.180 [TRACE] [smarthome.event.ItemStateChangedEvent] - Received event of type 'ItemStateChangedEvent' under the topic 'smarthome/items/XiaomiAqaraWallSwitch2Button_Button1/statechanged' with payload: '{"type":"OnOff","value":"OFF","oldType":"OnOff","oldValue":"ON"}'                                                                                                                                                                                                    
11:51:38.202 [INFO ] [smarthome.event.ItemStateChangedEvent] - XiaomiAqaraWallSwitch2Button_Button1 changed from ON to OFF                                                                                                                 
11:51:38.343 [DEBUG] [g.mihome.internal.socket.XiaomiSocket] - Received Datagram from 192.168.1.62:4321 on Port 9898                                                                                                                       
11:51:38.344 [TRACE] [ng.mihome.handler.XiaomiBridgeHandler] - Received message {"cmd":"report","model":"ctrl_neutral2","sid":"158d0001XXXXXX","short_id":88,"data":"{\"channel_0\":\"on\"}"}                                              
11:51:38.349 [TRACE] [ng.mihome.handler.XiaomiBridgeHandler] - Updated "last time seen" for device 158d0001XXXXXX                                                                                                                          
11:51:38.364 [DEBUG] [ihome.handler.XiaomiDeviceBaseHandler] - Item got update: {"cmd":"report","model":"ctrl_neutral2","sid":"158d0001XXXXXX","short_id":88,"data":"{\"channel_0\":\"on\"}"}                                              
11:51:38.380 [TRACE] [smarthome.event.ItemStateEvent       ] - Received event of type 'ItemStateEvent' under the topic 'smarthome/items/XiaomiAqaraWallSwitch2Button_Button1/state' with payload: '{"type":"OnOff","value":"ON"}'          
11:51:38.393 [INFO ] [smarthome.event.ItemStateEvent       ] - XiaomiAqaraWallSwitch2Button_Button1 updated to ON                                                                                                                          
11:51:38.405 [TRACE] [smarthome.event.ItemStateChangedEvent] - Received event of type 'ItemStateChangedEvent' under the topic 'smarthome/items/XiaomiAqaraWallSwitch2Button_Button1/statechanged' with payload: '{"type":"OnOff","value":"ON","oldType":"OnOff","oldValue":"OFF"}'                                                                                                                                                                                                    
11:51:38.417 [INFO ] [smarthome.event.ItemStateChangedEvent] - XiaomiAqaraWallSwitch2Button_Button1 changed from OFF to ON                                                                                                                 
11:51:38.427 [TRACE] [g.mihome.internal.socket.XiaomiSocket] - Data received and notified 1 listeners                                                                                                                                      
11:51:38.431 [TRACE] [g.mihome.internal.socket.XiaomiSocket] - Thread Thread[Thread-70,5,main] waiting for data on port 9898       
dimalo commented 6 years ago

Hi @Vanshava, please check out the new firmware version 1.4.1_153.0143. Are you able to reproduce the above log? Thanks!

dimalo commented 6 years ago

Hi @Vanshava, any progress on this issue? I would like to keep the issues as up to date as possible... cheers!

Vanshava commented 6 years ago

Hi dimalo

Sorry for late reply. Testing on firmware 1.4.1_153.0143 but still encountered bounce problem. as below log.

23:54:17.407 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'AqaraWallSwitch1' received command ON                                                                                 
23:54:17.414 [INFO ] [smarthome.event.ItemStateChangedEvent] - AqaraWallSwitch1 changed from OFF to ON                                                                                     
23:54:17.415 [INFO ] [smarthome.event.ItemStateChangedEvent] - AqaraWallSwitch1 changed from ON to OFF                                                                                     
23:54:17.802 [INFO ] [smarthome.event.ItemStateChangedEvent] - AqaraWallSwitch1 changed from OFF to ON                   

23:54:26.295 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'AqaraWallSwitch1' received command OFF                                                                                
23:54:26.304 [INFO ] [smarthome.event.ItemStateChangedEvent] - AqaraWallSwitch1 changed from ON to OFF                                                                                     
23:54:26.308 [INFO ] [smarthome.event.ItemStateChangedEvent] - AqaraWallSwitch1 changed from OFF to ON                                                                                     
23:54:26.727 [INFO ] [smarthome.event.ItemStateChangedEvent] - AqaraWallSwitch1 changed from ON to OFF     
Tymo3 commented 6 years ago

Hi Vanshava, I have the same problem - but with Single switch (Aqara Single Gang Wall Switch). Same thing - 3x (ON-->OFF, OFF-->ON, ON-->OFF). Have you found solution?

Strange as wireless buttons does not generate this problem.

T

servim commented 6 years ago

Hello! I have the same problem, switches:

  1. One-button with neutral
  2. Two-button without neutral @dimalo, could you look at the problem?
dimalo commented 6 years ago

Hello guys, the new PR should fix your problems. please provide feedback, as soon as the snapshot build is finished and the new version is online.

servim commented 6 years ago

openHAB 2.4.0 Milestone Build the problem is not solved left button - 3 events right button - 1 event