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

Add Home Assistant birth/will support #36

Open
raetha opened this issue Jul 23, 2020 · 2 comments
Open

Add Home Assistant birth/will support #36

raetha opened this issue Jul 23, 2020 · 2 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Milestone

Comments

@raetha
Copy link
Owner

raetha commented Jul 23, 2020

Describe the solution you'd like
Home Assistant 0.113 added default MQTT birth and will message support. We should incorporate using that to trigger an automatic resend of discovery topics and last state topics for sensors. That will require adding storage of last state values in some way, possibly sensors.yaml.

This change, in theory, would eliminate the need to use retain with MQTT when implementation is for Home Assistant. I’ve personally had some issues with MQTT and retained topics where I occasionally have to dump Mosquitto’s persistent cache.

If OpenHab, or other platforms, support birth/will topics, then we should make the topic configurable and document defaults for known platforms.

Looking for feedback here before implementing, since this adds more disk writes to the host, and more MQTT communication.

@raetha raetha added documentation Improvements or additions to documentation enhancement New feature or request labels Jul 23, 2020
@raetha raetha added this to the 1.2 milestone Jul 23, 2020
@dale3h
Copy link
Contributor

dale3h commented Jul 23, 2020 via email

@raetha
Copy link
Owner Author

raetha commented Jul 25, 2020

Certainly open to looking at something like SQLite, I was mostly thinking YAML is easy to read and debug, whereas a true database takes more effort, especially for someone less tech savy. A decent UI would solve that problem though (assuming we get motivated enough to do it. Though it could also be a new YAML file, something like sensor_states.yaml.

On the disk writes front, I'm less concerned, I just know with RPi's and SD cards, frequent excessive writes wear them out faster. So I wanted to mention it as a discussion item. Certainly could have it be another thread on a cycle though, and a few states being lost wouldn't be the end of the world, if the sensors trigger frequently enough.

I can appreciate the thoughts on an initial state, my concern would be an example like:

  • "Living Room Window is open", MQTT shows window is open
  • WS2MQTT restarts, default states sent
  • "Living Room Window is still open", MQTT shows window is closed

It certainly could just be an optional value, but if it got used could wreck all sorts of havoc with automations and the like. I think there will always be the risk that if WS2MQTT restarts or is off, a sensor event gets missed and things get out of sync, but since we can't actually poll the sensors (as far as I know) to see their current state, I don't think we can do much about that scenario.

@raetha raetha modified the milestones: 1.2, 2.0 Jul 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants