Deconz-rest-plugin: Update to 2.05.84 breaks Aqara/Opple switch event x003 in Ubuntu on x86 hardware.

Created on 14 Oct 2020  路  23Comments  路  Source: dresden-elektronik/deconz-rest-plugin

Update 2.05.84 breaks the Aqara/Opple x003 event running Ubuntu 18.04 on x86 hardware.
Downgrading to 2.05.81 and everything is OK again.
Is it the same issue as before that has come back or is it a new bug?

Based on the feedback so far, it's looking like a compiler bug or at least something relating to the CPU architecture.

That appears to be the most plausible explanation, as I remarked earlier.

The only explanation I can think of would be a compiler bug.

The erratic expression seems to be:
https://github.com/dresden-elektronik/deconz-rest-plugin/blob/2a26b78f4139a179968e61aa0e0caf3fd1917162/de_web_plugin.cpp#L3586

zclParam0 is a quint16; zclFrame.payload() returns a QByteArray. QByteArray::at() returns a char. So we're comparing an unsigned 16-bit integer value of 255 with an, I assume, 8-bit, possibly signed, char value. I suppose that _is_ asking for trouble.

The only other place in the button maps where we use a zclParam0 value of 255 is for the 1002 (sharp right turn) of the IKEA dimmer. Care to guess what we see there? Hint: #2787. Maybe we were a bit premature calling out the dimmer to be cursed?

@manup, what's your take on this?

_Originally posted by @ebaauw in https://github.com/dresden-elektronik/deconz-rest-plugin/issues/2061#issuecomment-634866512_

Bug report Confirmed Bug

All 23 comments

I really want to close this one instantly. Please edit your post according to the template.

I have the same issue. No xxx3 events at all with opple switches that was paired and working before (2 gang WXCJKG12LM). I also tried to add a new 3-gang switch of the same type but that didn't work at all. It controls all lights without me telling it to (as it did before that bug was fixed a long time ago). I'm using HA OS on a RPI3.

v 2.05.84
fw 26390500
first gen conbee

I can confirm this bug

I have the 6 button Aqara Opple. A long press causes a x001 to be sent but there is never an x003 when you release the button.

The other codes seem to work. It is just the x003 that is goofed

Edit: I also checked an IKEA hockey puck remote and a Philips Hue 4 button. They both send the 003 at long press release. It is only the Opple that does not work. I have a Conbee II and run deCONZ on bare metal installed from .deb upgraded today to 2.05.84 and also updated the Conbee II firmware that came with the .84

The bug is forwarded to devs of DE. @Manup confirmed it in our discord. I will keep you updated.

Can someone check with the latest beta release, please?

@SwoopX I would like to, however I have no idea how to use beta on Home Assistant with deCoNZ addon :(

I upgraded to latest beta. Now the Opple does not work at all. Totally broken. No events

Actually, at 85 version guys, I have the same trouble, my opple switch is away... And this is my conbee2 running at x86 also...

I downgraded deconz back to 2.05.84 and the Opple works again except for the x003 codes. So .85 destroys the support of Opple completely

In case someone runs deconz from .deb like I do the downgrade is

apt install deconz=2.05.84-debian-buster-stable

I will wait for developer comments, maybe it will be fixed in the next beta.

I upgraded to latest beta. Now the Opple does not work at all. Totally broken. No events

That's why it's a Beta! Thanks for testing this. I'll try to get in touch with some Devs to get this fixed. After that i'll try to get a hotfix.

Guys, can we have some logs please?

When you ask for logs you assume we know what you want. Please specify what logs you need and I will try over the weekend. Last time I ran with logging I was instructed to run with --dbg-info=2 --dbg-error=2
Is this what you want again?
Anything I should look for?

Yes, those settings should bring us some further insights. In particular, we need to understand what is (or is not) going on behind the curtain. Any Opple related line is of interest, which should be identifyable by the corresponding mac address in the line. Also, the button map debug output, typically starting with info is of value. Ideally, we catch the deconz startup procedure, shortly followed by some botton presses, including the previously troublesome.

Did some debugging with @SwoopX.

The code that reads the buttonmap reads zclParam0 as hex value, but it's a decimal value in the json file.
https://github.com/dresden-elektronik/deconz-rest-plugin/blob/ba6034497feb8b55581f81b7b4ab8eb654a5c300/read_files.cpp#L399-L416
Line 403 should use radix 10.

After changing the value in the json to "0xff", I get the x003 event alright.

All required changes to fix the experienced issue can be done locally. The required file button_maps.json is located on a bare linux under /usr/share/deCONZ/devices. After the amendment has been saved, make sure to restart deconz.

For version .84

Below you see the button map for the opple switches. In the 5th field, there's 6 entries containing the number 255. If you change that value to 0xFF, x003 events should come in again.

"aqaraOpple6Map": {
            "modelids": ["86opcn01"],
            "map": [
                [1, "0x01", "MULTISTATE_INPUT", "0x0a", "0", "S_BUTTON_1", "S_BUTTON_ACTION_HOLD", "Off hold"],
                [1, "0x01", "MULTISTATE_INPUT", "0x0a", "1", "S_BUTTON_1", "S_BUTTON_ACTION_SHORT_RELEASED", "Off press"],
                [1, "0x01", "MULTISTATE_INPUT", "0x0a", "2", "S_BUTTON_1", "S_BUTTON_ACTION_DOUBLE_PRESS", "Off double press"],
                [1, "0x01", "MULTISTATE_INPUT", "0x0a", "3", "S_BUTTON_1", "S_BUTTON_ACTION_TREBLE_PRESS", "Off triple press"],
                [1, "0x01", "MULTISTATE_INPUT", "0x0a", "255", "S_BUTTON_1", "S_BUTTON_ACTION_LONG_RELEASED", "Off long released"],
                [1, "0x02", "MULTISTATE_INPUT", "0x0a", "0", "S_BUTTON_2", "S_BUTTON_ACTION_HOLD", "On hold"],
                [1, "0x02", "MULTISTATE_INPUT", "0x0a", "1", "S_BUTTON_2", "S_BUTTON_ACTION_SHORT_RELEASED", "On press"],
                [1, "0x02", "MULTISTATE_INPUT", "0x0a", "2", "S_BUTTON_2", "S_BUTTON_ACTION_DOUBLE_PRESS", "On double press"],
                [1, "0x02", "MULTISTATE_INPUT", "0x0a", "3", "S_BUTTON_2", "S_BUTTON_ACTION_TREBLE_PRESS", "On triple press"],
                [1, "0x02", "MULTISTATE_INPUT", "0x0a", "255", "S_BUTTON_2", "S_BUTTON_ACTION_LONG_RELEASED", "On long released"],
                [1, "0x03", "MULTISTATE_INPUT", "0x0a", "0", "S_BUTTON_3", "S_BUTTON_ACTION_HOLD", "Dim down hold"],
                [1, "0x03", "MULTISTATE_INPUT", "0x0a", "1", "S_BUTTON_3", "S_BUTTON_ACTION_SHORT_RELEASED", "Dim down press"],
                [1, "0x03", "MULTISTATE_INPUT", "0x0a", "2", "S_BUTTON_3", "S_BUTTON_ACTION_DOUBLE_PRESS", "Dim down double press"],
                [1, "0x03", "MULTISTATE_INPUT", "0x0a", "3", "S_BUTTON_3", "S_BUTTON_ACTION_TREBLE_PRESS", "Dim down triple press"],
                [1, "0x03", "MULTISTATE_INPUT", "0x0a", "255", "S_BUTTON_3", "S_BUTTON_ACTION_LONG_RELEASED", "Dim down long released"],
                [1, "0x04", "MULTISTATE_INPUT", "0x0a", "0", "S_BUTTON_4", "S_BUTTON_ACTION_HOLD", "Dim up hold"],
                [1, "0x04", "MULTISTATE_INPUT", "0x0a", "1", "S_BUTTON_4", "S_BUTTON_ACTION_SHORT_RELEASED", "Dim up press"],
                [1, "0x04", "MULTISTATE_INPUT", "0x0a", "2", "S_BUTTON_4", "S_BUTTON_ACTION_DOUBLE_PRESS", "Dim up double press"],
                [1, "0x04", "MULTISTATE_INPUT", "0x0a", "3", "S_BUTTON_4", "S_BUTTON_ACTION_TREBLE_PRESS", "Dim up triple press"],
                [1, "0x04", "MULTISTATE_INPUT", "0x0a", "255", "S_BUTTON_4", "S_BUTTON_ACTION_LONG_RELEASED", "Dim up long released"],
                [1, "0x05", "MULTISTATE_INPUT", "0x0a", "0", "S_BUTTON_5", "S_BUTTON_ACTION_HOLD", "Color warm hold"],
                [1, "0x05", "MULTISTATE_INPUT", "0x0a", "1", "S_BUTTON_5", "S_BUTTON_ACTION_SHORT_RELEASED", "Color warm press"],
                [1, "0x05", "MULTISTATE_INPUT", "0x0a", "2", "S_BUTTON_5", "S_BUTTON_ACTION_DOUBLE_PRESS", "Color warm double press"],
                [1, "0x05", "MULTISTATE_INPUT", "0x0a", "3", "S_BUTTON_5", "S_BUTTON_ACTION_TREBLE_PRESS", "Color warm triple press"],
                [1, "0x05", "MULTISTATE_INPUT", "0x0a", "255", "S_BUTTON_5", "S_BUTTON_ACTION_LONG_RELEASED", "Color warm long released"],
                [1, "0x06", "MULTISTATE_INPUT", "0x0a", "0", "S_BUTTON_6", "S_BUTTON_ACTION_HOLD", "Color cold hold"],
                [1, "0x06", "MULTISTATE_INPUT", "0x0a", "1", "S_BUTTON_6", "S_BUTTON_ACTION_SHORT_RELEASED", "Color cold press"],
                [1, "0x06", "MULTISTATE_INPUT", "0x0a", "2", "S_BUTTON_6", "S_BUTTON_ACTION_DOUBLE_PRESS", "Color cold double press"],
                [1, "0x06", "MULTISTATE_INPUT", "0x0a", "3", "S_BUTTON_6", "S_BUTTON_ACTION_TREBLE_PRESS", "Color cold triple press"],
                [1, "0x06", "MULTISTATE_INPUT", "0x0a", "255", "S_BUTTON_6", "S_BUTTON_ACTION_LONG_RELEASED", "Color cold long released"]
            ]
        },

For version .85

In addition to that, for version .85, the corresponding button map should contain the dedicated modelID

Currently:

"aqaraOpple6Map": {
            "modelids": ["86opcn01"],

Must be:

"aqaraOpple6Map": {
            "modelids": ["lumi.remote.b286opcn01", "lumi.remote.b486opcn01", "lumi.remote.b686opcn01"],

Confirmed all working in the 2.05.86. Thanks a lot for the fast fixing

Guys, I'm not confirm fixes, 'coz I'm still have a issues with opple, aqara and etc... and one more think, I have 85 version in phoscon, maybe Docker not fully updated the container? Don;t know what happens. Container from yesterday the latest branch... but in phoscon at all my three gateways shown 85 version.

Removed the random tag to some guy not related.

@SAOPP Are you on the docker version?

The docker version is not updated to 86 yet.

sure, but, yesterday I saw container was updated... okay maybe I'm wrong.

It was, but not to beta apparantly.
I asked @phdelodder to update asap.

He will update tonight.

guys a false alarm on my part, apparently Martin really hasn't updated the containers yet ... and I was knocked off the right track by yesterday's update of the stable branch ...

@manup yesterday I was talking 'bout wrong version of phoscon... I think this is related my post 'bout docker. so I'm sorry for this. I need to be more careful next time - but yesterday's updates to containers and the stable branch are to blame, it just confused me.

Okay. Have an 86th version. Opple and Aqara is was fixed. Aqara vibro sensor is no. But it's in another topic... Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hazcod picture hazcod  路  146Comments

jsve picture jsve  路  115Comments

ebaauw picture ebaauw  路  350Comments

Thomas-Vos picture Thomas-Vos  路  121Comments

Jopinder picture Jopinder  路  122Comments