dresden-elektronik / deconz-rest-plugin

deCONZ REST-API plugin to control ZigBee devices
BSD 3-Clause "New" or "Revised" License
1.89k stars 496 forks source link

Deconz trigger 1002 event on smartthings button on version 2.09.01 #4232

Closed MartinTerp closed 3 years ago

MartinTerp commented 3 years ago

Describe the bug

After change to version 2.09.01, my Smartthings button GP-U999SJVLEGA sometimes sends the 1002 event (according to deconz) causing my lights to turn on/off occasionally, atm it seems like every hour

Steps to reproduce the behavior

Update to 2.09.01, have a Smartthings button, wait

Expected behavior

It dosnt send 1002 event unless button press

Screenshots

This is the only log from the event time image

Environment

Version 2.09.01 / 12/23/2020 Firmware 26680700

deCONZ Logs

See screenshot

Additional context

Smanar commented 3 years ago

Hello, you haven't the log when it send the command ? There is written "[INFO] - Button 1002 ...."

Because, your log is about cluster 0x0500, not used for buttonevent.

MartinTerp commented 3 years ago

Hi

Here is what happend that second.

17:29:53:143 ZDP skip fetch 0x86BD7FFFE503FA5, diff last seen: 626 seconds [4]
17:29:53:303 ZDP skip fetch 0xD0CF5EFFFE6EC90B, diff last seen: 626 seconds [4]
17:29:53:305 Mgmt_Lqi_req zdpSeq: 193 to 0x000B3CFFFEF77E25 start index 15
17:29:53:305 APS-DATA.request id: 234, addrmode: 0x03, addr: 0x000b3cfffef77e25, profile: 0x0000, cluster: 0x0031, ep: 0x00 -> 0x00 queue: 1 len: 2 tx.options 0x00
17:29:53:327 APS-DATA.confirm id: 234, status: 0x00 SUCCESS
17:29:53:328 APS-DATA.confirm request id: 234 -> confirmed, timeout 1611160193
17:29:53:344 APS-DATA.indication srcAddr: 0xf083, srcEp: 0x00 dstAddrMode: 2, profile: 0x0000, cluster: 0x8031, lqi: 255, rssi: -38
17:29:53:345 APS-DATA.indication request id: 234 -> finished
17:29:53:346 APS-DATA.request id: 234 erase from queue
17:29:53:346 ZDP status = 0x00 -> SUCCESS
17:29:53:347 ZDP Mgmt_Lqi_rsp zdpSeq: 193 from 0x000B3CFFFEF77E25 total: 16, startIndex: 15, listCount: 1
17:29:53:347 * neighbor: 0x086BD7FFFE05F7F4 (0xEDAF), LQI: 241, relation: 0x02 rxOnWHenIdle: 1
17:29:53:562 APS-DATA.indication srcAddr: 0xafd3, srcEp: 0x01 dstAddrMode: 2, profile: 0x0104, cluster: 0x0500, lqi: 255, rssi: -55
17:29:53:564 APS-DATA.request id: 238, addrmode: 0x02, addr: 0xafd3, profile: 0x0104, cluster: 0x0500, ep: 0x01 -> 0x01 queue: 1 len: 5 tx.options 0x00
17:29:53:565 [INFO] - No button handler for: button endpoint: 0x01 cluster: IAS_ZONE (0x0500) command: 0x0A payload[0]: 002
17:29:53:566 ZCL attribute report 0x286D9700010827B9 for cluster: 0x0500, ep: 0x01, frame control: 0x08, mfcode: 0x0000
17:29:53:566 APS-DATA.request id: 239, addrmode: 0x02, addr: 0xafd3, profile: 0x0104, cluster: 0x0500, ep: 0x01 -> 0x01 queue: 2 len: 5 tx.options 0x00
17:29:53:598 APS-DATA.confirm id: 238, status: 0x00 SUCCESS
17:29:53:599 APS-DATA.confirm request id: 238 -> erase from queue
17:29:53:602 APS-DATA.confirm id: 239, status: 0x00 SUCCESS
17:29:53:602 APS-DATA.confirm request id: 239 -> erase from queue
17:29:53:623 aps request id: 238 finished, erase from queue
17:29:53:703 aps request id: 239 finished, erase from queue
Smanar commented 3 years ago

