hacs-hafas icon indicating copy to clipboard operation
hacs-hafas copied to clipboard

Harmonize unknown or unavailable sensor states

Open akloeckner opened this issue 9 months ago • 1 comments

Interesting observation: my sensor was "unknown" while the other one was "unavailable". I restarted home assistant and mine became unavailable, too. Something to harmonize in a future update...

See #30

akloeckner avatar Feb 23 '25 14:02 akloeckner

I would say, the sensor should be unknown, when no connections are found. It should be unavailable when an error occurs.

See for setup errors: https://developers.home-assistant.io/docs/integration_setup_failures#integrations-using-async_setup_entry

And we can set self._attr_available = True. See here: https://developers.home-assistant.io/docs/core/entity#example

akloeckner avatar Mar 06 '25 12:03 akloeckner