zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

Xiaomi Aqara wireless switch WXKG11LM - hold not working

Open cela96 opened this issue 7 years ago • 13 comments

Hi all, I have correctly configured the device but unfortunately the hold function does not work. Zigbee2mqtt does not receive hold state in the log, triple and quadruple click work fine. The long state of mija switch is received correctly and work.

Is it possible that the switch (WXKG11LM) is not compatible with the hold status but is compatible with triple and quadruple?

Thanks in advance

cela96 avatar Mar 08 '19 17:03 cela96

Can you post your log when performing the hold with log_level: debug? (http://www.zigbee2mqtt.io/configuration/configuration.html)

Koenkk avatar Mar 09 '19 15:03 Koenkk

it happens the same to me. It works a simple, double, triple and quadruple click, but when i hold the button it does not detect anything.

Another curious thing is that the idle state of the button is "unknown". When I click on the button it goes to "simple" and then returns to "unknown" (after 1 second). But this does not seem to affect

Here is the log, but no new lines appear when I hold the button. Here is the log with a single click and hold:

[Info] Configuration file found: /share/zigbee2mqtt/configuration.yaml
[Info] Configuration written to /share/zigbee2mqtt/configuration.yaml
2019-03-12T23:33:11: PM2 log: Launching in no daemon mode
2019-03-12T23:33:11: PM2 log: App [npm:0] starting in -fork mode-
2019-03-12T23:33:11: PM2 log: App [npm:0] online
> [email protected] start /zigbee2mqtt-1.2.1
> node index.js
  zigbee2mqtt:info 3/12/2019, 11:33:16 PM Logging to directory: '/share/zigbee2mqtt/log/2019-03-12.23-33-16'
  zigbee2mqtt:debug 3/12/2019, 11:33:16 PM Removing old log directory '/share/zigbee2mqtt/log/2019-02-28.11-25-52'
  zigbee2mqtt:debug 3/12/2019, 11:33:17 PM Using zigbee-shepherd with settings: '{"net":{"panId":6754,"extPanId":[221,221,221,221,221,221,221,221],"channelList":[11],"precfgkey":"HIDDEN"},"dbPath":"/share/zigbee2mqtt/database.db","sp":{"baudRate":115200,"rtscts":true}}'
  zigbee2mqtt:debug 3/12/2019, 11:33:18 PM Loaded state from file /share/zigbee2mqtt/state.json
  zigbee2mqtt:debug 3/12/2019, 11:33:18 PM Saving state to file /share/zigbee2mqtt/state.json
  zigbee2mqtt:info 3/12/2019, 11:33:18 PM Starting zigbee2mqtt version 1.2.1 (commit #unknown)
  zigbee2mqtt:info 3/12/2019, 11:33:18 PM Starting zigbee-shepherd
  zigbee2mqtt:info 3/12/2019, 11:33:21 PM zigbee-shepherd started
  zigbee2mqtt:info 3/12/2019, 11:33:21 PM Coordinator firmware version: '20190109'
  zigbee2mqtt:debug 3/12/2019, 11:33:21 PM zigbee-shepherd info: {"enabled":true,"net":{"state":"Coordinator","channel":11,"panId":"0x1a62","extPanId":"0xdddddddddddddddd","ieeeAddr":"0x00124b0018df4679","nwkAddr":0},"firmware":{"transportrev":2,"product":0,"version":"2.6.3","revision":20190109},"startTime":1552430001,"joinTimeLeft":0}
  zigbee2mqtt:info 3/12/2019, 11:33:21 PM Currently 2 devices are joined:
  zigbee2mqtt:info 3/12/2019, 11:33:21 PM xa_dswitch_salon (0x00158d0003152dd8): QBKG03LM - Xiaomi Aqara double key wired wall switch (Router)
  zigbee2mqtt:info 3/12/2019, 11:33:21 PM xa_button_hall (0x00158d0002008976): WXKG11LM - Xiaomi Aqara wireless switch (EndDevice)
  zigbee2mqtt:info 3/12/2019, 11:33:21 PM Zigbee: disabling joining new devices.
  zigbee2mqtt:info 3/12/2019, 11:33:21 PM Connecting to MQTT server at mqtt://homeassistant
  zigbee2mqtt:info 3/12/2019, 11:33:21 PM zigbee-shepherd ready
  zigbee2mqtt:debug 3/12/2019, 11:33:22 PM Mounted the cieApp (epId 11)
  zigbee2mqtt:info 3/12/2019, 11:33:26 PM Connected to MQTT server
  zigbee2mqtt:info 3/12/2019, 11:33:26 PM MQTT publish: topic 'zigbee2mqtt/bridge/state', payload 'online'
  zigbee2mqtt:info 3/12/2019, 11:33:26 PM MQTT publish: topic 'zigbee2mqtt/xa_dswitch_salon', payload '{"state_left":"OFF","linkquality":76,"state_right":"ON"}'
  zigbee2mqtt:info 3/12/2019, 11:33:26 PM MQTT publish: topic 'zigbee2mqtt/xa_button_hall', payload '{"battery":91,"voltage":2985,"linkquality":128}'
  zigbee2mqtt:info 3/12/2019, 11:33:26 PM MQTT publish: topic 'zigbee2mqtt/bridge/config', payload '{"log_level":"debug","permit_join":false}'
  zigbee2mqtt:info 3/12/2019, 11:33:26 PM MQTT publish: topic 'homeassistant/switch/0x00158d0003152dd8/switch_left/config', payload '{"payload_off":"OFF","payload_on":"ON","value_template":"{{ value_json.state_left }}","command_topic":"zigbee2mqtt/xa_dswitch_salon/left/set","state_topic":"zigbee2mqtt/xa_dswitch_salon","name":"xa_dswitch_salon_switch_left","unique_id":"0x00158d0003152dd8_switch_left_zigbee2mqtt","device":{"identifiers":"zigbee2mqtt_0x00158d0003152dd8","name":"xa_dswitch_salon","sw_version":"Zigbee2mqtt 1.2.1","model":"Aqara double key wired wall switch (QBKG03LM)","manufacturer":"Xiaomi"},"availability_topic":"zigbee2mqtt/bridge/state"}'
  zigbee2mqtt:info 3/12/2019, 11:33:26 PM MQTT publish: topic 'homeassistant/switch/0x00158d0003152dd8/switch_right/config', payload '{"payload_off":"OFF","payload_on":"ON","value_template":"{{ value_json.state_right }}","command_topic":"zigbee2mqtt/xa_dswitch_salon/right/set","state_topic":"zigbee2mqtt/xa_dswitch_salon","name":"xa_dswitch_salon_switch_right","unique_id":"0x00158d0003152dd8_switch_right_zigbee2mqtt","device":{"identifiers":"zigbee2mqtt_0x00158d0003152dd8","name":"xa_dswitch_salon","sw_version":"Zigbee2mqtt 1.2.1","model":"Aqara double key wired wall switch (QBKG03LM)","manufacturer":"Xiaomi"},"availability_topic":"zigbee2mqtt/bridge/state"}'
  zigbee2mqtt:info 3/12/2019, 11:33:26 PM MQTT publish: topic 'homeassistant/sensor/0x00158d0003152dd8/linkquality/config', payload '{"unit_of_measurement":"-","value_template":"{{ value_json.linkquality }}","state_topic":"zigbee2mqtt/xa_dswitch_salon","json_attributes_topic":"zigbee2mqtt/xa_dswitch_salon","name":"xa_dswitch_salon_linkquality","unique_id":"0x00158d0003152dd8_linkquality_zigbee2mqtt","device":{"identifiers":"zigbee2mqtt_0x00158d0003152dd8","name":"xa_dswitch_salon","sw_version":"Zigbee2mqtt 1.2.1","model":"Aqara double key wired wall switch (QBKG03LM)","manufacturer":"Xiaomi"},"availability_topic":"zigbee2mqtt/bridge/state"}'
  zigbee2mqtt:info 3/12/2019, 11:33:26 PM MQTT publish: topic 'homeassistant/sensor/0x00158d0002008976/click/config', payload '{"icon":"mdi:toggle-switch","value_template":"{{ value_json.click }}","expire_after":1,"state_topic":"zigbee2mqtt/xa_button_hall","json_attributes_topic":"zigbee2mqtt/xa_button_hall","name":"xa_button_hall_click","unique_id":"0x00158d0002008976_click_zigbee2mqtt","device":{"identifiers":"zigbee2mqtt_0x00158d0002008976","name":"xa_button_hall","sw_version":"Zigbee2mqtt 1.2.1","model":"Aqara wireless switch (WXKG11LM)","manufacturer":"Xiaomi"},"availability_topic":"zigbee2mqtt/bridge/state"}'
  zigbee2mqtt:info 3/12/2019, 11:33:26 PM MQTT publish: topic 'homeassistant/sensor/0x00158d0002008976/battery/config', payload '{"unit_of_measurement":"%","device_class":"battery","value_template":"{{ value_json.battery }}","state_topic":"zigbee2mqtt/xa_button_hall","json_attributes_topic":"zigbee2mqtt/xa_button_hall","name":"xa_button_hall_battery","unique_id":"0x00158d0002008976_battery_zigbee2mqtt","device":{"identifiers":"zigbee2mqtt_0x00158d0002008976","name":"xa_button_hall","sw_version":"Zigbee2mqtt 1.2.1","model":"Aqara wireless switch (WXKG11LM)","manufacturer":"Xiaomi"},"availability_topic":"zigbee2mqtt/bridge/state"}'
  zigbee2mqtt:info 3/12/2019, 11:33:26 PM MQTT publish: topic 'homeassistant/sensor/0x00158d0002008976/linkquality/config', payload '{"unit_of_measurement":"-","value_template":"{{ value_json.linkquality }}","state_topic":"zigbee2mqtt/xa_button_hall","json_attributes_topic":"zigbee2mqtt/xa_button_hall","name":"xa_button_hall_linkquality","unique_id":"0x00158d0002008976_linkquality_zigbee2mqtt","device":{"identifiers":"zigbee2mqtt_0x00158d0002008976","name":"xa_button_hall","sw_version":"Zigbee2mqtt 1.2.1","model":"Aqara wireless switch (WXKG11LM)","manufacturer":"Xiaomi"},"availability_topic":"zigbee2mqtt/bridge/state"}'
  zigbee2mqtt:debug 3/12/2019, 11:34:05 PM Received zigbee message of type 'attReport' with data '{"cid":"genOnOff","data":{"onOff":1}}' of device 'lumi.sensor_switch.aq2' (0x00158d0002008976)
  zigbee2mqtt:info 3/12/2019, 11:34:06 PM MQTT publish: topic 'zigbee2mqtt/xa_button_hall', payload '{"battery":91,"voltage":2985,"linkquality":94,"click":"single"}'
  zigbee2mqtt:debug 3/12/2019, 11:34:06 PM Received zigbee message of type 'devChange' with data '{"cid":"genOnOff","data":{"onOff":1}}' of device 'lumi.sensor_switch.aq2' (0x00158d0002008976)
  zigbee2mqtt:debug 3/12/2019, 11:34:06 PM Received MQTT message on 'zigbee2mqtt/xa_dswitch_salon/left/set' with data 'ON'
  zigbee2mqtt:info 3/12/2019, 11:34:06 PM Zigbee publish to device '0x00158d0003152dd8', genOnOff - on - {} - {"manufSpec":0,"disDefaultRsp":0} - 2
  zigbee2mqtt:info 3/12/2019, 11:34:07 PM MQTT publish: topic 'zigbee2mqtt/xa_dswitch_salon', payload '{"state_left":"ON","linkquality":76,"state_right":"ON"}'
  zigbee2mqtt:debug 3/12/2019, 11:34:10 PM Received zigbee message of type 'attReport' with data '{"cid":"genOnOff","data":{"61440":117440513,"onOff":1}}' of device 'lumi.ctrl_neutral2' (0x00158d0003152dd8)
  zigbee2mqtt:info 3/12/2019, 11:34:10 PM MQTT publish: topic 'zigbee2mqtt/xa_dswitch_salon', payload '{"state_left":"ON","linkquality":60,"state_right":"ON"}'
  zigbee2mqtt:debug 3/12/2019, 11:34:10 PM Received zigbee message of type 'devChange' with data '{"cid":"genOnOff","data":{"61440":117440513,"onOff":1}}' of device 'lumi.ctrl_neutral2' (0x00158d0003152dd8)
  zigbee2mqtt:debug 3/12/2019, 11:34:11 PM Received zigbee message of type 'readRsp' with data '{"cid":"genOnOff","data":{"onOff":1}}' of device 'lumi.ctrl_neutral2' (0x00158d0003152dd8)
  zigbee2mqtt:info 3/12/2019, 11:34:11 PM MQTT publish: topic 'zigbee2mqtt/xa_dswitch_salon', payload '{"state_left":"ON","linkquality":70,"state_right":"ON"}'
  zigbee2mqtt:debug 3/12/2019, 11:34:11 PM Received zigbee message of type 'devChange' with data '{"cid":"genOnOff","data":{"onOff":1}}' of device 'lumi.ctrl_neutral2' (0x00158d0003152dd8)
  zigbee2mqtt:debug 3/12/2019, 11:34:21 PM Ping 0x00158d0003152dd8
  zigbee2mqtt:debug 3/12/2019, 11:34:22 PM Successfully pinged 0x00158d0003152dd8
  zigbee2mqtt:debug 3/12/2019, 11:34:51 PM Received zigbee message of type 'endDeviceAnnce' with data '"0x00158d0003152dd8"' of device 'lumi.ctrl_neutral2' (0x00158d0003152dd8)
  zigbee2mqtt:debug 3/12/2019, 11:35:22 PM Ping 0x00158d0003152dd8
  zigbee2mqtt:debug 3/12/2019, 11:35:22 PM Successfully pinged 0x00158d0003152dd8
  zigbee2mqtt:debug 3/12/2019, 11:36:21 PM Ping 0x00158d0003152dd8
  zigbee2mqtt:debug 3/12/2019, 11:36:22 PM Successfully pinged 0x00158d0003152dd8
  zigbee2mqtt:debug 3/12/2019, 11:36:59 PM Received zigbee message of type 'attReport' with data '{"cid":"genBasic","data":{"65281":{"1":3300,"3":20,"5":18,"8":9750,"10":0,"100":1,"101":1,"110":1,"111":1,"153":0,"155":0}}}' of device 'lumi.ctrl_neutral2' (0x00158d0003152dd8)
  zigbee2mqtt:debug 3/12/2019, 11:36:59 PM Received zigbee message of type 'devChange' with data '{"cid":"genBasic","data":{"65281":[null,3300,null,20,null,18,null,null,9750,null,0,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1,1,null,null,null,null,null,null,null,null,1,1,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0,null,0]}}' of device 'lumi.ctrl_neutral2' (0x00158d0003152dd8)
  zigbee2mqtt:debug 3/12/2019, 11:37:22 PM Ping 0x00158d0003152dd8
  zigbee2mqtt:debug 3/12/2019, 11:37:22 PM Successfully pinged 0x00158d0003152dd8

sermayoral avatar Mar 12 '19 22:03 sermayoral

To really check what is going on, could you sniff the zigbee traffic on a long hold? (http://www.zigbee2mqtt.io/how_tos/how_to_sniff_zigbee_traffic.html)

Koenkk avatar Mar 13 '19 18:03 Koenkk

I only have Windows 10 OS, and the ZBOSS page doesn't work: http://zboss.dsr-wireless.com/

Do you have an alternative? Sorry and thanks!!

sermayoral avatar Mar 13 '19 20:03 sermayoral

Unfortunately not, please try with a virtualbox linux vm.

Koenkk avatar Mar 14 '19 06:03 Koenkk

It seems that the web is working again. When I have a little time I sniff the network and report the result.

Thank you!

sermayoral avatar Mar 14 '19 15:03 sermayoral

Here you are :-)

I am sending you the messages of all the possibilities of the Aqara button, in case it can be useful.

With a simple and double click, I can see a single message and everything seems correct.

With the triple and quadruple click, I can see two messages, one normal and one malformed.

When I hold the button, nothing happens. If I release it before 3 seconds, I see the same message as a simple click. If I hold it for more than 3 seconds, I do not see any message, even when I release it. In one case I received a message different from the previous ones, but it almost never happens.

If I can help you with something else, you just have to say it.

Thank you.

WXKG11LM_sniff.zip

sermayoral avatar Mar 20 '19 03:03 sermayoral

As it indeed send nothing on a long press, I think this variant of the WXKG11LM doens't support long clicks.

Koenkk avatar Mar 21 '19 19:03 Koenkk

Ok @Koenkk. It has been tried. Thanks!!

sermayoral avatar Mar 22 '19 07:03 sermayoral

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 21 '19 08:05 stale[bot]

@Koenkk The problem is in a different payload. Single and Double clicks are "click", but Hold is and action.

payload '{"linkquality":47,"battery":100,"voltage":3065,"click":"double"}' payload '{"linkquality":23,"battery":100,"voltage":3065,"action":"hold"}'

In my case only "click sensor" was autodiscovered by Home Assistant "sensor.0x00158d0001e88543_click"

Please add "action sensor" to your configuration.yaml file manually to solve the problem.

sensor:

  • platform: "mqtt" name: "0x00158d0001e88543_action" state_topic: "zigbee2mqtt/0x00158d0001e88543" availability_topic: "zigbee2mqtt/bridge/state" icon: "mdi:toggle-switch" value_template: "{{ value_json.action }}"

pszeremeta86 avatar Jun 17 '19 20:06 pszeremeta86

@pszeremeta86 yes, this has been fixed in #1640

Koenkk avatar Jun 18 '19 06:06 Koenkk

@Koenkk I see you fixed above error for WXKG03LM in #1640. I use device WXKG11LM, where the problem still exists (Hold is published as an Action, not as a Click)

Environment: Z2M v. 1.28.0

MQTT output when performing HOLD:

zigbee2mqtt/bridge/logging {"level":"info","message":"MQTT publish: topic 'zigbee2mqtt/0x00158d000401886f', payload '{"action":"hold","battery":100,"click":null,"device_temperature":27,"linkquality":168,"power_outage_count":29,"voltage":3005}'"} zigbee2mqtt/0x00158d000401886f {"action":"hold","battery":100,"click":null,"device_temperature":27,"linkquality":168,"power_outage_count":29,"voltage":3005} zigbee2mqtt/bridge/logging {"level":"info","message":"MQTT publish: topic 'zigbee2mqtt/0x00158d000401886f', payload '{"action":"","battery":100,"click":null,"device_temperature":27,"linkquality":168,"power_outage_count":29,"voltage":3005}'"} zigbee2mqtt/0x00158d000401886f {"action":"","battery":100,"click":null,"device_temperature":27,"linkquality":168,"power_outage_count":29,"voltage":3005} zigbee2mqtt/bridge/logging {"level":"info","message":"MQTT publish: topic 'zigbee2mqtt/0x00158d000401886f/action', payload 'hold'"} zigbee2mqtt/0x00158d000401886f/action hold

@pszeremeta86 , can you please point me to more information on the correct syntax to add your workaround to my configuration.yaml? Thanks!

Raeymeister avatar Oct 14 '22 16:10 Raeymeister