Aqara Wireless Switch (Zigbee2MQTT) - single, double and hold action

This blueprint is a copy customized for the Aqara switch with single, double and hold actions (model: WXKG11LM).
The original blueprint for the WXKG12LM is made by Malte.

This switch comes in different versions. Make sure that you have the version supporting single, double and hold actions.

The supported actions are:

  • Single
  • Double
  • Hold

Please note: If your button is the other model (WXKG12LM), then this blueprint won’t work and you should download and use this blueprint.

4 Likes

Hi, does this blueprint depend on a deprecated Click event ( Xiaomi WXKG11LM control via MQTT | zigbee2mqtt.io)?

no it uses action instead of click.

btw.
I have extended it as my WXKG11LM also supports the “release” action in addition to the “hold” action. Give it a try, yours might also support it.

Hi, when debugging the automation using this blueprint (many thanks for developing) I recieve an error when debugging the script.

Error: UndefinedError: ‘dict object’ has no attribute ‘to_state’

I must be doing something wrong but what… any ideas?

tnx for your reply

Did you ever figure this out? I too am getting Error: UndefinedError: ‘dict object’ has no attribute ‘to_state’

HI Steve,
Just did not use the blueprint. No solution here. Sorry. I’m switching from Z2M to ZHA so I won’t use this blueprint anymore.

I was having the same dict object error. I fixed it by changing the variable.

Added the change on a Gist at Aqara Wireless Switch (single, double, hold) · GitHub

I have published an update to this blueprint today that should fix the errors you have experienced. Try updating (if you cannot update, then remove and reinstall).

Give it a try and give me an update if you have more problems.

Hi there, I can’t get this to work. The button actions are happening when I view the logbook, but the actions in the blueprint don’t occur. I’m not sure what to try, I have the WXKG11LM button.

1 Like

I had the same problem, modified the blueprint and it seems to work now: Aqara Wireless Switch (single, double, hold, release) · GitHub.
^ It’s a new version that uses trigger.to_state.state if available (in addition to trigger.to_state.attributes.action).

Thanks, but I just imported the blueprint again, but the automation still won’t trigger. Oh well the Aqara Buttons All-In-One [Zigbee2MQTT] blueprint is working for me.

Did you import from my link above? It’s a modified version.

No I didn’t realise yours was a modified version, I imported the original. Will try again when I get home tonight and report back - thanks!

thank you, your version works! Much appreciated. I had a look at your github revisions, there is quite a lot of change there, good work.

1 Like

The blueprint has been updated with the modifications done by @JetSerge.

This has suddenly stopped working for me. all my button automations have stopped triggering any actions

any info?

Does it says to you the same parsing error?

Getting the same. Did you manage to resolve this?

I no longer use Zigbee2MQTT in favor of ZHA, so I can’t perform tests with an updated version.

If you want to fix the deprecated integration, please ping me, @radinsky @rufio

If not, this blueprint must be considered deprecated, unfortunately.

Unfortunately I have created my own automation instead of using blueprint…
However, there’s a way to fix described here: Is there a deprecation on entity domain for selectors? - #2 by Sir_Goodenough

1 Like