andersevenrud / ha-nexa-bridge-x

Home Assistant - Nexa Bridge X Integration
Other
9 stars 3 forks source link

Nexa Doorbell push button - not triggering an event #48

Open olterman opened 5 months ago

olterman commented 5 months ago

So the device now shows up as an entity in HA but the sensor is always on (this is a Nexa issue aand not an issue with this HA implementation ) however it should still trigger a state change event each time its pushed updating the last time triggered.

In the logs I get:

2024-06-03 21:21:40.785 DEBUG (MainThread) [custom_components.nexa_bridge_x.nexa] [LLyDHieHFLqEERa3] Updating 'notificationPushButton' from value -> True  

this is in the section:

"lastEvents": {
  "notificationPushButton": {
    "value": true,
    "prevValue": true,
    "time": "2024-06-03T14:35:26.816Z",
    "name": "notificationPushButton"
  }
}

somehow we need to be able to check the time so that we can see that it's been changed .... maybe this just reflects my poor command of how to use HA ... but since the value is always true and the prev value is always true all that is changing is time

I dunno if this can be fixed on "our" side of things but if it can I think it'll be about a 100 years before nexa fixes so the button switches to off when its not pushed.

andersevenrud commented 5 months ago

Is this still an issue after the release of #47 ?

andersevenrud commented 5 months ago

Just to explain my change in that PR and why.


This integration holds a map of all the capabilities that the Nexa Bridge reports, which is referenced in the "events" given by any device.

I've just gone with whatever is documented officially and then add anything they forgot whenever I get an issue here on Github. Just like the one you found and was added in that PR :)

This should in turn make the entities inside HA work as expected because now the integration is aware of all of the capabilities and translates the events into something HA understands.

somehow we need to be able to check the time so that we can see that it's been changed

FYI: There are two update mechanisms in this integration:

  1. The poll, which happens every minute (or whatever is configured) over bridge HTTP API
    • This is what discovers all of your devices
    • This is also a fallback in case 2 is not working
  2. Reading push messages over the bridge Websocket
    • This is what gives the instant HA entity updates when a device state changes

Both of these compares the timestamps in the event to ensure the latest one is used.

olterman commented 5 months ago

OK so ... Now if I reload the integration the state switches to unknown, when i push the button it turns to on and stays on until the next reload. if i push the button more times, technically it should register a new state (even though the new state is also on) however no event is triggered after the first.

in the log I see this line:

2024-06-03 22:38:59.768 DEBUG (MainThread) [custom_components.nexa_bridge_x.nexa] [LLyDHieHFLqEERa3] Ignoring 'notificationPushButton' from node 

I dont know if that has any significance

olterman commented 5 months ago

Oh and just to add, in the nexa bridge app I get a notification that the button is pushed and last event time updated.

andersevenrud commented 5 months ago

Okay, so if I understand things correctly:

Is it always stuck in on on state in the "lastEvents" if you don't touch it from HA ?


It could be useful to enable this debug line to see if there are any push messages related to the device:

https://github.com/andersevenrud/ha-nexa-bridge-x/blob/335d4b99b5d3fd235a07b8755abcb5d04bcef18f/custom_components/nexa_bridge_x/nexa.py#L654


in the log I see this line: 2024-06-03 22:38:59.768 DEBUG (MainThread) [custom_components.nexa_bridge_x.nexa] [LLyDHieHFLqEERa3] Ignoring 'notificationPushButton' from node

I dont know if that has any significance

This would mean that an update did not yield any new value (timestamp is the same as last time).

andersevenrud commented 5 months ago

Oh, if I remember correctly, you updated from 1.7 to 2.x firmware right ? Did you do a fresh setup after that without legacy mode enabled ?

If not, I'd highly recommend doing so.

andersevenrud commented 5 months ago

I dunno if this can be fixed on "our" side of things but if it can I think it'll be about a 100 years before nexa fixes so the button switches to off when its not pushed.

If the Nexa app is reporting things correctly then there should be a way to solve it inside this integration. Looking at your log in #6 this seems like it's maybe not a z-wave device ?

olterman commented 5 months ago

so, Yes I updated to 2.4 so no more legacy, secondly yes I deleted the integration and started from scratch after upgrade.. three after uncommenting the logging line I keep getting this

2024-06-04 00:00:52.642 DEBUG (MainThread) [custom_components.nexa_bridge_x.nexa] [SZCDnYfym32tIA6t] Updating 'notificationPushButton' from value -> True 2024-06-04 00:00:54.536 DEBUG (MainThread) [custom_components.nexa_bridge_x.nexa] [SZCDnYfym32tIA6t] Updating 'notificationPushButton' from value -> True 2024-06-04 00:01:04.014 DEBUG (MainThread) [custom_components.nexa_bridge_x.nexa] [SZCDnYfym32tIA6t] Updating 'notificationPushButton' from value -> True 2024-06-04 00:01:07.882 DEBUG (MainThread) [custom_components.nexa_bridge_x.nexa] [SZCDnYfym32tIA6t] Updating 'notificationPushButton' from value -> True 2024-06-04 00:01:09.886 DEBUG (MainThread) [custom_components.nexa_bridge_x.nexa] [SZCDnYfym32tIA6t] Updating 'notificationPushButton' from value -> True

olterman commented 5 months ago

going to bed now will pick this up on thurssday after I celebrate my daughters graduation from highschool :)

andersevenrud commented 5 months ago

after uncommenting the logging line I keep getting this

If you expected to see "False" here at any point then this surely is some kind of firmware bug. There are some undocumented API endpoints that I've discovered that might help in this situation.

But what would be of enormous value would be some kind of recording with browser devtools of what's going on inside the Nexa App (more spesifically the Web UI they provide directly on the bridge) to see how they do the value updates.

going to bed now will pick this up on thurssday after I celebrate my daughters graduation from highschool :)

Time to hit the sack here as well. Looking forward to hear back from you. I'll do some digging on my end.

And the best of wishes to you and yours!

andersevenrud commented 5 months ago

NOTE TO SELF: There might be a push message with an unknown pattern, which would be ignored in the debug log. Provide an example on how to get a dump of any message.