Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xiaomi switch WXKG01LM pulsation detection failure #3445

Closed
kitopopo opened this issue Apr 28, 2020 · 73 comments
Closed

Xiaomi switch WXKG01LM pulsation detection failure #3445

kitopopo opened this issue Apr 28, 2020 · 73 comments

Comments

@kitopopo
Copy link

kitopopo commented Apr 28, 2020

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
Copy link
Owner

Koenkk commented Apr 29, 2020

@kitopopo
Copy link
Author

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
Copy link
Author

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
Copy link
Author

kitopopo commented May 1, 2020

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
Copy link
Owner

Koenkk commented May 2, 2020

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
Copy link
Author

kitopopo commented May 2, 2020

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
Copy link
Owner

Koenkk commented May 2, 2020

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

@kitopopo
Copy link
Author

kitopopo commented May 2, 2020

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
Copy link
Author

kitopopo commented May 4, 2020

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 kitopopo closed this as completed May 4, 2020
@kitopopo
Copy link
Author

kitopopo commented May 7, 2020

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

@kitopopo kitopopo reopened this May 7, 2020
@Koenkk
Copy link
Owner

Koenkk commented May 8, 2020

I think this is a network issue.

@kitopopo
Copy link
Author

kitopopo commented May 9, 2020

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
Copy link
Owner

Koenkk commented May 9, 2020

  • In case single/double/tripple/many click is detected wrong -> Issue of device itself (as this passes the amount of clicks, can for sure not be fixed from zigbee2mqtt side.
  • In case long/long_release is detected incorrectly -> it takes longer than the long_timeout before the messages arrive at zigbee2mqtt. Can be solved be either increasing the long_timeout or improving the network (so that messages arrive faster).

@kitopopo
Copy link
Author

kitopopo commented May 9, 2020

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
Copy link
Owner

Koenkk commented May 11, 2020

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
Copy link
Author

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
Copy link
Owner

Koenkk commented May 13, 2020

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
Copy link
Author

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
Copy link
Owner

Koenkk commented May 13, 2020

Its the same

@kitopopo
Copy link
Author

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
Copy link
Owner

Koenkk commented May 14, 2020

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

@kitopopo
Copy link
Author

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

@kitopopo
Copy link
Author

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

@Koenkk
Copy link
Owner

Koenkk commented May 14, 2020

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

@kitopopo
Copy link
Author

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
Copy link
Owner

Koenkk commented May 15, 2020

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
Copy link

nug321 commented May 20, 2020

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
Copy link

ArkadiuszNiemiec commented May 21, 2020

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":""}'
  1. 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":""}'
  1. 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":""}'

@Koenkk
Copy link
Owner

Koenkk commented Jun 29, 2020

@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)

@Koenkk Koenkk closed this as completed Jun 29, 2020
@kitopopo
Copy link
Author

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
Copy link
Owner

Koenkk commented Jun 29, 2020

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

@kitopopo
Copy link
Author

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
Copy link
Author

kitopopo commented Jun 29, 2020

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
Copy link

ArkadiuszNiemiec commented Jun 29, 2020

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: #3445 (comment)

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?

@kitopopo
Copy link
Author

Hello, thanks for your answer, I have 4 xiaomi switch buttons and all 4 fail with the same problem, it cannot be a button problem. There has come a time when not a single pulse worked. I have been more than 1 year with zigbe2mqtt and these buttons and they have never failed until I opened this issue approximately. I will not insist any more, thank you. Some time ago, restarting the zigbe2mqtt service solved the problem for a few hours, now it has gotten worse. Best regards.

@ArkadiuszNiemiec
Copy link

@kitopopo these switches are terrible, I had a problem with one today, it was not responding for a minute and then it sent multiple long, triple and single messages (I was just single clicking it). I will never buy xiaomi switches again, next buy is Konke switch: https://www.zigbee2mqtt.io/devices/2AJZ4KPKEY.html
They are sold on Aliexpress.

@kitopopo
Copy link
Author

kitopopo commented Jul 3, 2020

@kitopopo these switches are terrible, I had a problem with one today, it was not responding for a minute and then it sent multiple long, triple and single messages (I was just single clicking it). I will never buy xiaomi switches again, next buy is Konke switch: https://www.zigbee2mqtt.io/devices/2AJZ4KPKEY.html
They are sold on Aliexpress.

Dear friend,

Thanks for the suggestion. But during 1 year aproximately my xiaomi switches have worked correctly. Maybe an wrong update of dev branch , i don't know the reasson exactly but they worked correctly during a year. If my switches don't have worked correctly during so long i would understand a hardware switch problem

Best Regards

@ArkadiuszNiemiec
Copy link

ArkadiuszNiemiec commented Jul 13, 2020

These damned switches... I had the problem that switch reported the click up before click down. Again. I was able to log it:

zigbee2mqtt:debug 2020-07-14 01:14:34: Received Zigbee message from 'kitchen_switch', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
zigbee2mqtt:debug 2020-07-14 01:14:34: Received Zigbee message from 'kitchen_switch', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
zigbee2mqtt:info  2020-07-14 01:14:35: MQTT publish: topic 'zigbee2mqtt/kitchen_switch', payload '{"battery":100,"voltage":3042,"linkquality":111,"click":"long"}'
zigbee2mqtt:info  2020-07-14 01:14:35: MQTT publish: topic 'zigbee2mqtt/kitchen_switch', payload '{"battery":100,"voltage":3042,"linkquality":111,"click":""}'
zigbee2mqtt:info  2020-07-14 01:14:35: MQTT publish: topic 'zigbee2mqtt/kitchen_switch/click', payload 'long'
zigbee2mqtt:debug 2020-07-14 01:14:37: Received Zigbee message from 'kitchen_switch', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
zigbee2mqtt:debug 2020-07-14 01:14:37: Received Zigbee message from 'kitchen_switch', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
zigbee2mqtt:info  2020-07-14 01:14:37: MQTT publish: topic 'zigbee2mqtt/kitchen_switch', payload '{"battery":100,"voltage":3042,"linkquality":105,"click":"long_release","duration":2228}'
zigbee2mqtt:info  2020-07-14 01:14:37: MQTT publish: topic 'zigbee2mqtt/kitchen_switch', payload '{"battery":100,"voltage":3042,"linkquality":105,"click":"single"}'
zigbee2mqtt:info  2020-07-14 01:14:37: MQTT publish: topic 'zigbee2mqtt/kitchen_switch', payload '{"battery":100,"voltage":3042,"linkquality":105,"click":""}'
zigbee2mqtt:info  2020-07-14 01:14:37: MQTT publish: topic 'zigbee2mqtt/kitchen_switch', payload '{"battery":100,"voltage":3042,"linkquality":105,"click":""}'
zigbee2mqtt:info  2020-07-14 01:14:37: MQTT publish: topic 'zigbee2mqtt/kitchen_switch/click', payload 'single'
zigbee2mqtt:info  2020-07-14 01:14:37: MQTT publish: topic 'zigbee2mqtt/kitchen_switch/click', payload 'long_release'

It would only break one click but the logic is that store[deviceID].long is not set to false if not click up event is received.

@Koenkk I believe that to solve this issue we have to ignore the click up event for long presses and relay only on timeouts or use another timeout if no click up event is received after long press detection. Or ignore it but this has happened several times for me. What do you think?

@Koenkk
Copy link
Owner

Koenkk commented Jul 14, 2020

I believe that to solve this issue we have to ignore the click up event for long presses and relay only on timeouts or use another timeout if no click up event is received after long press detection.

A timeout should be fine I think, so if no click up is received (e.g.) 5 seconds after the click down is received publish it. Can you make a PR?

@ArkadiuszNiemiec
Copy link

@Koenkk This should be it: Koenkk/zigbee-herdsman-converters#1418

@kitopopo
Copy link
Author

Good evening mr @Koenkk , @ArkadiuszNiemiec ,

First of all I would like to apologize for believing that the xiaomi switch WXKG01LM pulsation failure was due to a dev branch update.
The problem was in a domoticz script that manages the xiaomi switch orders, after performing these tasks I would set the value of the switch to 'off' and this caused the switch to not work well in the following orders, resetting it back to status 'off' after each order. You have to let the switch stay on the last press received so that it works well on the next pulsation.
In all the scripts of my 4 xiaomi switches I had since they returned to the initial value 'off', for this reason I thought that a physical problem of all my switches was impossible

I also take this opportunity to comment that my next device when the store has stock in stock will be the zzh 2652r and not the conve ii. I choose the zzh device mainly because of the great support it is giving and that Mr. @Koenkk has given all this time. Surely the zzh will be a great device. Thank you very much for your support. I am very grateful

Receive a warm greeting

@kitopopo
Copy link
Author

Dear @Koenkk ,

After two weeks working correctly today my switchs fails again, i can see in the zigbee2mqtt log that every pulsation is detected two times in the log, i attach the log file:

ago 17 15:33:32 raspberrypi npm[5913]: Zigbee2MQTT:info  2020-08-17 15:33:32: MQTT publish: topic 'zigbee2mqtt/Switch salon', payload '{"action":"single","battery":100,"linkquality":107,"voltage":3132}'
ago 17 15:33:32 raspberrypi npm[5913]: Zigbee2MQTT:info  2020-08-17 15:33:32: MQTT publish: topic 'zigbee2mqtt/Switch salon', payload '{"battery":100,"click":"single","linkquality":107,"voltage":3132}'

ago 17 15:36:56 raspberrypi npm[5913]: Zigbee2MQTT:info  2020-08-17 15:36:56: MQTT publish: topic 'zigbee2mqtt/Switch salon', payload '{"action":"single","battery":100,"linkquality":107,"voltage":3132}'
ago 17 15:36:56 raspberrypi npm[5913]: Zigbee2MQTT:info  2020-08-17 15:36:56: MQTT publish: topic 'zigbee2mqtt/Switch salon', payload '{"battery":100,"click":"single","linkquality":107,"voltage":3132}'

I test with the xiaomi door sensor but this sensor is detected only one time, the problem appear only in all xiaomi switchs WXKG01LM

how i can solve the problem?

@ArkadiuszNiemiec
Copy link

ArkadiuszNiemiec commented Aug 17, 2020

Here are my logs on newest stable version:

Zigbee2MQTT:debug 2020-08-17 16:01:48: Received Zigbee message from 'office_desk_switch', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
Zigbee2MQTT:debug 2020-08-17 16:01:49: Received Zigbee message from 'office_desk_switch', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
Zigbee2MQTT:info  2020-08-17 16:01:49: MQTT publish: topic 'zigbee2mqtt/office_desk_switch', payload '{"battery":100,"linkquality":105,"voltage":3032,"action":"single"}'
Zigbee2MQTT:info  2020-08-17 16:01:49: MQTT publish: topic 'zigbee2mqtt/office_desk_switch', payload '{"battery":100,"linkquality":105,"voltage":3032,"click":"single"}'
Zigbee2MQTT:info  2020-08-17 16:01:49: MQTT publish: topic 'zigbee2mqtt/office_desk_switch', payload '{"battery":100,"linkquality":105,"voltage":3032,"action":""}'
Zigbee2MQTT:info  2020-08-17 16:01:49: MQTT publish: topic 'zigbee2mqtt/office_desk_switch/action', payload 'single'
Zigbee2MQTT:info  2020-08-17 16:01:49: MQTT publish: topic 'zigbee2mqtt/office_desk_switch', payload '{"battery":100,"linkquality":105,"voltage":3032,"click":""}'
Zigbee2MQTT:info  2020-08-17 16:01:49: MQTT publish: topic 'zigbee2mqtt/office_desk_switch/click', payload 'single'

The switch reports click once but it's published twice on MQTT: once as action and once as click. On my setup it does not break anything as I only parse clicks. It's also not a problem on Home Assistant. It's probably not a source of your switch failing.

BTW. I am currently testing one Konke button from www.aliexpress.com/item/Konke-ZigBee-3-0-Open-Protocol-Remote-Button-Smart-Home-Wireless-Switch-Intelligent-Application/33015636907.html?spm=a2g0s.9042311.0.0.30605c0fIEqe9B
So far it works great, not fails, hangs etc. If it continues to work I will replace all Xiaomi buttons to the Konke ones.

@kitopopo
Copy link
Author

My switchs are working correctly during 2 or 3 weeks, no fails, no problem, no errors. Always zigbee2mqtt has detected one click, now two mqtt messages are sended. Maybe they are a problem in the last deb branch. I don't know. I will test with an old deb branch.

I have made too proofs with this switches an always zigbe2mqtt has detected one click.
Dear @Koenkk , what do you think about the two messages published? Thanks in advanced

@ArkadiuszNiemiec
Copy link

@kitopopo I am trying to help here. It IS intended: #3998
Documentation: https://github.com/Koenkk/zigbee2mqtt.io/blob/develop/docs/devices/WXKG01LM.md#device-type-specific-configuration
Set legacy: false in your device config to disable click event, e.g.:

devices:
  '0x12345678':
    friendly_name: my_device
    legacy: false

It's in the configuration.yaml file. And again, it's not the source of your switches failing.

@kitopopo
Copy link
Author

@ArkadiuszNiemiec thanks for you help,

I try to add legacy: false in the configuration.yaml. This solve the problem, only one mqtt message is sended but the xiaomi switch doesn't works in domoticz. Domoticz log detects de single pulsation but any action happens. My script is not triggered. Domoticz doesn't detects correctly the action or device detection.
Erasing the line from configuration.yaml all works correctly again

Thanks

@kitopopo
Copy link
Author

Dear @Koenkk ,

I test with the 1.14.0 dev branch version and only a mqtt message is sended. In the 1.14.3 dev branch version two mqtt messages are sended.

Thanks in advanced

@Koenkk
Copy link
Owner

Koenkk commented Aug 17, 2020

As @ArkadiuszNiemiec mentioned this is indeed expected behaviour. action has been added now and click has been made deprecated. Setting legacy: false will remove click and only leave action.

You probably have to adjust your script to respond to action instead of click (since click is not send anymore with legacy: false)

@kitopopo
Copy link
Author

Dear @Koenkk , Thanks for you reply.

It is difficult to explain in english,

When I put "legacy: on" , domoticz stops refreshing the device.
Apart of this, in domoticz the switch responds to ".state" parameter in the script.

Maybe i need report to @stas-demydiuk for modify zigbee2mqtt plugin? the plugin works now with the state "click" , "double click" and adding "legacy:false" the state is "single" , "double" .... Maybe this new state must be added to the plugin due to we have two states with legacy true and legacy false.

Will the old state disappear in the future without add legacy:false?

thanks in advanced

@Koenkk
Copy link
Owner

Koenkk commented Aug 18, 2020

Will be removed in Zigbee2mqtt 2.0.0 (not soon)

@kitopopo
Copy link
Author

kitopopo commented Sep 6, 2020

Dear @Koenkk ,

Mr @stas-demydiuk has already updated the zigbee2mqtt plugin to be able to use "legacy: on" on the xiaomi switches.

After update the plugin, now it is necessary to always use "legacy:on" in all switches. If I don't add "legacy:on" , now domoticz receives the two mqtt messages and double command is executed, but with legacy: on enabled everything seems to be fine due to only one mqtt message is received.

Whenever you want and if you see fit, you can delete the old mqqtt message in future updates for the switch to work fine with domoticz without using legacy: on

Receive a warm greeting

@Koenkk
Copy link
Owner

Koenkk commented Sep 7, 2020

@kitopopo yes, this will be done in zigbee2mqtt 2.0.0

@kitopopo
Copy link
Author

Dear @Koenkk ,

I ask @stas-demydiuk to modify the "Long Click" and "Long Click Release" values ​​in the zigbee2mqtt plugin for domoticz so that they work with the f legacy:false enabled in configuration.yaml.

Sometimes domoticz gets an error called "undefined", and it doesn't detect the long click release correctly and the switch stays in that state. Attached two pictures. In the second picture the switch works correctly.

switch

switch ok

When domoticz detects correctly long click realease , two "onCommand" and "Command" call occurs in the domoticz log. Thus Handling events is executed with the value long click realease

2020-10-16 13:17:00.885 (zigbe2mqtt) MQTT message: zigbee2mqtt/Switch mesita {'action': 'hold', 'battery': 100, 'linkquality': 78, 'voltage': 3112}
2020-10-16 13:17:00.955 (zigbe2mqtt) onCommand: Set Level, level (70) Color:
2020-10-16 13:17:00.958 (zigbe2mqtt) Command "Set Level (70)" from device "Switch mesita"
2020-10-16 13:17:00.918 Status: User: Admin initiated a switch command (220/Switch mesita/Set Level)
2020-10-16 13:17:01.034 Status: dzVents: Info: Handling events for: "Switch mesita", value: ""
2020-10-16 13:17:01.035 Status: dzVents: Info: ------ Start internal script: salon switch new para usar con switch mesita: Device: "Switch mesita (zigbe2mqtt)", Index: 220
2020-10-16 13:17:01.036 Status: dzVents: Info: Temperatura Exterior: 17.39999961853
2020-10-16 13:17:01.036 Status: dzVents: Info: Humedad Exterior: 45
2020-10-16 13:17:01.036 Status: dzVents: Info: Temperatura Salon: 23
2020-10-16 13:17:01.037 Status: dzVents: Info: Temperatura Habitacion: 23.5
2020-10-16 13:17:01.037 Status: dzVents: Info: Pesion Exterior: 1022.700012207
2020-10-16 13:17:01.038 Status: dzVents: Info: ------ Finished salon switch new para usar con switch mesita
2020-10-16 13:17:01.147 Status: dzVents: Info: Handling events for: "Switch mesita", value: "Long Click Release"
2020-10-16 13:17:01.147 Status: dzVents: Info: ------ Start internal script: salon switch new para usar con switch mesita: Device: "Switch mesita (zigbe2mqtt)", Index: 220
2020-10-16 13:17:01.148 Status: dzVents: Info: Temperatura Exterior: 17.39999961853
2020-10-16 13:17:01.148 Status: dzVents: Info: Humedad Exterior: 45
2020-10-16 13:17:01.149 Status: dzVents: Info: Temperatura Salon: 23
2020-10-16 13:17:01.151 Status: dzVents: Info: Temperatura Habitacion: 23.5
2020-10-16 13:17:01.151 Status: dzVents: Info: Pesion Exterior: 1022.700012207
2020-10-16 13:17:01.246 Status: dzVents: Info: ------ Finished salon switch new para usar con switch mesita

zigbee2mqtt log when woorks correctly:

raspberrypi npm[476]: Zigbee2MQTT:info  2020-10-16 13:11:29: MQTT publish: topic 'zigbee2mqtt/Switch mesita', payload '{"action":"hold","battery":100,"linkquality":94,"voltage":3112}'
raspberrypi npm[476]: Zigbee2MQTT:info  2020-10-16 13:11:30: MQTT publish: topic 'zigbee2mqtt/Switch mesita', payload '{"action":"release","battery":100,"duration":1278,"linkquality":94,"voltage":3112}'


When domoticz doesn't detect correctly the long click realease and after appears "undefined error"
"onCommand" call and "Command" does not occur in the domoticz log. Thus Handling events is executed with an unknown value and here the error "undefined" occurs:

2020-10-16 12:45:32.808 (zigbe2mqtt) MQTT message: zigbee2mqtt/Switch mesita {'action': 'hold', 'battery': 100, 'linkquality': 94, 'voltage': 3112}
2020-10-16 12:45:32.976 Status: dzVents: Info: Handling events for: "Switch mesita", value: ""
2020-10-16 12:45:32.976 Status: dzVents: Info: ------ Start internal script: salon switch new para usar con switch mesita: Device: "Switch mesita (zigbe2mqtt)", Index: 220
2020-10-16 12:45:32.977 Status: dzVents: Info: Temperatura Exterior: 17.10000038147
2020-10-16 12:45:32.977 Status: dzVents: Info: Humedad Exterior: 47
2020-10-16 12:45:32.978 Status: dzVents: Info: Temperatura Salon: 23
2020-10-16 12:45:32.978 Status: dzVents: Info: Temperatura Habitacion: 23.39999961853
2020-10-16 12:45:32.978 Status: dzVents: Info: Pesion Exterior: 1022.9000244141
2020-10-16 12:45:32.979 Status: dzVents: Info: ------ Finished salon switch new para usar con switch mesita
2020-10-16 12:45:35.370 (zigbe2mqtt) MQTT message: zigbee2mqtt/Switch mesita {'action': 'release', 'battery': 100, 'duration': 2553, 'linkquality': 94, 'voltage': 3112}
2020-10-16 12:45:35.525 Status: dzVents: Info: Handling events for: "Switch mesita", value: ""
2020-10-16 12:45:35.525 Status: dzVents: Info: ------ Start internal script: salon switch new para usar con switch mesita: Device: "Switch mesita (zigbe2mqtt)", Index: 220
2020-10-16 12:45:35.526 Status: dzVents: Info: Temperatura Exterior: 17.10000038147
2020-10-16 12:45:35.526 Status: dzVents: Info: Humedad Exterior: 47
2020-10-16 12:45:35.526 Status: dzVents: Info: Temperatura Salon: 23
2020-10-16 12:45:35.527 Status: dzVents: Info: Temperatura Habitacion: 23.39999961853
2020-10-16 12:45:35.527 Status: dzVents: Info: Pesion Exterior: 1022.9000244141
2020-10-16 12:45:35.528 Status: dzVents: Info: ------ Finished salon switch new para usar con switch mesita

