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

deviceAvailability publishes message even if there is no change in availability #2296

Closed
sjorge opened this issue Nov 8, 2019 · 4 comments
Closed

Comments

@sjorge
Copy link
Contributor

sjorge commented Nov 8, 2019

Bug Report

What happened

I configured availability_timeout of 300 (5 minutes) as I am really only interested in the polling of the color after some of my hue bulbs lose power.

  • startup: each device publishes the available = online
  • active devices that keep publishing message: no update of available state because timer keeps getting reset (great)
  • devices that don't publish often: publishes available = online after interval
  • device goes offline: publishes available = offline after interval
  • device comes online: publishes available = online + query all properties (yay)

What did you expect to happen

I would expect NOT to get an available = online repeat message in the if one was already sent.

Currently devices like the ikea repeater publish the available message every 5 minutes due to the timer, other bulbs that publish reports never post available = online after the one at startup.

How to reproduce it (minimal and precise)

Set a long timeout and you'll notice if you have devices that are very active vs one that are not.

Debug Info

zigbee2mqtt version: 1.6.0 (commit #00bc4de)
CC253X firmware version: {"type":"zStack12","meta":{"transportrev":2,"product":0,"majorrel":2,"minorrel":6,"maintrel":3,"revision":20190425}}

@sjorge
Copy link
Contributor Author

sjorge commented Nov 8, 2019

This doesn't seem to hard to fix, I will open a PR for this next week when i have a bit more time. (Probably on monday)

The current idea is to a hash with the name -> availability mapping and then check here if the current state differs from the stored one. If so publish and update the hash.

That way we should only get available mqtt message when the state has changed.

@sjorge
Copy link
Contributor Author

sjorge commented Nov 9, 2019

Better yet, it seems this info is already available in this.state. Will do some more digging around the extension to understand it better to implement it as cleanly as I can.

@sjorge
Copy link
Contributor Author

sjorge commented Nov 9, 2019

PR opened, the change was minimal

@Koenkk
Copy link
Owner

Koenkk commented Nov 10, 2019

Thanks! merged, therefore closing this.

@Koenkk Koenkk closed this as completed Nov 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants