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

HA MQTT availability is fragile #907

Closed
giorgi1324 opened this issue Jul 8, 2023 · 3 comments
Closed

HA MQTT availability is fragile #907

giorgi1324 opened this issue Jul 8, 2023 · 3 comments

Comments

@giorgi1324
Copy link

Hi, thanks for this amazing project!

I found that MQTT availability announcement logic in wyze-bridge doesn't play well with home assistant.

If I followed the code correctly, wyze-bridge announces itself as available on wyzebridge/state only when it starts. If home assistant misses this announcement because of the startup sequence of the services, then the camera entities stay unavailable in homeassistant until I manually docker-compose restart wyze-bridge. I found that the same happens if I restart mqtt broker but keep HA and wyze-bridge alive.

I think there are a couple of options around this issue:

  1. Periodically announce "online" on wyzebridge/state instead of doing this once on start.
  2. Listen for HA "birth message" which by default it announces on homeassistant/status topic.

I think the first option is better because it's agnostic of the who's listening on the other side but I'm not the owner of this project so the call is not mine.

Cheers!

mrlt8 added a commit that referenced this issue Jul 9, 2023
mrlt8 added a commit that referenced this issue Jul 9, 2023
* Update bridge status #907

* Update bridge status on HA status online #907

* Changelog
@mrlt8
Copy link
Owner

mrlt8 commented Jul 13, 2023

This should be fixed in v2.3.10, and will attempt to update the status every 15 seconds and when the homeassistant/status changes to online.

@giorgi1324
Copy link
Author

You the man!

@jhansche
Copy link
Contributor

Just wanted to point out that this does not appear to resolve the problem of entities remaining unavailable after any of: a) MQTT broker restart, b) MQTT integration reload, or c) HA restart. The wyzebridge/state=online message does not actually fix the unavailable entities. It may work if the integration remembers the availability topic for that entity, but after the integration is reloaded, it does not remember that, and re-sending the /state topic does not fix the unavailable entities.

I've confirmed by listening to both the homeassistant/status topic and the wyzebridge/state topic, that when I reload the MQTT integration, I get:

  • homeassistant/status=offline
  • homeassistant/status=online
  • wyzebridge/state=online

Yet even after wyzebridge/state=online, the unavailable entities remain unavailable, despite wyzebridge/state being the default for most discovered entities' availability_topic.

I opened #920 before I saw this issue, but I believe the suggestions in #920 are what we actually need to do to fix this (re-publish discovery after HA status becomes "online").

mrlt8 added a commit that referenced this issue Jul 20, 2023
* cache build

* Catch and disable MQTT on name resolution error

* Doorbell quick response

* Set camera time zone #916

* Set timezone on camera #916

* OSD toggle for logo/timestamp

* Add K10006 auth #742

* Fix /time_zone/get and return offset #916

* convert TZ offset to hours #916

* custom video filter #919

* Resend discovery message on HA online #907 #920

* Revert K10006 for WYZEDB3 #742

* Add more MQTT entities #921 #922

* Return json response/value for commands #835

* Fix threading issue on restart #902

* Fix SET cruise_points over MQTT

* SET cruise_point #835

* split into multiple jobs

* changelog
mrlt8 added a commit that referenced this issue Jul 22, 2023
mrlt8 added a commit that referenced this issue Jul 24, 2023
* Start from index 1 for cruise_point/waypoint #835

* update_snapshot via MQTT

* fix camera status always online #907 #920

* Additional MQTT entities #921

* QSV related changes

* i965-va-drivers #736

* FIX power status #921

* Fix cruise_point type #921

Thanks @jhansche

* return index from command payload #921

* Update docker-image.yml

* Monitor and set preferred bitrate #929

* Default to `-` for cruise_point #921

* clear out stale entities #921

* changelog
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

3 participants