Same zigbee2mqtt log whe error undefined occurs:

raspberrypi npm[476]: Zigbee2MQTT:info  2020-10-16 13:11:29: MQTT publish: topic 'zigbee2mqtt/Switch mesita', payload '{"action":"hold","battery":100,"linkquality":94,"voltage":3112}'
raspberrypi npm[476]: Zigbee2MQTT:info  2020-10-16 13:11:30: MQTT publish: topic 'zigbee2mqtt/Switch mesita', payload '{"action":"release","battery":100,"duration":1278,"linkquality":94,"voltage":3112}'

why don't the "onCommand" and "command" calls occur? Can you reopen the issue please?

I wait news from you

Thanks in advance

Best regards

@Koenkk
Copy link
Owner

Koenkk commented Oct 22, 2020

Looking at your logs Zigbee2mqtt is not the issue here so it cannot be fixed by Zigbee2mqtt, it should be fixed in the plugin.

@kitopopo
Copy link
Author

Ok @Koenkk , I will report to @stas-demydiuk. Thanks for your help. Best regards

@AndreKR
Copy link

AndreKR commented Dec 7, 2022

Hm, this issue should be fixed? I just switched from ZHA to Z2M and I'm experiencing the same (I think) issue with my WXKG01LM buttons:

debug 2022-12-07 07:40:17: Received Zigbee message from 'mi-button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
debug 2022-12-07 07:40:18: Received Zigbee message from 'mi-button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
info  2022-12-07 07:40:19: MQTT publish: topic 'zigbee2mqtt/mi-button', payload '{"action":"hold","battery":100,"linkquality":40,"power_outage_count":516,"voltage":3012}'
info  2022-12-07 07:40:19: MQTT publish: topic 'zigbee2mqtt/mi-button/action', payload 'hold'
debug 2022-12-07 07:40:25: Received Zigbee message from 'mi-button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
debug 2022-12-07 07:40:26: Received Zigbee message from 'mi-button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
info  2022-12-07 07:40:27: MQTT publish: topic 'zigbee2mqtt/mi-button', payload '{"action":"hold","battery":100,"linkquality":40,"power_outage_count":516,"voltage":3012}'
info  2022-12-07 07:40:27: MQTT publish: topic 'zigbee2mqtt/mi-button/action', payload 'hold'

I has no problems with these buttons in ZHA. I'm pretty sure1 this is the code that handles the buttons in ZHA, and interestingly they seem to just read an attribute 32768?

General question: If the device would send such an attribute, would I definitely see it in the log if I set it to log level debug or only if Z2M expects this attribute for this device?

Footnotes

  1. The reason why I think it's this file is because when I hammer the button I get an event with click type furious and this is the only occurrence of the word "furious" in all the repositories I checked.

@AndreKR
Copy link

AndreKR commented Dec 11, 2022

I reinstalled Z2M and re-paired the button a couple of times for unrelated reasons and now I cannot reproduce my issue from above anymore.

Single pushes are now correctly detected:

debug 2022-12-11 23:38:10: Received Zigbee message from 'mi-button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
debug 2022-12-11 23:38:10: Received Zigbee message from 'mi-button', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
info  2022-12-11 23:38:10: MQTT publish: topic 'zigbee2mqtt/mi-button', payload '{"action":"single","battery":null,"linkquality":36,"power_outage_count":null,"voltage":null}'

Multiple pushes are also correctly detected using attribute 0x8000 (32768):

debug 2022-12-11 23:40:48: Received Zigbee message from 'mi-button', type 'attributeReport', cluster 'genOnOff', data '{"32768":2}' from endpoint 1 with groupID 0
info  2022-12-11 23:40:48: MQTT publish: topic 'zigbee2mqtt/mi-button', payload '{"action":"double","battery":null,"linkquality":54,"power_outage_count":null,"voltage":null}'

Just as they are sent:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants