Aqara Double Rocker Switch

Posted on
Fri Feb 21, 2020 12:08 pm
autolog offline
Posts: 3990
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Aqara Double Rocker Switch

Going mad with Zigbee and adding a few more devices. :)

I am wondering how I should define this Aqara Double Rocker Switch as a Shim device. It is a momentary push device and you can get six states called "click" from it as follows:
Code: Select all
zigbee2mqtt:info  2020-02-21 17:57:53: MQTT publish: topic 'zigbee2mqtt/Aqara_double_rocker_1', payload '{"battery":100,"voltage":3055,"linkquality":120,"click":"left"}'
zigbee2mqtt:info  2020-02-21 17:57:57: MQTT publish: topic 'zigbee2mqtt/Aqara_double_rocker_1', payload '{"battery":100,"voltage":3055,"linkquality":123,"click":"left_double"}'
zigbee2mqtt:info  2020-02-21 17:57:59: MQTT publish: topic 'zigbee2mqtt/Aqara_double_rocker_1', payload '{"battery":100,"voltage":3055,"linkquality":123,"click":"left_long"}'
zigbee2mqtt:info  2020-02-21 17:58:01: MQTT publish: topic 'zigbee2mqtt/Aqara_double_rocker_1', payload '{"battery":100,"voltage":3055,"linkquality":113,"click":"right"}'
zigbee2mqtt:info  2020-02-21 17:58:02: MQTT publish: topic 'zigbee2mqtt/Aqara_double_rocker_1', payload '{"battery":100,"voltage":3055,"linkquality":110,"click":"right_double"}'
zigbee2mqtt:info  2020-02-21 17:58:04: MQTT publish: topic 'zigbee2mqtt/Aqara_double_rocker_1', payload '{"battery":100,"voltage":3055,"linkquality":107,"click":"right_long"}'
It doesn't have an ON/OFF state as such.

Posted on
Fri Feb 21, 2020 12:13 pm
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Aqara Double Rocker Switch

For that one, I would set it up as a value sensor, with the battery or linkquality as the primary value. And set up the multi-states key as ".". Then just set up a trigger on the "click" device state and do whatever you want from there.

You could set up six triggers like that, each with a different condition to test the value of that device state.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Fri Feb 21, 2020 12:45 pm
autolog offline
Posts: 3990
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Aqara Double Rocker Switch

Thanks for the pointer - I'll give a try. :)

Posted on
Fri Feb 21, 2020 2:35 pm
siclark offline
Posts: 1961
Joined: Jun 13, 2017
Location: UK

Re: Aqara Double Rocker Switch

Good work Jon. I've got one on order but not arrived yet.

Posted on
Fri Feb 21, 2020 2:39 pm
siclark offline
Posts: 1961
Joined: Jun 13, 2017
Location: UK

Re: Aqara Double Rocker Switch

I've got one of these on order too

https://www.zigbee2mqtt.io/devices/WXCJKG13LM.html

Posted on
Sat Feb 22, 2020 10:27 am
autolog offline
Posts: 3990
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Aqara Double Rocker Switch

FlyingDiver wrote:
For that one, I would set it up as a value sensor, with the battery or linkquality as the primary value. And set up the multi-states key as ".". Then just set up a trigger on the "click" device state and do whatever you want from there.

You could set up six triggers like that, each with a different condition to test the value of that device state.

As expected, I can confirm this works OK. :)

Posted on
Sat Feb 22, 2020 2:12 pm
siclark offline
Posts: 1961
Joined: Jun 13, 2017
Location: UK

Re: Aqara Double Rocker Switch

Nice.

Posted on
Sun Feb 23, 2020 6:03 am
autolog offline
Posts: 3990
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Aqara Double Rocker Switch

I have now set this up as a MQTT Generic JSON device. I have also setup triggers for it e.g.:
  • Type: Device State Change
  • Device:
    • Aqara Double Rocker 1
    • click
    • becomes Equal to: right
This works fine except for one issue which is that when I press the same button again (e.g. right in this case), no trigger is actioned as the field content hasn't changed.

So I looked at a Z-Wave Switch and I see that that is triggered on the incoming Z-Wave Command received from the device - button 1 pressed for example. It doesn't matter if that was the button previously pressed, it will invoke the associated action again.

The command from the the Aquara Double Rocker Switch is e.g. :
Code: Select all
zigbee2mqtt:info  2020-02-23 11:48:07: MQTT publish: topic 'zigbee2mqtt/Aqara_double_rocker_1', payload '{"battery":100,"voltage":3115,"linkquality":84,"click":"right"}'
I couldn't instantly work out whether it is possible to trigger on the topic zigbee2mqtt/Aqara_double_rocker_1 plus payload "click":"right"?

Another way which could work is for the state to be cleared maybe by the MQTT SHIMS plugin providing an action that can allow a state to be set to specific value e.g. blank in this case. I could then set the trigger to have a condition that it only fired if the state was non-blank and and an action to clear the state.

Posted on
Sun Feb 23, 2020 6:08 am
siclark offline
Posts: 1961
Joined: Jun 13, 2017
Location: UK

Re: Aqara Double Rocker Switch

See my comments on the button. I have a delayed action when click equals single to send a mqtt message with click ='' ie null. Next press is then recognised.

I have to do the same on my flic buttons.

Posted on
Sun Feb 23, 2020 6:19 am
autolog offline
Posts: 3990
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Aqara Double Rocker Switch

siclark wrote:
See my comments on the button. I have a delayed action when click equals single to send a mqtt message with click ='' ie null. Next press is then recognised.

I have to do the same on my flic buttons.

Thanks for the tip - I'll give that a try :)

Posted on
Sun Feb 23, 2020 7:42 am
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Aqara Double Rocker Switch

Hmm. I hadn't really been considering buttons or keypads when I designed the Shims plugin.

I could either add a timestamp state which will always be different when a new message for that device is received. Or a specific Event to trigger so you don't need to trigger on the device state changing. In either case, since you're not triggering on the "click" state, you would need to check that in the conditions of the trigger. I think I'd prefer the Event, since then there's no chance of a state name collision.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sun Feb 23, 2020 7:56 am
autolog offline
Posts: 3990
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Aqara Double Rocker Switch

Either would be helpful as it means that it is maintained in one trigger and you don't need to worry about resetting the state. :)

Posted on
Sun Feb 23, 2020 8:00 am
autolog offline
Posts: 3990
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Aqara Double Rocker Switch

Coincidentally, I just noted these two entries in the log. The first was unsolicited and the second because I pressed a button:
Code: Select all
zigbee2mqtt:info  2020-02-23 13:55:54: MQTT publish: topic 'zigbee2mqtt/Aqara_double_rocker_1', payload '{"battery":100,"voltage":3105,"linkquality":110}'
zigbee2mqtt:info  2020-02-23 13:56:39: MQTT publish: topic 'zigbee2mqtt/Aqara_double_rocker_1', payload '{"battery":100,"voltage":3105,"linkquality":107,"click":"right"}'
Note that the first unsolicited message doesn't include the click state. Thought I should advise this as not sure what impact it might have on your proposed solution. :)

Posted on
Sun Feb 23, 2020 10:40 am
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Aqara Double Rocker Switch

Pre-release 0.2.4 - https://github.com/FlyingDiver/Indigo-S ... /tag/0.2.4

Added trigger event for device update.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sun Feb 23, 2020 10:59 am
autolog offline
Posts: 3990
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Aqara Double Rocker Switch

That works :)

However, when I first went to set up the condition, the click state wasn't listed. I assume because there had been an interim unsolicited update and that state wasn't included and so MQTT Shims removed the state. As soon as I clicked the button and re-edited the trigger condition, the click state was present. I am not sure what will happen if a message comes through and the state is removed?

Who is online

Users browsing this forum: No registered users and 0 guests

cron