Aqara Rocker Switch settings changed?

Posted on
Mon Dec 28, 2020 5:59 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Aqara Rocker Switch settings changed?

Something has changed and I am no longer picking up switch presses on my Aqara Double Rocker.

It was previously working, prior to installing the latest Shims update (V0.4.x) and reflashing my CC2531.

The switch presses are detected by Zigbee2MQTT, e.g.:
Zigbee2MQTT:info 2020-12-28 11:43:24: MQTT publish: topic 'zigbee2mqtt/Aqara_double_rocker_1', payload '{"action":"single_left","battery":100,"click":"left","last_seen":"2020-12-28T11:43:24+00:00","linkquality":52,"voltage":3005}'

Zigbee2MQTT:info 2020-12-28 11:49:34: MQTT publish: topic 'zigbee2mqtt/Aqara_double_rocker_1', payload '{"action":"hold_right","battery":100,"click":"right_long","last_seen":"2020-12-28T11:49:34+00:00","linkquality":92,"voltage":3005}'


The Shims definition is as follows:
message_type: '##aqara_double_rocker_1##'
props:
SupportsBatteryLevel: true
battery_payload_key: battery
configDone: true
reports_battery_status: true
state_dict_payload_key: .
state_location: payload
state_location_payload_type: json
uid_location: topic
uid_location_topic_field: '1'
trigger:
match_list: '["Match: zigbee2mqtt", "Match: Aqara_double_rocker_1"]'
queueMessage: true
type: shimGeneric


Here is what the device looks like:
Screenshot 2020-12-28 at 11.53.05.png
Screenshot 2020-12-28 at 11.53.05.png (61.5 KiB) Viewed 2297 times


The last_seen and linkquality seem out of kilter?

The triggers I had set-up to detect events on this device seem to have reverted to checking against the battery.

I have no doubt it is something I have done but can't immediately see what it is. :?

Posted on
Mon Dec 28, 2020 7:08 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Aqara Rocker Switch settings changed?

Why do you use QUOTE tags instead of CODE tags? You loose the indentations, which actually matter for the Shim definitions.

The last_seen and linkquality seem out of kilter?


The format of those values matches what's in the message payload, so I don't see anything wrong with them. What's concerning is that the 'action' and 'click' components of the payload aren't showing up in the custom states. Those are the ones that you need for this to be useful as an input device. That topic/payload logging is from the bridge, not from one of the Indigo plugins, right? Does the logging from the plugins match that payload content?

I'd need to see a matching set of logs excerpts from the bridge, the connector, and the shim. I'm wondering if this device is now sending status payloads without the action and click entries when it's otherwise idle. Like a battery update or timeout after the buttons are released.

You say you reflashed the CC2531? Did that cause the bridge MQTT output to change?

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

Posted on
Mon Dec 28, 2020 7:22 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Aqara Rocker Switch settings changed?

Code: Select all
message_type: '##aqara_double_rocker_1##'
props:
    SupportsBatteryLevel: true
    battery_payload_key: battery
    configDone: true
    reports_battery_status: true
    state_dict_payload_key: .
    state_location: payload
    state_location_payload_type: json
    uid_location: topic
    uid_location_topic_field: '1'
trigger:
    match_list: '["Match: zigbee2mqtt", "Match: Aqara_double_rocker_1"]'
    queueMessage: true
type: shimGeneric
Now in a code block :)

I will capture the rest of what you asked for and post back shortly. :)

Posted on
Mon Dec 28, 2020 7:28 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Aqara Rocker Switch settings changed?

Turned on Shims debugging and got this:
MQTT Shims Debug Aqara Double Rocker 1: processMessages: '##aqara_double_rocker_1##' zigbee2mqtt/Aqara_double_rocker_1 -> {"action":"single_left","battery":100,"click":"left","last_seen":"2020-12-28T13:23:32+00:00","linkquality":99,"voltage":3005}
MQTT Shims Error Error in plugin execution runConcurrentThread:

Traceback (most recent call last):
File "plugin.py", line 115, in runConcurrentThread
File "plugin.py", line 139, in processMessages
File "plugin.py", line 829, in update
UnboundLocalError: local variable 'newProps' referenced before assignment

MQTT Shims Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)


Doing it without debug it is also now occurring; obviously I didn't notice it earlier :oops:

Posted on
Mon Dec 28, 2020 7:39 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Aqara Rocker Switch settings changed?


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

Posted on
Mon Dec 28, 2020 7:46 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Aqara Rocker Switch settings changed?

That's fixed it -thanks. :)

Screenshot 2020-12-28 at 13.44.55.png
Screenshot 2020-12-28 at 13.44.55.png (69.48 KiB) Viewed 2256 times

Posted on
Mon Dec 28, 2020 8:16 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Aqara Rocker Switch settings changed?

Next related issue is that I couldn't get the triggers to work.

It seems that the text field states are being output enclosed in quotation marks (") - see image above.

Ideally, this wouldn't be the case as they are Indigo text states.

Is this a bug or a feature? :)

Posted on
Mon Dec 28, 2020 8:21 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Aqara Rocker Switch settings changed?

I'm not sure. I'm not adding the double quotes, they're in the payload like that. But I would have assumed that the JSON decoder would remove them. I'll need to run some tests to see what's going on.

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

Posted on
Mon Dec 28, 2020 11:45 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Aqara Rocker Switch settings changed?

I'm declaring this an Indigo bug. ;)

When I do the JSON decode, those fields are returned as type 'unicode'. When I update the state with a value that's type unicode, the quotes are there. If I coerce the values to string before updating the state, the quotes go away.

But I really don't want to coerce them, because they might actually have Unicode characters in them.

What to do?

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

Posted on
Mon Dec 28, 2020 12:10 pm
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Aqara Rocker Switch settings changed?

I'm not following - can you show your work as an example?

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Dec 28, 2020 12:17 pm
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Aqara Rocker Switch settings changed?

I have just tried this in my Roon Plugin and am not getting any quotes:
Code: Select all
key_value_list.append({'key': 'one_line_1', 'value': u"UNICODE Tëst: {0}".format(self.globals[K_ROON][K_ZONES][zone_id][K_NOW_PLAYING][K_ONE_LINE][K_LINE_1])})
gives:
Code: Select all
UNICODE Tëst: Piano Concerto No. 18 in B-Flat Major, K. 456: I. Allegro vivace - Salzburger Kammerphilharmonie / Yoon K. Lee / Wolfgang Amadeus Mozart
Admittedly not the same, but it doesn't seem to be adding quotes to the state value?

Posted on
Mon Dec 28, 2020 12:25 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Aqara Rocker Switch settings changed?

Well, crap, now I can't replicate it. That is, I can't get it to put the quotes in there at all. With or without the string coercion.

When I first set up a test device using Jon's device template and MQTT topic/payload message, I got quotes in some fields as he's showing above. When I determined I was sending Unicode in the value keys of the updateStatesOnServer call, I tried it with coerced ASCII. And the quotes went away. Now I'm trying to do it without the coercion, and no quotes anymore.

I'm so confused.

But, on the other hand, I'm doing this with my refactored Shims plugin, in which I eliminated at least 100 lines of duplicated code. ;)

Edit: Actually, the new version is more like 300 lines shorter.

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

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests