ElectricBrainUK / UnraidAPI

A WIP open source Node JS API for controlling UNraid
GNU General Public License v3.0
125 stars 13 forks source link

I have 2 Suggestions to prevent "unknown" status after HA restart. #54

Open okets opened 1 year ago

okets commented 1 year ago

Is your feature request related to a problem? Please describe. Every time HA restarts all dockers are in an "unknown" status until the MQTT refresh timer (default 1 hour) updates them.

Describe the solution you'd like It can be prevented in one of two ways: 1) add "retain=true" to your MQTT messages, It will save the last value and survive HA restarts. 2) you are already connected to the MQTT broker, you can subscribe to the home assistant start event and force a refresh. Any of the two suggestions above will work, but implementing both will work great!

Describe alternatives you've considered My alternatives right now is sending a command to Unraid to restart your docker when HA starts (ugly but works) if you won't implement the change above, my next solution will be re-sending your mqtt messages with a retain=true flag through an automation.

Additional context When your docker sensors are in "unknown" state, some of my dashboards doesn't work because I am using missing attributes that only shows up after the next mqtt message that you send. An addon that is mainly used for Home assistant should survive HA restarts. My solutions are very easy to implement, Let me know if you need help.