Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
11.75k stars 1.64k forks source link

Xiaomi switch WXKG01LM pulsation detection failure #3445

Closed kitopopo closed 4 years ago

kitopopo commented 4 years ago

Hi dear @Koenkk , I hope you are well with this epidemic. I send him a lot of strength,

I will explain my problem with three xiamo switchs (WXKG01LM)

What happened

I have problems with the xiaomi switch WXKG01LM (pulsation detection failure). The switch has always worked correctly but since the last update I noticed that it does not correctly detect the pulsations, single, double, triple, quadruple,long..etc . Doing a double click detects quadruple or triple or single. Making a triple click zigbe detects long click... it is random but and hardly ever matches .The problem is solved by stopping the zigbee2mqtt service and starting it again.

In the debug info i leave you a sample of the log, in this example ,In the last press was an individual click but zigbee2mqtt detects t other clicks. I wanted to turn on the light and the home theater came on and repeating a message through the speakers 3 times in a row. horrible. Single click should have turned on the light and double-clicking should have played the message through the speakers but not all at once. the light went out and the message was played many times. I have 2 xiaomi switch more and all fail with this problem. I have tryied delete the three switches and pairing again but the problem persist.

Thanks in advanced and best regards.

What did you expect to happen

the number of pulses emitted must coincide with the number of pulsations received

How to reproduce it (minimal and precise)

testing single click, double click or triple click after some hours of start zigbee2mqtt service.

Debug Info

`` 29 00:33:39 raspberrypi npm[416]: zigbee2mqtt:info  2020-04-29 00:33:39: MQTT publish: topic 'zigbee2mqtt/Denon plug', payload '{"state":"ON","power":7.79,"voltage":null,"consumption":68.39,"temperature":32,"linkquality":102}'
abr 29 00:34:06 raspberrypi npm[416]: zigbee2mqtt:info  2020-04-29 00:34:06: MQTT publish: topic 'zigbee2mqtt/Switch salon', payload '{"battery":100,"voltage":3042,"linkquality":44,"click":"quadruple"}'
abr 29 00:34:11 raspberrypi npm[416]: zigbee2mqtt:info  2020-04-29 00:34:11: MQTT publish: topic 'zigbee2mqtt/Switch salon', payload '{"battery":100,"voltage":3042,"linkquality":44,"click":"quadruple"}'
abr 29 00:34:15 raspberrypi npm[416]: zigbee2mqtt:info  2020-04-29 00:34:15: MQTT publish: topic 'zigbee2mqtt/Switch salon', payload '{"battery":100,"voltage":3042,"linkquality":47,"click":"triple"}'
abr 29 00:34:24 raspberrypi npm[416]: zigbee2mqtt:info  2020-04-29 00:34:24: MQTT publish: topic 'zigbee2mqtt/Hdd plug', payload '{"state":"ON","linkquality":113,"power":5.88,"voltage":null,"consumption":24.52,"temperature":37}'
abr 29 00:34:25 raspberrypi npm[416]: zigbee2mqtt:info  2020-04-29 00:34:25: MQTT publish: topic 'zigbee2mqtt/Switch salon', payload '{"battery":100,"voltage":3042,"linkquality":47,"click":"triple"}'
abr 29 00:34:29 raspberrypi npm[416]: zigbee2mqtt:info  2020-04-29 00:34:29: MQTT publish: topic 'zigbee2mqtt/Switch salon', payload '{"battery":100,"voltage":3042,"linkquality":47,"click":"long"}'
abr 29 00:34:29 raspberrypi npm[416]: zigbee2mqtt:info  2020-04-29 00:34:29: MQTT publish: topic 'zigbee2mqtt/Switch salon', payload '{"battery":100,"voltage":3042,"linkquality":44,"click":"long_release","duration":142}'
abr 29 00:34:29 raspberrypi npm[416]: zigbee2mqtt:info  2020-04-29 00:34:29: MQTT publish: topic 'zigbee2mqtt/Switch salon', payload '{"battery":100,"voltage":3042,"linkquality":47,"click":"long"}'
abr 29 00:34:30 raspberrypi npm[416]: zigbee2mqtt:info  2020-04-29 00:34:30: MQTT publish: topic 'zigbee2mqtt/Switch salon', payload `'{"battery":100,"voltage":3042,"linkquality":47,"click":"long"}'

Zigbee2mqtt version:1.12.2-dev Adapter hardware: CC2531 Adapter firmware version: DEFAULT_20190608

Koenkk commented 4 years ago

Please check https://www.zigbee2mqtt.io/devices/WXKG01LM.html#device-type-specific-configuration

kitopopo commented 4 years ago

Ok, thanks. I check this in the next hours and if it is the problem i will close the issue. Thanks very much. Best regards

kitopopo commented 4 years ago

Dear @Koenkk ,

I have added in the configuration.yaml file "long_timeout: 2000" under my sensor but any result, same problem appear, i am not shure if the command is correctly added below my devices in configuration.yam (I am using domoticz)

my configuration.yaml.file

'0x00158d000418xxxx':
    friendly_name: Switch salon
    long_timeout: 2000

If the command is correctly added heare doesn't works. the problem persist.

Some minuts i am upgraded to 1.13 version, i will test the problem in the new version. i will inform you.

Best regards

kitopopo commented 4 years ago

Hello dear @koenkk,

I have confirmed now again that adding the line you mentioned in configuration.yalml the problem persists. I try to make a long press and the long and short press occurs, I try to make 3 clicks and it produces a single click + double press, the problem persists. Any solution? I already told you that all the buttons until update 1.11 have always worked well for me, I think I started to notice the problem in update 1.12, but since I use betas versions I cannot assure you that dev branch started giving problems, in a raspberry pi 4 only with domoticz working, the system should not be overloaded. Thanks in advance. a cordial greeting

Koenkk commented 4 years ago

With long_timeout 2000 you have to hold the button for 2 seconds to trigger a long. Can you check with what version it still works?

kitopopo commented 4 years ago

Thanks for your answer @Koenkk ,

But the problem is not only in the long click or single click. For instance, i need dissable my alarm with three clicks, but the result is double click detected + single click. I would like to dissable my alarm but the result was ( message of the temperature in home cinema speakers (double click) + lamp turned on (living room). Yes i can check old versions . How i can downgrade to 1.11? Have you instructions?

Thank you very much.

Koenkk commented 4 years ago

Detection of double/triple clicks is done by the button itself so I dont think downgrading will fix anything.

kitopopo commented 4 years ago

Hi dear friend @Koenkk ,

Hello, I understand that the detection is done by the switch itself but since I installed zigbee2mqtt more than a year ago in my 3 switches, the clicks and the detection have never failed, there must be some other problem. I should not press 3 clicks and other actions occur such as the blinds being lowered or a message being heard through the speakers at night or lights are turned on. It is dangerous. each press should do its job as always, I do not know what has changed in the last month. Thank you very much in advance

kitopopo commented 4 years ago

After testing the problem for two days, it seems that adding the 2 lines that @koenkk has commented, the problem has not occurred again only once, it seems that it has improved a lot. thank you

kitopopo commented 4 years ago

Dear friend @koenkk,

I apologize for bothering with the same thing but my xiaomi switches do not work well. I have been using them for a year and I have never had any problem, now for example I cannot deactivate the alarm with 3 presses. After making the 3 clicks zigbe2mqtt has detected the following:

may 07 23:56:03 raspberrypi npm[424]: zigbee2mqtt:info  2020-05-07 23:56:03: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":65,"click":"double"}'
may 07 23:56:03 raspberrypi npm[424]: zigbee2mqtt:info  2020-05-07 23:56:03: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":65,"click":"long_release","duration":63701}'
may 07 23:56:03 raspberrypi npm[424]: zigbee2mqtt:info  2020-05-07 23:56:03: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":65,"click":"single"}'

I have been turning the alarm on and off for a year and have never had these problems. I don't know what is happening but something happens. As you said I added the line to configuration.yaml but I don't get improvements.-

my configuration.yaml.file

'0x00158d000418xxxx':
    friendly_name: Switch salon
    long_timeout: 2000

Every day the problem occurs, i can not use this switches, alarms fails, message in the speakers fails, Blinds go up when they shouldn't, lamp on/off fails. A disaster but if I restart the zigbe2mqtt service it works fine, works perfectly for for a time . please ,see all the log:

may 08 00:05:27 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:05:27: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":65,"click":"single"}'
may 08 00:05:30 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:05:30: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"single"}'
may 08 00:05:32 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:05:32: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"triple"}'
may 08 00:05:35 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:05:35: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"triple"}'
may 08 00:05:37 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:05:37: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"triple"}'
may 08 00:05:39 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:05:39: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"triple"}'
may 08 00:05:41 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:05:41: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"triple"}'
may 08 00:05:42 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:05:42: MQTT publish: topic 'zigbee2mqtt/Denon plug', payload '{"state":"ON","power":7.79,"voltage":null,"consumption":69.01,"temperature":35,"linkquality":107}'
may 08 00:05:43 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:05:43: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"double"}'
may 08 00:05:46 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:05:46: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"triple"}'
may 08 00:05:47 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:05:47: MQTT publish: topic 'zigbee2mqtt/Denon plug', payload '{"state":"ON","power":33.42,"voltage":null,"consumption":69.01,"temperature":35,"linkquality":105}'
may 08 00:05:47 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:05:47: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"single"}'
may 08 00:05:49 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:05:49: MQTT publish: topic 'zigbee2mqtt/Denon plug', payload '{"state":"ON","power":65.52,"voltage":null,"consumption":69.01,"temperature":35,"linkquality":107}'
may 08 00:05:49 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:05:49: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":65,"click":"single"}'
may 08 00:05:51 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:05:51: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"triple"}'
may 08 00:05:53 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:05:53: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"double"}'
may 08 00:05:55 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:05:55: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"triple"}'
may 08 00:05:57 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:05:57: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"double"}'
may 08 00:05:59 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:05:59: MQTT publish: topic 'zigbee2mqtt/Denon plug', payload '{"state":"ON","power":71.6,"voltage":null,"consumption":69.01,"temperature":35,"linkquality":107}'
may 08 00:05:59 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:05:59: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":65,"click":"triple"}'
may 08 00:06:01 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:06:01: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":65,"click":"single"}'
may 08 00:06:02 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:06:02: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"single"}'
may 08 00:06:05 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:06:05: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":65,"click":"triple"}'
may 08 00:06:07 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:06:07: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"single"}'
may 08 00:06:09 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:06:09: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":65,"click":"single"}'
may 08 00:06:11 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:06:11: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":65,"click":"quadruple"}'
may 08 00:06:15 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:06:15: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"quadruple"}'
may 08 00:06:17 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:06:17: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":65,"click":"quadruple"}'
may 08 00:06:19 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:06:19: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":65,"click":"quadruple"}'
may 08 00:06:22 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:06:22: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"triple"}'
may 08 00:06:24 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:06:24: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"quadruple"}'
may 08 00:06:27 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:06:27: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"many"}'
may 08 00:06:30 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:06:30: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"many"}'
may 08 00:06:32 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:06:32: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"many"}'
may 08 00:06:35 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:06:35: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"many"}'
may 08 00:06:37 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:06:37: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"many"}'
may 08 00:06:39 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:06:39: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"quadruple"}'
may 08 00:06:41 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:06:41: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":65,"click":"triple"}'
may 08 00:06:42 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:06:42: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"double"}'
may 08 00:06:44 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:06:44: MQTT publish: topic 'zigbee2mqtt/Sensor lavadero', payload '{"battery":100,"voltage":3025,"contact":true,"linkquality":65}'
may 08 00:06:44 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:06:44: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"single"}'
may 08 00:06:46 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:06:46: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"double"}'
may 08 00:06:47 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:06:47: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"double"}'
may 08 00:06:48 raspberrypi npm[9987]: zigbee2mqtt:info  2020-05-08 00:06:48: MQTT publish: topic 'zigbee2mqtt/0x00158d000418cd86', payload '{"battery":100,"voltage":3062,"linkquality":63,"click":"single"}'

all detected clicks correspond to the number of pulses emitted, none has failed. and they are fast pulsations in less than a second

Can you investigate please? seems something no works correctly in zigbe2mqtt service. thanks in advance. Best regards

Koenkk commented 4 years ago

I think this is a network issue.

kitopopo commented 4 years ago

Dear @koenkk,

I have an big antenna in the cordinator, anyway, I have several xiaomi samrt plug distributed around tmy home that are signal repeaters. In the zigbee2mqtt device map I have an excellent signal in my 4 xiaomi switches., In my network I have a whole of 28 zigbee devices. It is not a signal problem, as I have already told you if I restart the zigbe2mqtt service using "systemctl restart zigbee2mqtt" my devices work perfectly for a few hours. a cordial greeting and thanks again

Koenkk commented 4 years ago
kitopopo commented 4 years ago

But let's see, why do you say it is a problem with the device? I have 4 devices and all 4 fail. Did all 4 break down? And what do you tell me about restarting the zigbe2mqtt service to solve the problem temporarily? works well for 1-2 hours?

Koenkk commented 4 years ago

That would indicate that the problem is in the adapter (restarting zigbee2mqtt restarts the adapter). If the adapter is not strong enough to keep up with all the messages problems like this can arise. Upgrading to a more powerful adapter would make sure this is not the problem (https://www.zigbee2mqtt.io/information/supported_adapters.html#texas-instruments-cc26x2r1)

kitopopo commented 4 years ago

Hello dear @Koenkk , I will buy a CC26X2R1. Does it currently work as well as the cc2531 or is it having problems? the xiaomi smart plugs continue working as repeaters with the new coordinator?

Koenkk commented 4 years ago

Yes it will work much better. Keep an eye on the stock of https://www.tindie.com/products/electrolama/zzh-cc2652r-multiprotocol-rf-stick/ it's the best option atm.

kitopopo commented 4 years ago

But cc26x2r1 and cc2652r are differents or are the same? Is the cc2652r another model? What is the difference? cc2652r is like to cc2531

Koenkk commented 4 years ago

Its the same

kitopopo commented 4 years ago

Ok. I will buy you adapter. But now is sold out. Do i need a debugger for windows? The debugger is an purchase option but i don't found the link. Thanks.

Koenkk commented 4 years ago

You don't need the debugger (can be flashed without)

kitopopo commented 4 years ago

Nice device. I will test. Thanks koenkk. Best regards

kitopopo commented 4 years ago

A last question , the zzh cc2652r works correctly with domoticz?

Koenkk commented 4 years ago

If using it via zigbee2mqtt, there is no difference of using CC2531 or CC2652R

kitopopo commented 4 years ago

Hello dear @koenkk, sorry for continuing to insist on the same problem, but I am quite angry, the neighbors have called my attention for trusting zigbe2mqtt. Yesterday at 4 am when trying to turn off (1 click) the light with a short press, a script was fired (quadruple click) that opened all the blinds at home and the news was set at a quite high volume in all speakers of my home.

Does everyone with these switches have this problem? or is it just me? can someone comment something else?

I understand that the easiest solution is to comment that it is necessary to expand my cc2531 to a zzh cc2652 . I have always had 28 zigbee devices and they have all worked properly for a year, my four WXKG01LM has always worked well since zigbee's inception, something has happened, and it may be due to a dev version update (that was when I start having the problem).
It is the only thing that I have changed. Update to the last zigbe2mqtt brand dev. I have changed all the batteries in my 4 sensors but the problem persists over and over again

As I have already mentioned in the lastt updates I only use a 4gb raspberry 4 with domoticz. My system is not saturated I only use it for domoticz, I think it has a lot of power to do this function. It has always been commented in zigbe2mqtt.io and the github forum that the cc2531 supported many devices using repeaters, many more than 28.

with all my respect i think you have not paid much attention to this problem and i do not know the reason why you are not investigating what the problem is. You have not requested to sniff. I do not understand why it is based on the devices problem or cc2531 problem .

The truth is that I notice that the cc2531 is not very powerful , but to use a xiaomi switch it should work without problems as it has worked the last year.

I will not buy the new zzh 2652 because in the future the same will happen again if you do not give me support now for my problem (I do not understand why), If I buy the new zzh it will be because I want to improve my system but not because a switch fails, it is not logical, have always worked well

I will continue investigating what happens. burn the firmware again and I will start from 0 and I will return to old versions of dev brach, if I find out something I will comment it here. If I can not solve my problem, I will return to my old xiaomi gateway that does not give any problem with the xiaomi switch , the truth that I am quite disappointed.

Could you check the latest dev branch to see if there have been any changes?

thanks for your help. Best regards

Koenkk commented 4 years ago

We could indeed do a final check to make sure where the issue comes from.

If you could provide the debug logging at the moment the issue happens I can check this. Also please annotate the amount of clicks you would expect.

To enable debug logging set in configuration.yaml:

advanced:
  log_level: debug
nug321 commented 4 years ago

Hi guys, I just took my button WXKG01LM from xiaomi gate and paired it to the zigbee2mqtt to do some test. Started with fresh battery in the switch and coming in the range of coordinator.

Yep, it acts crazy. All those are supposed to be 'click':


May 20 09:41:55 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:41:55: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
May 20 09:41:55 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:41:55: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
May 20 09:41:55 rpi npm[4494]: zigbee2mqtt:info  2020-05-20 09:41:55: MQTT publish: topic 'zigbee2mqtt/Button', payload '{"battery":100,"voltage":3012,"linkquality":0,"click":"single"}'
May 20 09:41:56 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:41:56: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
May 20 09:41:56 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:41:56: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
May 20 09:41:56 rpi npm[4494]: zigbee2mqtt:info  2020-05-20 09:41:56: MQTT publish: topic 'zigbee2mqtt/Button', payload '{"battery":100,"voltage":3012,"linkquality":0,"click":"single"}'
May 20 09:41:58 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:41:58: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
May 20 09:41:58 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:41:58: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
May 20 09:41:59 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:41:59: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
May 20 09:42:00 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:42:00: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
May 20 09:42:00 rpi npm[4494]: zigbee2mqtt:info  2020-05-20 09:42:00: MQTT publish: topic 'zigbee2mqtt/Button', payload '{"battery":100,"voltage":3012,"linkquality":0,"click":"single"}'
May 20 09:42:01 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:42:01: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
May 20 09:42:01 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:42:01: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
May 20 09:42:03 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:42:03: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
May 20 09:42:03 rpi npm[4494]: zigbee2mqtt:info  2020-05-20 09:42:03: MQTT publish: topic 'zigbee2mqtt/Button', payload '{"battery":100,"voltage":3012,"linkquality":0,"click":"single"}'
May 20 09:42:03 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:42:03: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
May 20 09:42:03 rpi npm[4494]: zigbee2mqtt:info  2020-05-20 09:42:03: MQTT publish: topic 'zigbee2mqtt/Button', payload '{"battery":100,"voltage":3012,"linkquality":0,"click":"long"}'
May 20 09:42:06 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:42:06: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
May 20 09:42:06 rpi npm[4494]: zigbee2mqtt:info  2020-05-20 09:42:06: MQTT publish: topic 'zigbee2mqtt/Button', payload '{"battery":100,"voltage":3012,"linkquality":0,"click":"long_release","duration":3190}'
May 20 09:42:06 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:42:06: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
May 20 09:42:08 rpi npm[4494]: zigbee2mqtt:info  2020-05-20 09:42:08: MQTT publish: topic 'zigbee2mqtt/Button', payload '{"battery":100,"voltage":3012,"linkquality":0,"click":"long"}'
May 20 09:42:08 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:42:08: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
May 20 09:42:08 rpi npm[4494]: zigbee2mqtt:info  2020-05-20 09:42:08: MQTT publish: topic 'zigbee2mqtt/Button', payload '{"battery":100,"voltage":3012,"linkquality":0,"click":"long_release","duration":540}'
May 20 09:42:08 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:42:08: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
May 20 09:42:10 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:42:10: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
May 20 09:42:10 rpi npm[4494]: zigbee2mqtt:info  2020-05-20 09:42:10: MQTT publish: topic 'zigbee2mqtt/Button', payload '{"battery":100,"voltage":3012,"linkquality":0,"click":"single"}'
May 20 09:42:10 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:42:10: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
May 20 09:42:11 rpi npm[4494]: zigbee2mqtt:info  2020-05-20 09:42:11: MQTT publish: topic 'zigbee2mqtt/Button', payload '{"battery":100,"voltage":3012,"linkquality":0,"click":"long"}'
May 20 09:42:11 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:42:11: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
May 20 09:42:11 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:42:11: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
May 20 09:42:11 rpi npm[4494]: zigbee2mqtt:info  2020-05-20 09:42:11: MQTT publish: topic 'zigbee2mqtt/Button', payload '{"battery":100,"voltage":3012,"linkquality":0,"click":"long_release","duration":363}'
May 20 09:42:11 rpi npm[4494]: zigbee2mqtt:info  2020-05-20 09:42:11: MQTT publish: topic 'zigbee2mqtt/Button', payload '{"battery":100,"voltage":3012,"linkquality":0,"click":"single"}'
May 20 09:42:13 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:42:13: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
May 20 09:42:13 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:42:13: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
May 20 09:42:14 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:42:14: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
May 20 09:42:14 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:42:14: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
May 20 09:42:14 rpi npm[4494]: zigbee2mqtt:info  2020-05-20 09:42:14: MQTT publish: topic 'zigbee2mqtt/Button', payload '{"battery":100,"voltage":3012,"linkquality":0,"click":"single"}'
May 20 09:42:15 rpi npm[4494]: zigbee2mqtt:info  2020-05-20 09:42:15: MQTT publish: topic 'zigbee2mqtt/Button', payload '{"battery":100,"voltage":3012,"linkquality":0,"click":"long"}'
May 20 09:42:16 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:42:16: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
May 20 09:42:16 rpi npm[4494]: zigbee2mqtt:info  2020-05-20 09:42:16: MQTT publish: topic 'zigbee2mqtt/Button', payload '{"battery":100,"voltage":3012,"linkquality":0,"click":"long_release","duration":1113}'
May 20 09:42:16 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:42:16: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
May 20 09:42:17 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:42:17: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
May 20 09:42:17 rpi npm[4494]: zigbee2mqtt:info  2020-05-20 09:42:17: MQTT publish: topic 'zigbee2mqtt/Button', payload '{"battery":100,"voltage":3012,"linkquality":0,"click":"single"}'
May 20 09:42:17 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:42:17: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
May 20 09:42:18 rpi npm[4494]: zigbee2mqtt:info  2020-05-20 09:42:18: MQTT publish: topic 'zigbee2mqtt/Button', payload '{"battery":100,"voltage":3012,"linkquality":0,"click":"long"}'
May 20 09:42:19 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:42:19: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
May 20 09:42:19 rpi npm[4494]: zigbee2mqtt:debug 2020-05-20 09:42:19: Received Zigbee message from 'Button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
May 20 09:42:19 rpi npm[4494]: zigbee2mqtt:info  2020-05-20 09:42:19: MQTT publish: topic 'zigbee2mqtt/Button', payload '{"battery":100,"voltage":3012,"linkquality":0,"click":"long_release","duration":1682}'
May 20 09:42:19 rpi npm[4494]: zigbee2mqtt:info  2020-05-20 09:42:19: MQTT publish: topic 'zigbee2mqtt/Button', payload '{"battery":100,"voltage":3012,"linkquality":0,"click":"single"}'
May 20 09:42:22 rpi npm[4494]: zigbee2mqtt:info  2020-05-20 09:42:22: MQTT publish: topic 'zigbee2mqtt/Button', payload '{"battery":100,"voltage":3012,"linkquality":0,"click":"long"}'`
``
zigbee2mqtt version 1.13.0 (commit #55e6283)
All elements: 18 (including coordinator + 3 routers)
ArkadiuszNiemiec commented 4 years ago

Some of my switches starting acting like @nug321 just today. I believe that this started to happen since I have switched the firmware from default to source_routing and added Xiaomi Wall Switch (working as a router). I cannot verify the routing of switches due to lack of routes in the scan but the "good" one reports LQI of 31 and the "bad" one has lqi around 94.

Here are logs when pressing the 'bad' switch:

  1. Single click, looks OK:
    zigbee2mqtt:debug 2020-05-22 00:24:25: Received Zigbee message from 'office_desk_switch', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
    zigbee2mqtt:debug 2020-05-22 00:24:26: Received Zigbee message from 'office_desk_switch', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
    zigbee2mqtt:info  2020-05-22 00:24:26: MQTT publish: topic 'zigbee2mqtt/office_desk_switch/click', payload 'single'
    zigbee2mqtt:info  2020-05-22 00:24:26: MQTT publish: topic 'zigbee2mqtt/office_desk_switch', payload '{"battery":100,"voltage":3022,"linkquality":97,"click":"single"}'
    zigbee2mqtt:info  2020-05-22 00:24:26: MQTT publish: topic 'zigbee2mqtt/office_desk_switch', payload '{"battery":100,"voltage":3022,"linkquality":97,"click":""}'
  2. Single click, fake long presses:
    zigbee2mqtt:debug 2020-05-22 00:25:32: Received Zigbee message from 'office_desk_switch', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
    zigbee2mqtt:debug 2020-05-22 00:25:32: Received Zigbee message from 'office_desk_switch', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
    zigbee2mqtt:debug 2020-05-22 00:25:33: Received Zigbee message from 'office_desk_switch', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
    zigbee2mqtt:debug 2020-05-22 00:25:33: Received Zigbee message from 'office_desk_switch', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
    zigbee2mqtt:info  2020-05-22 00:25:33: MQTT publish: topic 'zigbee2mqtt/office_desk_switch/click', payload 'single'
    zigbee2mqtt:info  2020-05-22 00:25:33: MQTT publish: topic 'zigbee2mqtt/office_desk_switch', payload '{"battery":100,"voltage":3022,"linkquality":97,"click":"single"}'
    zigbee2mqtt:info  2020-05-22 00:25:33: MQTT publish: topic 'zigbee2mqtt/office_desk_switch', payload '{"battery":100,"voltage":3022,"linkquality":97,"click":""}'
    zigbee2mqtt:info  2020-05-22 00:25:34: MQTT publish: topic 'zigbee2mqtt/office_desk_switch/click', payload 'long'
    zigbee2mqtt:info  2020-05-22 00:25:34: MQTT publish: topic 'zigbee2mqtt/office_desk_switch', payload '{"battery":100,"voltage":3022,"linkquality":97,"click":"long"}'
    zigbee2mqtt:info  2020-05-22 00:25:34: MQTT publish: topic 'zigbee2mqtt/office_desk_switch', payload '{"battery":100,"voltage":3022,"linkquality":97,"click":""}'
    zigbee2mqtt:info  2020-05-22 00:25:34: MQTT publish: topic 'zigbee2mqtt/office_desk_switch/click', payload 'long'
    zigbee2mqtt:info  2020-05-22 00:25:34: MQTT publish: topic 'zigbee2mqtt/office_desk_switch', payload '{"battery":100,"voltage":3022,"linkquality":97,"click":"long"}'
    zigbee2mqtt:info  2020-05-22 00:25:34: MQTT publish: topic 'zigbee2mqtt/office_desk_switch', payload '{"battery":100,"voltage":3022,"linkquality":97,"click":""}'
  3. Single click, right after 2nd click:
    zigbee2mqtt:debug 2020-05-22 00:26:14: Received Zigbee message from 'office_desk_switch', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
    zigbee2mqtt:debug 2020-05-22 00:26:15: Received Zigbee message from 'office_desk_switch', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
    zigbee2mqtt:info  2020-05-22 00:26:15: MQTT publish: topic 'zigbee2mqtt/office_desk_switch/click', payload 'long_release'
    zigbee2mqtt:info  2020-05-22 00:26:15: MQTT publish: topic 'zigbee2mqtt/office_desk_switch', payload '{"battery":100,"voltage":3022,"linkquality":99,"click":"long_release","duration":40277}'
    zigbee2mqtt:info  2020-05-22 00:26:15: MQTT publish: topic 'zigbee2mqtt/office_desk_switch', payload '{"battery":100,"voltage":3022,"linkquality":99,"click":""}'
    zigbee2mqtt:info  2020-05-22 00:26:15: MQTT publish: topic 'zigbee2mqtt/office_desk_switch/click', payload 'single'
    zigbee2mqtt:info  2020-05-22 00:26:15: MQTT publish: topic 'zigbee2mqtt/office_desk_switch', payload '{"battery":100,"voltage":3022,"linkquality":99,"click":"single"}'
    zigbee2mqtt:info  2020-05-22 00:26:15: MQTT publish: topic 'zigbee2mqtt/office_desk_switch', payload '{"battery":100,"voltage":3022,"linkquality":99,"click":""}'
kitopopo commented 4 years ago

Hello dear @Koenkk,

Some days ago I updated to the latest version of raspbian buster, I saw that the latest version of npm was also updated, then I also updated to the latest development branch of zigbe2mqtt (I don't know if any new development branch has come out) days but I did update to anyway). As I performed all of these steps, my xiaomi switches are now working properly and error-free. What a mistery Anyway, when the new zzh stick is available, I will buy it as it is much more powerful and everything will work better. I hope everything works more very quickly. Thanks for your help. a cordial greeting

kitopopo commented 4 years ago

If using it via zigbee2mqtt, there is no difference of using CC2531 or CC2652R

dear @Koenkk ,

Some days ago there was stock again zzh cc2652 but now you are going to make the purchase in tindie shop and again it is out of stock. I have several questions,

If i buy the cc2652 Do you support cc2652?

Why don't you add information on how to configure the new cc2652 on the zigbe2mqtt.io website same as with cc2531?

Best regards, thanks in advanced

Koenkk commented 4 years ago

All devices listed here are supported: https://www.zigbee2mqtt.io/information/supported_adapters.html . If the zzh is out-of-stock you can go for the: Texas Instruments LAUNCHXL-CC26X2R1

kitopopo commented 4 years ago

Thanks @Koenkk ,

Which one is the best, the zzh cc2652r or conbe II?

Best regards

ArkadiuszNiemiec commented 4 years ago

@kitopopo Conbee is not yet supported, you cannot run it in a stable setup.

kitopopo commented 4 years ago

Dear friend,

In my domoticz telegram group the people are using deconz (conbe ii) whith deconz plugin fir domoticz, i don't know the differences but they explain that have interface web for manage all option, update devices, zigbee2mtt map, all using a web app. They explain good support por xiaomi switches, is possible use 7 o 8 differents clicks. I don' know, i am studying this option .

ArkadiuszNiemiec commented 4 years ago

I have just received my zzh stick (bought it just to fix this issue but it did not help). Here are full logs of one of the clicks: https://gist.github.com/ArkadiuszNiemiec/0a3a5189e696c7e94d9f8e77536ebbd4

And logs without herdsmans logs:

zigbee2mqtt:debug 2020-06-27 13:03:16: Received Zigbee message from '0x00158d0003e725c3', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
zigbee2mqtt:debug 2020-06-27 13:03:16: Received Zigbee message from '0x00158d0003e725c3', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
zigbee2mqtt:debug 2020-06-27 13:03:16: Received Zigbee message from '0x00158d0003e725c3', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
zigbee2mqtt:debug 2020-06-27 13:03:16: Received Zigbee message from '0x00158d0003e725c3', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
zigbee2mqtt:debug 2020-06-27 13:03:16: Received Zigbee message from '0x00158d0003e725c3', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
zigbee2mqtt:debug 2020-06-27 13:03:17: Received Zigbee message from '0x00158d0003e725c3', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
zigbee2mqtt:debug 2020-06-27 13:03:17: Received Zigbee message from '0x00158d0003e725c3', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
zigbee2mqtt:info  2020-06-27 13:03:17: MQTT publish: topic 'zigbee2mqtt/0x00158d0003e725c3', payload '{"battery":100,"voltage":3062,"linkquality":27,"click":"single"}'
zigbee2mqtt:info  2020-06-27 13:03:17: MQTT publish: topic 'zigbee2mqtt/0x00158d0003e725c3', payload '{"battery":100,"voltage":3062,"linkquality":27,"click":""}'
zigbee2mqtt:info  2020-06-27 13:03:17: MQTT publish: topic 'zigbee2mqtt/0x00158d0003e725c3/click', payload 'single'
zigbee2mqtt:info  2020-06-27 13:03:17: MQTT publish: topic 'zigbee2mqtt/0x00158d0003e725c3', payload '{"battery":100,"voltage":3062,"linkquality":27,"click":"long"}'
zigbee2mqtt:info  2020-06-27 13:03:17: MQTT publish: topic 'zigbee2mqtt/0x00158d0003e725c3', payload '{"battery":100,"voltage":3062,"linkquality":27,"click":""}'
zigbee2mqtt:info  2020-06-27 13:03:17: MQTT publish: topic 'zigbee2mqtt/0x00158d0003e725c3/click', payload 'long'
zigbee2mqtt:info  2020-06-27 13:03:17: MQTT publish: topic 'zigbee2mqtt/0x00158d0003e725c3', payload '{"battery":100,"voltage":3062,"linkquality":24,"click":"long"}'
zigbee2mqtt:info  2020-06-27 13:03:17: MQTT publish: topic 'zigbee2mqtt/0x00158d0003e725c3', payload '{"battery":100,"voltage":3062,"linkquality":24,"click":""}'
zigbee2mqtt:info  2020-06-27 13:03:17: MQTT publish: topic 'zigbee2mqtt/0x00158d0003e725c3/click', payload 'long'
zigbee2mqtt:info  2020-06-27 13:03:17: MQTT publish: topic 'zigbee2mqtt/0x00158d0003e725c3', payload '{"battery":100,"voltage":3062,"linkquality":27,"click":"long"}'
zigbee2mqtt:info  2020-06-27 13:03:17: MQTT publish: topic 'zigbee2mqtt/0x00158d0003e725c3', payload '{"battery":100,"voltage":3062,"linkquality":27,"click":""}'
zigbee2mqtt:info  2020-06-27 13:03:17: MQTT publish: topic 'zigbee2mqtt/0x00158d0003e725c3/click', payload 'long'
zigbee2mqtt:info  2020-06-27 13:03:17: MQTT publish: topic 'zigbee2mqtt/0x00158d0003e725c3', payload '{"battery":100,"voltage":3062,"linkquality":27,"click":"long"}'
zigbee2mqtt:info  2020-06-27 13:03:17: MQTT publish: topic 'zigbee2mqtt/0x00158d0003e725c3', payload '{"battery":100,"voltage":3062,"linkquality":27,"click":""}'
zigbee2mqtt:info  2020-06-27 13:03:17: MQTT publish: topic 'zigbee2mqtt/0x00158d0003e725c3/click', payload 'long'
zigbee2mqtt:info  2020-06-27 13:03:17: MQTT publish: topic 'zigbee2mqtt/0x00158d0003e725c3', payload '{"battery":100,"voltage":3062,"linkquality":27,"click":"long"}'
zigbee2mqtt:info  2020-06-27 13:03:17: MQTT publish: topic 'zigbee2mqtt/0x00158d0003e725c3', payload '{"battery":100,"voltage":3062,"linkquality":27,"click":""}'
zigbee2mqtt:info  2020-06-27 13:03:17: MQTT publish: topic 'zigbee2mqtt/0x00158d0003e725c3/click', payload 'long'

It looks like this only happens for switches that are far from coordinator. It also looks like they don't want to connect via any of the routers (I had to move switches close to coordinator to pair, it did not work close to a router).

ArkadiuszNiemiec commented 4 years ago

I have tried a quick fix and it looks like it's working: https://github.com/Koenkk/zigbee-herdsman-converters/pull/1356

I clear the timer when click down is received, so all but last one are ignored. This is what happened with the fix:

zigbee2mqtt:debug 2020-06-27 13:37:41: Received Zigbee message from '0x00158d0003e725c3', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
zigbee2mqtt:debug 2020-06-27 13:37:41: Received Zigbee message from '0x00158d0003e725c3', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
zigbee2mqtt:debug 2020-06-27 13:37:41: Received Zigbee message from '0x00158d0003e725c3', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
zigbee2mqtt:debug 2020-06-27 13:37:41: Received Zigbee message from '0x00158d0003e725c3', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
zigbee2mqtt:debug 2020-06-27 13:37:41: Received Zigbee message from '0x00158d0003e725c3', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
zigbee2mqtt:info  2020-06-27 13:37:41: MQTT publish: topic 'zigbee2mqtt/0x00158d0003e725c3', payload '{"battery":100,"voltage":3062,"linkquality":84,"click":"single"}'
zigbee2mqtt:info  2020-06-27 13:37:41: MQTT publish: topic 'zigbee2mqtt/0x00158d0003e725c3', payload '{"battery":100,"voltage":3062,"linkquality":84,"click":""}'
zigbee2mqtt:info  2020-06-27 13:37:41: MQTT publish: topic 'zigbee2mqtt/0x00158d0003e725c3/click', payload 'single'

I believe that there is still an issue when the click down comes before click up but I will investigate.

kitopopo commented 4 years ago

I have problems every day with the xiaomi switch , this problem should be fixed. Some months ago the switches have worked correctly.

ArkadiuszNiemiec commented 4 years ago

Now I have a problem with multiple double presses:

zigbee2mqtt:debug 2020-06-27 16:45:33: Received Zigbee message from 'office_desk_switch', type 'attributeReport', cluster 'genOnOff', data '{"32768":2}' from endpoint 1 with groupID 0
zigbee2mqtt:info  2020-06-27 16:45:33: MQTT publish: topic 'zigbee2mqtt/office_desk_switch', payload '{"battery":100,"voltage":3032,"linkquality":15,"click":"double"}'
zigbee2mqtt:info  2020-06-27 16:45:33: MQTT publish: topic 'zigbee2mqtt/office_desk_switch', payload '{"battery":100,"voltage":3032,"linkquality":15,"click":""}'
zigbee2mqtt:info  2020-06-27 16:45:33: MQTT publish: topic 'zigbee2mqtt/office_desk_switch/click', payload 'double'
zigbee2mqtt:debug 2020-06-27 16:45:33: Received Zigbee message from 'office_desk_switch', type 'attributeReport', cluster 'genOnOff', data '{"32768":2}' from endpoint 1 with groupID 0
zigbee2mqtt:info  2020-06-27 16:45:33: MQTT publish: topic 'zigbee2mqtt/office_desk_switch', payload '{"battery":100,"voltage":3032,"linkquality":15,"click":"double"}'
zigbee2mqtt:info  2020-06-27 16:45:33: MQTT publish: topic 'zigbee2mqtt/office_desk_switch', payload '{"battery":100,"voltage":3032,"linkquality":15,"click":""}'
zigbee2mqtt:info  2020-06-27 16:45:33: MQTT publish: topic 'zigbee2mqtt/office_desk_switch/click', payload 'double'
zigbee2mqtt:debug 2020-06-27 16:45:33: Received Zigbee message from 'office_desk_switch', type 'attributeReport', cluster 'genOnOff', data '{"32768":2}' from endpoint 1 with groupID 0
zigbee2mqtt:info  2020-06-27 16:45:33: MQTT publish: topic 'zigbee2mqtt/office_desk_switch', payload '{"battery":100,"voltage":3032,"linkquality":18,"click":"double"}'
zigbee2mqtt:info  2020-06-27 16:45:33: MQTT publish: topic 'zigbee2mqtt/office_desk_switch', payload '{"battery":100,"voltage":3032,"linkquality":18,"click":""}'
zigbee2mqtt:info  2020-06-27 16:45:33: MQTT publish: topic 'zigbee2mqtt/office_desk_switch/click', payload 'double'
zigbee2mqtt:debug 2020-06-27 16:45:33: Received Zigbee message from 'office_desk_switch', type 'attributeReport', cluster 'genOnOff', data '{"32768":2}' from endpoint 1 with groupID 0
zigbee2mqtt:info  2020-06-27 16:45:33: MQTT publish: topic 'zigbee2mqtt/office_desk_switch', payload '{"battery":100,"voltage":3032,"linkquality":15,"click":"double"}'
zigbee2mqtt:info  2020-06-27 16:45:33: MQTT publish: topic 'zigbee2mqtt/office_desk_switch', payload '{"battery":100,"voltage":3032,"linkquality":15,"click":""}'
zigbee2mqtt:info  2020-06-27 16:45:33: MQTT publish: topic 'zigbee2mqtt/office_desk_switch/click', payload 'double'
zigbee2mqtt:debug 2020-06-27 16:45:34: Received Zigbee message from 'office_desk_switch', type 'attributeReport', cluster 'genOnOff', data '{"32768":2}' from endpoint 1 with groupID 0
zigbee2mqtt:info  2020-06-27 16:45:34: MQTT publish: topic 'zigbee2mqtt/office_desk_switch', payload '{"battery":100,"voltage":3032,"linkquality":18,"click":"double"}'
zigbee2mqtt:info  2020-06-27 16:45:34: MQTT publish: topic 'zigbee2mqtt/office_desk_switch', payload '{"battery":100,"voltage":3032,"linkquality":18,"click":""}'
zigbee2mqtt:info  2020-06-27 16:45:34: MQTT publish: topic 'zigbee2mqtt/office_desk_switch/click', payload 'double'
zigbee2mqtt:debug 2020-06-27 16:45:34: Received Zigbee message from 'office_desk_switch', type 'attributeReport', cluster 'genOnOff', data '{"32768":2}' from endpoint 1 with groupID 0
zigbee2mqtt:info  2020-06-27 16:45:34: MQTT publish: topic 'zigbee2mqtt/office_desk_switch', payload '{"battery":100,"voltage":3032,"linkquality":15,"click":"double"}'
zigbee2mqtt:info  2020-06-27 16:45:34: MQTT publish: topic 'zigbee2mqtt/office_desk_switch', payload '{"battery":100,"voltage":3032,"linkquality":15,"click":""}'
zigbee2mqtt:info  2020-06-27 16:45:34: MQTT publish: topic 'zigbee2mqtt/office_desk_switch/click', payload 'double'

@Koenkk can I fix it in zigbee-herdsman-converters using timers and parameter or should it all be fixed on the coordinator side?

kitopopo commented 4 years ago

Maybe @Koenkk can solve the problem. Thanks in advanced. Best regards

Koenkk commented 4 years ago

@ArkadiuszNiemiec if I understand correctly, a single double click on the device results in multiple Received Zigbee message from 'office_desk_switch' messages? If so, could you sniff the traffic here? (maybe it reveals something about the root cause of this). https://www.zigbee2mqtt.io/how_tos/how_to_sniff_zigbee_traffic.html

ArkadiuszNiemiec commented 4 years ago

@Koenkk yes, and the single click down results with multiple {"onOff":0} and one {"onOff":1}. I have only observed it when the switch is far from the coordinator. I will sniff it and update here.

ArkadiuszNiemiec commented 4 years ago

@Koenkk I have registered a bad click with filter set to its address (zbee_nwk.addr==0x36FD):

Capture

Here is the file: https://send.firefox.com/download/1f69f9cd4a80ce47/#YX886jR3cZ1thSp2VZtsHQ Here is the file of two signle clicks that worked correctly: https://send.firefox.com/download/a2525b89ba4f7f18/#lf-4_7iBNZCFGSUcHuOInA

In short, it shows same thing as the debug logs of Z2M. Can you see more in these packets? By the way: I just cover the switch with my body to get these multiplied packets.

Koenkk commented 4 years ago

Can you provide me your network key? (otherwise I cannot decrypt the sniff).

But first try if this fixes the issue. In fromZigbee.js change the WXKG01LM_click converter to:

WXKG01LM_click: {
    cluster: 'genOnOff',
    type: ['attributeReport', 'readResponse'],
    convert: (model, msg, publish, options, meta) => {
        const deviceID = msg.device.ieeeAddr;
        const state = msg.data['onOff'];

        if (!store[deviceID]) {
            store[deviceID] = {};
        }

        const current = msg.meta.zclTransactionSequenceNumber;
        if (store[msg.device.ieeeAddr].transaction === current) return;
        store[msg.device.ieeeAddr].transaction = current;

        // 0 = click down, 1 = click up, else = multiple clicks
        if (state === 0) {
            store[deviceID].timer = setTimeout(() => {
                publish({click: 'long'});
                store[deviceID].timer = null;
                store[deviceID].long = Date.now();
            }, options.long_timeout || 1000); // After 1000 milliseconds of not releasing we assume long click.
        } else if (state === 1) {
            if (store[deviceID].long) {
                const duration = Date.now() - store[deviceID].long;
                publish({click: 'long_release', duration: duration});
                store[deviceID].long = false;
            }

            if (store[deviceID].timer) {
                clearTimeout(store[deviceID].timer);
                store[deviceID].timer = null;
                publish({click: 'single'});
            }
        } else {
            const clicks = msg.data['32768'];
            const payload = clickLookup[clicks] ? clickLookup[clicks] : 'many';
            publish({click: payload});
        }
    },
},

Does that fix the issue?

ArkadiuszNiemiec commented 4 years ago

@Koenkk It's the smart way to fix it 😄 and it works:

Received Zigbee message from '0x00158d0003e725c3', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
Received Zigbee message from '0x00158d0003e725c3', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
message ignored!
Received Zigbee message from '0x00158d0003e725c3', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
message ignored!
Received Zigbee message from '0x00158d0003e725c3', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
message ignored!
Received Zigbee message from '0x00158d0003e725c3', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
message ignored!
Received Zigbee message from '0x00158d0003e725c3', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
message ignored!
Received Zigbee message from '0x00158d0003e725c3', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
zigbee2mqtt:info  2020-06-29 MQTT publish: topic 'zigbee2mqtt/0x00158d0003e725c3', payload '{"battery":100,"voltage":3042,"linkquality":15,"click":"single"}'
zigbee2mqtt:info  2020-06-29 MQTT publish: topic 'zigbee2mqtt/0x00158d0003e725c3', payload '{"battery":100,"voltage":3042,"linkquality":15,"click":""}'
zigbee2mqtt:info  2020-06-29 MQTT publish: topic 'zigbee2mqtt/0x00158d0003e725c3/click', payload 'single'
Received Zigbee message from '0x00158d0003e725c3', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
message ignored!
Received Zigbee message from '0x00158d0003e725c3', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
message ignored!
Received Zigbee message from '0x00158d0003e725c3', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
message ignored!
Received Zigbee message from '0x00158d0003e725c3', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
message ignored!
Received Zigbee message from '0x00158d0003e725c3', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
message ignored!

I will remove the log message from the code and you can merge it if you want. Thanks for the help. https://github.com/Koenkk/zigbee-herdsman-converters/pull/1356

Koenkk commented 4 years ago

@ArkadiuszNiemiec great!

Changes will be available in the latest dev branch in a few hours (https://www.zigbee2mqtt.io/how_tos/how-to-switch-to-dev-branch.html)

kitopopo commented 4 years ago

Can you provide me your network key? (otherwise I cannot decrypt the sniff).

But first try if this fixes the issue. In fromZigbee.js change the WXKG01LM_click converter to:

WXKG01LM_click: {
    cluster: 'genOnOff',
    type: ['attributeReport', 'readResponse'],
    convert: (model, msg, publish, options, meta) => {
        const deviceID = msg.device.ieeeAddr;
        const state = msg.data['onOff'];

        if (!store[deviceID]) {
            store[deviceID] = {};
        }

        const current = msg.meta.zclTransactionSequenceNumber;
        if (store[msg.device.ieeeAddr].transaction === current) return;
        store[msg.device.ieeeAddr].transaction = current;

        // 0 = click down, 1 = click up, else = multiple clicks
        if (state === 0) {
            store[deviceID].timer = setTimeout(() => {
                publish({click: 'long'});
                store[deviceID].timer = null;
                store[deviceID].long = Date.now();
            }, options.long_timeout || 1000); // After 1000 milliseconds of not releasing we assume long click.
        } else if (state === 1) {
            if (store[deviceID].long) {
                const duration = Date.now() - store[deviceID].long;
                publish({click: 'long_release', duration: duration});
                store[deviceID].long = false;
            }

            if (store[deviceID].timer) {
                clearTimeout(store[deviceID].timer);
                store[deviceID].timer = null;
                publish({click: 'single'});
            }
        } else {
            const clicks = msg.data['32768'];
            const payload = clickLookup[clicks] ? clickLookup[clicks] : 'many';
            publish({click: payload});
        }
    },
},

Does that fix the issue?

Dear @Koenkk ,

This fix works also for the cc2531? I wait news from you. Thanks

Koenkk commented 4 years ago

@kitopopo yes, fix is available in the dev branch now.

kitopopo commented 4 years ago

Ok @Koenkk . I will update at the new dev branch this night. As I told you more than 1 month ago there was a problem between the buttons and zigbee2mqtt. thank you very much for solving it.

Best regards.

kitopopo commented 4 years ago

Dear @Koenkk , I am sorry to tell you this but the problem persists, zigbee2mqtt continues to detect double clicks if I make single clicks, I am already tired of the blinds being pulled up late at night, I think that if you do not solve the problem my next device will not be zzh cc2652r. I'm going to try ConBee II, I find it horrible that a button fails for so long with a raspberry pi 4 and an ssd. Thank you for your collaboration during all this time. You have been very kind

ArkadiuszNiemiec commented 4 years ago

If you get double click instead of single click then it's a problem with button itself. Xiaomi switches reports presses down, up, double, triple, quadruple and many click, if it reports a wrong number of click than its not a CC2531 or z2m problem. The issue that was solved here was that the button was reporting multiple clicks instead of just one.

Edit: this should not happen now: https://github.com/Koenkk/zigbee2mqtt/issues/3445#issuecomment-631332743

I have 6 switches around the house and none is reporting wrong number of clicks (not counting when my finger slips). And I have used them with ConBee, cc2531 and zzh, no difference. Also note that this issue exists not becouse of z2m bug, but because Xiaomi is not following ZigBee standards. Maybe your switches are all from faulty batch?