Dielee / volvo2mqtt

Home Assistant addon for connecting AAOS Volvos
MIT License
133 stars 27 forks source link

retain state messages #210

Closed luka6000 closed 4 weeks ago

luka6000 commented 1 month ago

Is your feature request related to a problem? Please describe. Restarting HAss makes all sensors and other attributes unavailable with state unknown. Config topics are retained. Why not retain state topics?

Describe the solution you'd like Please add 'retain' flag to state messages so that last known state read from volvo is retained in broker.

Describe alternatives you've considered Right now I'm restarting volvo2mqtt addon after hass startup to populate state of volvo sensors. It's also possible to press button.volvo_yv1zwk7v0r2631443_update_data after hass startup. Both solutions are bad because they eat up API request.

Additional context There is already a date attribute (sensor.volvo_yv1zwk7v0r2631443_last_data_update_raw) so retain flag will not blur the data or make it unreasonable.

Dielee commented 1 month ago

So how long is your update interval?

luka6000 commented 1 month ago

5mins. We can also ask "how often does one restarts hass?" But what happens when integration breaks and then you restart? Retain flag is reasonable here because all attributes are not events or signals/pulses but statefull data meaning they are valid up to the next successful reading. And you never know what happens next whether that is hass restart or integration failure (because api changed or network problem).

luka6000 commented 4 weeks ago

small update: button press after restart is not working because it's not available after startup. Probably because message on this topic volvoAAOS2mqtt/availability is not retained

Dielee commented 4 weeks ago

Done by version v1.9.5