Do you know how to log websocket request ? Using your third app or a plugin browser ?

To be sure it s deconz that send the notification. Because I m sorry, but on your log again, deconz haven't try to send websocket request to change a buttonstate.

alaghbar commented 3 years ago

I have the same issue after latest docker container update. Routinely triggers event 1002 and on another button, event 1004 without physically pressing any button

MartinTerp commented 3 years ago

Do you know how to log websocket request ? Using your third app or a plugin browser ?

To be sure it s deconz that send the notification. Because I m sorry, but on your log again, deconz haven't try to send websocket request to change a buttonstate.

Is the event from NodeRed enough? else provide info on webrequest log.

image

Smanar commented 3 years ago

Nope it s fine, thx. A last test, you can done, just to be sure the websocket is send for the buttonevent change and not another thing.

You problem concern only the 1002 value ? so can you change this value, using the remote (idk wich one feature it support), and check the value during the bug.

Just to check if it s a new event 1002, or just a repeat of the last one. (the value is memorised in the API till it change, you have always the last value visible)

And no problem before the 2.09.01 version ?

SwoopX commented 3 years ago

You might want to try something out here. In deconz GUI, select the IAS Zone cluster, scroll down to the attributes and double click on the value for attribute 0x0002. Make sure the device is awake by pushing the button and then read the reporting configuration (must be done within 2 seconds). That should give you a NOT_FOUND as below.

The code has a passage to configure 3600 as max interval, which would correspond with your experience. If anything is configured, try disabling the reporting configuration by setting min interval to 0 and max interval to 65535, then press write config (again, make sure the device is awake).

grafik

kyletpugh commented 3 years ago

It appears that this device sends a battery or status indication message on a regular interval. This is just sent as the previous event that was triggered for some reason. If no event has been triggered yet then you get this in HA (I removed the ids but they were all unique):

{
    "event_type": "deconz_event",
    "data": {
        "id": "removed_id_1",
        "unique_id": "removed_unique_id_1",
        "event": null,
        "device_id": "device_id_1"
    },
    "origin": "LOCAL",
    "time_fired": "2021-01-26T19:29:02.952226+00:00",
    "context": {
        "id": "removed_device_id_2",
        "parent_id": null,
        "user_id": null
    }
}

This message appears to be sent about every hour.

MartinTerp commented 3 years ago

Nope it s fine, thx. A last test, you can done, just to be sure the websocket is send for the buttonevent change and not another thing.

You problem concern only the 1002 value ? so can you change this value, using the remote (idk wich one feature it support), and check the value during the bug.

Just to check if it s a new event 1002, or just a repeat of the last one. (the value is memorised in the API till it change, you have always the last value visible)

And no problem before the 2.09.01 version ?

Hi, yes its happend like, 5min after I patched to 2.09.01, and I blamed my girlfriend for playing with the lights :D I pushed the button, read the details, waited until it send a event itself, and its not the same event as the manual on (etag is different) and yes, its only 1002 it sends

MartinTerp commented 3 years ago

You might want to try something out here. In deconz GUI, select the IAS Zone cluster, scroll down to the attributes and double click on the value for attribute 0x0002. Make sure the device is awake by pushing the button and then read the reporting configuration (must be done within 2 seconds). That should give you a NOT_FOUND as below.

The code has a passage to configure 3600 as max interval, which would correspond with your experience. If anything is configured, try disabling the reporting configuration by setting min interval to 0 and max interval to 65535, then press write config (again, make sure the device is awake).

You might want to try something out here. In deconz GUI, select the IAS Zone cluster, scroll down to the attributes and double click on the value for attribute 0x0002. Make sure the device is awake by pushing the button and then read the reporting configuration (must be done within 2 seconds). That should give you a NOT_FOUND as below.

The code has a passage to configure 3600 as max interval, which would correspond with your experience. If anything is configured, try disabling the reporting configuration by setting min interval to 0 and max interval to 65535, then press write config (again, make sure the device is awake).

Hi

I dont have switches in my node list, but the switch also has a temperature sensor which I can see in the gui, can I use that or am i missing something regarding switches in node list?

alaghbar commented 3 years ago

Nope it s fine, thx. A last test, you can done, just to be sure the websocket is send for the buttonevent change and not another thing.

You problem concern only the 1002 value ? so can you change this value, using the remote (idk wich one feature it support), and check the value during the bug.

Just to check if it s a new event 1002, or just a repeat of the last one. (the value is memorised in the API till it change, you have always the last value visible)

And no problem before the 2.09.01 version ?

It also started here few minutes after it was updated to 2.09.01. It auto generates 1002 and sometimes 1004 events without pushing a button. I have 2 of these buttons and it happens for both. I had to disable all automations related to SmartThings buttons. Thanks

Smanar commented 3 years ago

I m checking the change in version beetween v2.8.0-beta and v2.9.1-beta I just see :

Noone can reverse some code to make tries ?

kyletpugh commented 3 years ago

So the changes in the beta channel did not prevent this. It seems that there are two events being sent by these buttons that end up firing a deconz_event with the previous event data, a periodic (looks like hourly) temperature update, and what I think is a device is going to sleep event five minutes after last being pressed. Both of these appear to be re-firing the previous real event, if there was one, when they should only be updating the state of the device. I will be able to gather deconz logs soon, I hope.

kyletpugh commented 3 years ago

Just so the information is here. See https://github.com/dresden-elektronik/deconz-rest-plugin/issues/4227#issuecomment-778503973 for more information. I will also get logs for you when I am able to access the server directly. This is on beta-channel, version 2.09.03 / 12/23/2020.

kyletpugh commented 3 years ago

deconz-log.txt Attached the log. The event is fired when these temperature and button reads appear (the only actual presses are of the desk button at first in the log): 06:31:36:192 Force read attributes for ZHATemperature SensorNode Kyle's Room Desk Temperature 06:31:41:193 Force read attributes for ZHASwitch SensorNode Dining Room Button But this is also firing the event (this is the same device as the temperature sensor from above) caused by motion(?):

06:31:31:193 Force read attributes for ZHASwitch SensorNode Kyle's Room Desk Button
06:31:31:199 APS-DATA.indication from child 0xD540
06:31:31:200 Node data 0xb0ce181403374589 profileId: 0x0104, clusterId: 0x0008
06:31:31:200 0xB0CE181403374589: update ZCL value 0x01/0x0008/0x0000 after 0 s
06:31:31:201 ZCL attribute report 0xB0CE181403374589 for cluster: 0x0008, ep: 0x01, frame control: 0x18, mfcode: 0x0000 
06:31:31:201    payload: 00002042
06:31:31:541 Poll APS request to 0xB0CE181403396234 cluster: 0x0006 dropped, values are fresh enough
06:31:31:776 Node data 0x286d970001136cb2 profileId: 0x0104, clusterId: 0x0402
06:31:31:777 0x286D970001136CB2: update ZCL value 0x01/0x0402/0x0000 after 0 s
06:31:31:777 enqueue event state/temperature for /sensors/12
06:31:31:777 enqueue event state/lastupdated for /sensors/12
06:31:31:778 [INFO] - No button map for: motion, unicast to: 0x0000, endpoint: 0x01, cluster: 0x0402, command: 0x0A, payload: 0000296C07, zclSeq: 57
06:31:31:778 ZCL attribute report 0x286D970001136CB2 for cluster: 0x0402, ep: 0x01, frame control: 0x08, mfcode: 0x0000 
06:31:31:778    payload: 0000296c07
06:31:31:779 0x286D970001136CB2 (motion) create binding for attribute reporting of cluster 0x0001 on endpoint 0x01
06:31:31:779 queue binding task for 0x286D970001136CB2, cluster 0x0001
06:31:31:779 0x286D970001136CB2 (motion) create binding for attribute reporting of cluster 0x0500 on endpoint 0x01
06:31:31:779 queue binding task for 0x286D970001136CB2, cluster 0x0500
06:31:31:779 [INFO_L2] - Set config/pending flags R_PENDING_ENROLL_RESPONSE | R_PENDING_WRITE_CIE_ADDRESS (0x0000000000000030) in 0x0000000000000000 --> 0x0000000000000030
06:31:31:780 read attributes of 0x286D970001136CB2 cluster: 0x0500: [ 
06:31:31:780 0x0000 
06:31:31:780 0x0010 
06:31:31:780 ]
06:31:31:781 add task 4569 type 19 to 0x286D970001136CB2 cluster 0x0500 req.id 30
06:31:31:781 0x286D970001136CB2 (motion) create binding for attribute reporting of cluster 0x0001 on endpoint 0x01
06:31:31:781 discard double entry in binding queue (size: 8) for for 0x286D970001136CB2, cluster 0x0001
SwoopX commented 3 years ago

Thanks for providing the logs. Already taken a brief look at it and assume I got a rough idea on what's going on here. Will explain later in more detail.

In the meantime, could you provide another log which contains ALL feasible/recognized button presses in short consecutive order? I understand it can deliver short, double press and hold. Thanks!

kyletpugh commented 3 years ago

I went through each type of press twice, it looks like they don't show up correctly. It is /sensors/3, the desk button/temp.

github-actions[bot] commented 3 years ago

As there has not been any response in 21 days, this issue has been automatically marked as stale. At OP: Please either close this issue or keep it active It will be closed in 7 days if no further activity occurs.

MartinTerp commented 3 years ago

still an issue.

Mimiix commented 3 years ago

@MartinTerp as long as nobody provides the info swoop requested, this can't be solved...

bitbyt3r commented 3 years ago

It looks like each of the possible events are already in the log that @kyletpugh provided. If other data is needed I'm also seeing this issue and can try to get logs.

MartinTerp commented 3 years ago

So i should just close the issue with "buy other button" ?

I have provided the logs i have regarding this issue, if others have more logs i hope they will add it aswell

kyletpugh commented 3 years ago

Yeah, I provided what was requested. I can always provide more but I have several intertwined problems, it's super frustrating because half my house is not working...

Mimiix commented 3 years ago

Swoop asked:

In the meantime, could you provide another log which contains ALL feasible/recognized button presses in short consecutive order? I understand it can deliver short, double press and hold. Thanks!

kyletpugh commented 3 years ago

I provided that in the log, that is what the log is. I pressed the switch buttons in every possible way, all 3, lol. The problem occurred multiple times with the same and other buttons during this time. What else is actually needed?

himem-sys commented 3 years ago

I'm having the same issue, my smartthings buttons are triggering phantom events approx every hour ever since I upgraded from Deconz 2.09.00 to 2.10.04. It freaked me out at first because my garage door opened by itself, then all the lights turned off an hour later! Can I assist with logs or debug info to help get this sorted? Thanks.

RichJeanes commented 3 years ago

Can some please post precise instructions for obtaining the logs needed to fix this? I'm happy to provide them. This bug has rendered all of my buttons useless and has significantly hampered my home for months now.

RichJeanes commented 3 years ago

@SwoopX I don't want to be a pest, but do you have any more info on this issue for us? @kyletpugh says they provided what you asked for in their logs. If that doesn't contain what you need, please let us know so we can help get this issue fixed.

maurcol commented 3 years ago

Also having the same issue, If instructions are provided on what type of logs are needed or how to get them I also can provide them to have more data if that helps

Mimiix commented 3 years ago

I asked swoop. He mentioned: What hapens if you set websocketnotifyall to false (wiki https://dresden-elektronik.github.io/deconz-rest-doc/endpoints/configuration/#response-fields)

SwoopX commented 3 years ago

We probably have already mentioned that to various people, but just not here. In the various logs we've received here or on Discord, there's no duplicate events on zigbee level. This would pretty much leave it to the websocket events.

By default, all key/value items are send whenever there's an update to ANY of them. However, you can change that behavior by the parameter Mimiix already mentioned above, please see here https://dresden-elektronik.github.io/deconz-rest-doc/endpoints/configuration/#parameters_4

After having that changed, only the actually changing values are sent. Presumably, this solves the observed behavior. We've suggested this before at least on Discord, but unfortunately never got any update on this back. So, if anybody could try this out and let us know, it should bring us one step further.

maurcol commented 3 years ago

Thanks for your replies. I'd gladly try but at least now I see my knowledge is limited. Don't know where the changes have to be made. How I access the place to do the changes? I use Home Assistant with Deconz, if you provide me with a short instruction I could give it a try and reply on the outcome.

P.s. I tried to google info from Mimiix reply and yours(SwoopX) but couldn't figure it out so far where to look for the place to input the changes.

Smanar commented 3 years ago

By default, all key/value items are send whenever there's an update to ANY of them. However, you can change that behavior by the parameter Mimiix already mentioned above, please see here https://dresden-elektronik.github.io/deconz-rest-doc/endpoints/configuration/#parameters_4

Si it mean the first notification is caused by the buttonevent change, and the second one ? what is the changed field that trigger a second notification ?

RichJeanes commented 3 years ago

@SwoopX Was a change made to the websocket events or configuration that caused this to start happening? I can't say I remember what the event data actually looked like before this issue cropped up, but I didn't change my handling of these events which means the Home Assistant events didn't used to contain the buttonevent unless that is what triggered the HA event.

@maurcol Configuration changes need to be made via the backing web API.

  1. From HA Supervisor, go to your deCONZ add-on configuration and set a Host port fro the "API backend" (I just used the default 40850). You can now use the hostname/IP of your HA server and the port set in the deCONZ config as your target URL.
  2. Now you need to interact with the web API. If you aren't familiar with this kind of interaction already, you can use Node-RED on your HA server to do it. Add the necessary nodes: inject => www-request => debug image
  3. DOCS First we need to get an API key to authenticate with the gateway. Configure your inject node like this: image Set the www-request node Method option to "- set by msg.method -". image Deploy the changes. image Go to the deCONZ add-on, Phoscon web UI, Gateway settings, Advanced, and click on "Authenticate App". image Now go back to Node-RED and activate your inject node by clicking the grey square on its left. image Now switch your right pane to the debug console in the top right: image You should see a message there with JSON that looks like "{"username":"xxxxxxxxxx"}" Save this username. It is your API key that allows you to authenticate to the deCONZ gateway. Anywhere you see "\<apikey>", replace it with your key.
  4. Now you can use the API docs to do anything you want. For example: When you see "GET /api/\<apikey>/config" in the docs, set msg.method to "GET" and msg.url to "http://\<server>:40850/api/\<apikey>/config". If you need to supply parameters, set msg.payload to whatever JSON is called for, otherwise just leave it blank. Deploy the changes, then inject. You'll see the results in the debug console. If it's a particularly long response, I suggest copy/pasting it into a text editor for easier reading, preferably one with syntax highlighting (two good options are Sublime Text and Notepad++)
  5. To make the configuration modification that has been suggested here, this is what your inject node should look like: image And you should get a response like this: image
RichJeanes commented 3 years ago

Unfortunately that configuration change did not solve the issue. I am still getting events on the Home Assistant bus that report a buttonevent when no button was pressed.

maurcol commented 3 years ago

Thanks for the great instructions, I'm familar with node-red so this was great. I will try and see what happens

maurcol commented 3 years ago

For now I follow the instructions and got the response as you provided on the screen shot. I now have to wait if there will be a phantom trigger. I set up a notification to my phone to be notify if that happens and what code has been send. So now is matter of waiting. Actually another thing which I don't know if it is related to this issue and perhaps @RichJeanes can be also interested. I only have 2 smartthings buttons so it was not such a big deal when all this started but a week after all this started happening one of them die. Not sure if it's entirely dead, I chnage the battery and tried to put it again in paring mode but it won't react.

RichJeanes commented 3 years ago

I am still getting ghost events on the HA bus that include button press events. image image

Here is an event from an actual button press: image

I have also noticed that when a button has not been interacted with for a while (not sure exactly how long), it sends two events the next time it is pressed.

maurcol commented 3 years ago

I can confirm, I also got a phantom trigger. now. However didn't catch the debug info. Will post it as soon as I get it

kyletpugh commented 3 years ago

So I finally got the button that was having an issue pairing to join the network after updating deCONZ and deleting the node from the GUI. This button appears to have no issues now, after over an hour with no phantom events. No extra events for this button but still getting the extra presses for the other buttons. Appears still two immediate and five minutes after last activity plus randomly about each hour for the others. I wonder if there is something in the config now that is preventing them all from working like this one. I am going to delete them, go around and re-pair them tomorrow to see if that works. I will let you know if this solves the issue...

Using v2.11.1-beta 3/14/2021 Firmware: 26660700

EDIT: Still appear to be getting the five minute phantom but not consistently. I'll see if I get any more misfires...

Smanar commented 3 years ago

One change it have between the working and the not working version, are the reporting values I realy don't think it s the guilty but the test is fast (probably need to awake the device during request)

ATM you need to have as reporting setting on the POWER_CONFIGURATION_CLUSTER, attribute 0x0021

            rq.minInterval = 30;
            rq.maxInterval = 21600;
            rq.reportableChange8bit = 10;

Try with olders values

            rq.minInterval = 300;
            rq.maxInterval = 2700;
            rq.reportableChange8bit = 1;
chadwikx commented 3 years ago

I went from 6.6.2 to 6.8.0 last night. I can also confirm the phantom triggers... Unfortunately I have about 15 smartthings buttons.

Hoping my snapshot downgrade was enough to fix it for now.

I might spin up an test environment to attempt to get some logs soon.

rob1303-hub commented 3 years ago

This is what occurs for me:

I have made the websocketnotify API change and this did not resolve the issue

My system:

Phoscon Version: 2.10.04/ 3/14/2021 Firmware: 26680700 HA Add-on version: 6.8.0

Not sure if they are useful but attached screenshot of REST API settings for the button and temperature entity, and also screenshot of logbook of automations I set up in HA to capture phantom triggers.

Let me know if you need any further information.

210427 - samjin button - last updated

210426 SamsungButton_PhantomTriggers

kyletpugh commented 3 years ago

I have different behavior with my buttons. I have three types of lights, three types of buttons/switches, and motion sensors. All the lights and motion sensors are working. The buttons/switches all have various strange issues that can be ignored but this one cannot since it causes events to recur. I agree that I am getting a phantom trigger every hour plus some seconds for every button, I suspect this is the battery level update. I am getting a five minute last seen from the first press phantom event for some of the buttons. I am getting a phantom event that appears to be for temperature every twenty minutes, I think, on some of the buttons. These are overlapping groups, some are routed through Samsung bulbs and some are routed through Hue bulbs. The other bulbs are only end devices. All the buttons switches seem to be connected through a router device except one, and that one button appears to not have any issues... So I am super confused....

rob1303-hub commented 3 years ago

automations I set up in HA to capture phantom triggers

Counter up to phantom triggers 300 now.

Unfortunately this issue has made my Smarthings buttons unusable.

Is any solution possible/likely?

kyletpugh commented 3 years ago

So, I've discovered that my previously paired devices are working differently than unpaired and re-paired devices after some recent version update. The still paired from before devices behavior is still the same. The re-paired devices behavior is worse, they now disconnect whenever they send an update and go offline until the battery is removed and replaced. The wake event is causing a double press again... I'm beginning to think this is a problem with devices that are actually multiple devices. It would be so much easier if these devices were actually differentiated with sub-devices or something so that only the correct device is being updated.

RichJeanes commented 3 years ago

We're now at almost four months of absolutely no progress on this issue and barely any feedback. I think I'm giving up on the deCONZ add-on and I'm going to start over with the ZHA integration. You can check if your devices are compatible with a different Zigbee integration here: https://zigbee.blakadder.com/index.html

MartinTerp commented 3 years ago

We're now at almost four months of absolutely no progress on this issue and barely any feedback. I think I'm giving up on the deCONZ add-on and I'm going to start over with the ZHA integration. You can check if your devices are compatible with a different Zigbee integration here: https://zigbee.blakadder.com/index.html

Im afraid its like expected, I have multiple issues with my deconz intergration, ikea blinds not working probertly, deconz not able to handle larger quantity of messages (fx. turning on 20 lights on at once) and this. the 2 other issues and gone stale and closed since only OP can keep it alive.

I have unfortunately replaced my smartthings buttons with philips ones and bought an ikea gateway for my blinds.

Smanar commented 3 years ago

Just by curiosity, one of you have tried to set the same reporting than before the issue ? https://github.com/dresden-elektronik/deconz-rest-plugin/issues/4232#issuecomment-826045321

rob1303-hub commented 3 years ago

Smanar

Happy to try the change - but not sure where/ how I make this change?

In the Deconz view I can only see the Temperature Sensor for the buttons - the buttons themselves do not show as nodes. The Temperature sensor blue dot pulses when then button is pressed, and there is an deconz_event in HA.

If I go to POWER_CONFIGURATION_CLUSTER, attribute 0x0021 for the Temperature Sensor node then it states it is read only and I am not able to amend.

Also even if I try to read the current Reporting Config - I get 'Reading config failed'

See screenshot. Phoscon_SamsungButton