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

Update to 2.05.84 breaks Aqara/Opple switch event x003 in Ubuntu on x86 hardware. #3412

Closed
mickeman opened this issue Oct 14, 2020 · 23 comments · Fixed by #3428
Closed

Update to 2.05.84 breaks Aqara/Opple switch event x003 in Ubuntu on x86 hardware. #3412

mickeman opened this issue Oct 14, 2020 · 23 comments · Fixed by #3428

Comments

@mickeman
Copy link

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:

buttonMap->zclParam0 == zclFrame.payload().at(3))

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

@Mimiix
Copy link
Collaborator

Mimiix commented Oct 14, 2020

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

@PremiumUsername
Copy link

PremiumUsername commented Oct 14, 2020

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

@KennethLavrsen
Copy link

KennethLavrsen commented Oct 14, 2020

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

@Mimiix
Copy link
Collaborator

Mimiix commented Oct 14, 2020

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

@SwoopX
Copy link
Collaborator

SwoopX commented Oct 15, 2020

Can someone check with the latest beta release, please?

@radoslavsirota
Copy link

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

@KennethLavrsen
Copy link

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

@SAOPP
Copy link

SAOPP commented Oct 16, 2020

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

@KennethLavrsen
Copy link

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

@SAOPP
Copy link

SAOPP commented Oct 16, 2020

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

@Mimiix
Copy link
Collaborator

Mimiix commented Oct 16, 2020

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.

@SwoopX
Copy link
Collaborator

SwoopX commented Oct 16, 2020

Guys, can we have some logs please?

@KennethLavrsen
Copy link

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?

@SwoopX
Copy link
Collaborator

SwoopX commented Oct 16, 2020

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.

@ebaauw
Copy link
Collaborator

ebaauw commented Oct 16, 2020

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.

if (buttonMapItemArr.at(4).isString() && buttonMapItemArr.at(4).toString().length() <= 3)
{
QString para = buttonMapItemArr.at(4).toString();
//DBG_Printf(DBG_INFO, "[INFO] - Button map item #5: %d\n", para.toUint(&ok, 16));
btnMap.zclParam0 = para.toUInt(&ok, 16);
}
else if (buttonMapItemArr.at(4).isString() && buttonMapItemArr.at(4).toString().startsWith(QLatin1String("0x")) &&
(buttonMapItemArr.at(4).toString().length() == 4 || buttonMapItemArr.at(4).toString().length() == 6))
{
QString para = buttonMapItemArr.at(4).toString();
//DBG_Printf(DBG_INFO, "[INFO] - Button map item #5: %d\n", para.toUint(&ok, 16));
btnMap.zclParam0 = para.toUInt(&ok, 16);
}
else
{
DBG_Printf(DBG_INFO, "[INFO] - Button map item #%d, field #5 for '%s' has an incorrect format.\n",
mapItem, qPrintable(buttonMapName));
}

Line 403 should use radix 10.

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

@SwoopX
Copy link
Collaborator

SwoopX commented Oct 16, 2020

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"],

@KennethLavrsen
Copy link

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

@Mimiix Mimiix reopened this Oct 20, 2020
@SAOPP
Copy link

SAOPP commented Oct 20, 2020

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.

@Mimiix
Copy link
Collaborator

Mimiix commented Oct 20, 2020

@SAOPP Are you on the docker version?

The docker version is not updated to 86 yet.

@SAOPP
Copy link

SAOPP commented Oct 20, 2020

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

@Mimiix
Copy link
Collaborator

Mimiix commented Oct 20, 2020

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

He will update tonight.

@SAOPP
Copy link

SAOPP commented Oct 20, 2020

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.

@SAOPP
Copy link

SAOPP commented Oct 20, 2020

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

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

Successfully merging a pull request may close this issue.

8 participants