bachya / ecowitt2mqtt

Send data from Fine Offset weather stations (Ecowitt, Ambient Weather, Froggit, etc.) to MQTT!
MIT License
207 stars 43 forks source link

Home Assistant MQTT Config Lost (Awkward Retain Situation...) #1028

Closed MaJaHa95 closed 1 week ago

MaJaHa95 commented 2 months ago

Is your feature request related to a problem? Please describe. I've been having trouble lately where Home Assistant loses the MQTT configuration from ecowitt2mqtt. The whole thing is a little frustrating (why can't HA just persist it? is there a workaround?), but it's not ecowitt2mqtt's fault.

The simple answer to my woes is to set the retain flag and let my MQTT broker handle the rest.

The issue is that I'm using RabbitMQ as my MQTT broker (for reasons), and RabbitMQ doesn't really handle retained messages in clustered environments. There are workarounds, but nothing I'm too keen to dive into right this moment.

Describe the solution you'd like I have a couple ideas that aren't too outlandish, I believe.

  1. I've heard that it's good practice for MQTT publishers to react to homeassistant/status by republishing config, but I don't actually know if that would solve my problems.
  2. For a more broadly-applicable solution, what if there was an endpoint for ecowitt2mqtt that forced it to republish? Then I could even go nuts and set up an automation that automatically called it if a sensor went unavailable for some amount of time.

Additional context I'm very open to recommendations too. I'm sure I don't know everything about RabbitMQ, MQTT, ecowitt2mqtt, nor indeed Home Assistant. If anyone has ideas of how I can work around these issues, I'm all ears. The most correct solution would be for me to set up RabbitMQ to share retained messages across the cluster, but I see these workarounds as being independently valuable additions to ecowitt2mqtt, so I figured I'd pitch them.

bachya commented 1 month ago

Thanks for your patience.

For a more broadly-applicable solution, what if there was an endpoint for ecowitt2mqtt that forced it to republish? Then I could even go nuts and set up an automation that automatically called it if a sensor went unavailable for some amount of time.

Is the idea here that this new endpoint would simply republish whatever the most recently received payload was?

github-actions[bot] commented 2 weeks ago

There hasn't been any activity on this issue recently, so it has been marked as stale. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment. This issue will be closed if no further activity occurs. Thanks!