I would like to implement that the last successful state is reported for an hour even if the last update() fails. However after that timeout the state should go to “unavailable”. This behavior would be for a flower care sensor (miflora) where the values don’t change rapidly, so it would be OK if not every update() query is successful. Are there other sensors which have implemented a similar logic?
I’m thinking about:
- Is it possible to update last_update only if the update() is successful? So, I could check in avaiable():
if self.last_update < now() - last_successful_timeout: return False - Do I have to implement my own last_successful_update variable? Is there a recommended way - for example using device_state_attributes() ?
Thanks!