I have an integration that has failed three times in the past week. Hitting reload fixes it. (Until the next time).
Since there is no service to reload an integration, I have been advised to use homeassistant.restart
(The next time the integration fails, I will try this).
So, assuming that homeassistant.restart fixes the issue (temporarily), here’s my idea.
Use an automation to monitor the value of the sensor entity from the integration. If the value does not change in five minutes, then trigger the homeassistant.restart service.
So, can I determine if a sensor value is unchanged for a given time?
How does this trigger differentiate from changing data? The data could be 101, 102, 103, 106, 110 over five minutes. If I understand triggers, these would all be valid. What I want to trigger on is if the value does not change in that timeframe.
I’ve never been able to make an automation. It’s my Kryptonite.
I seem to be the only person with this issue from this integration (Dexcom), so I don’t want to pull the alarm on the integration. (Though the code owner has disappeared).
That will trigger if the state doesn’t change for 5 minutes, as described here. for: can be used along with a to: state to only trigger on a specific state, or you can choose not to specify to: and it will just trigger when the entity remains in any state for a period of time.
OK, I think I get it. From the docs:
" In this example, the trigger fires if the state value of the entity remains the same for for the time specified, regardless of the current state value."
You can use homeassistant.reload_config_entry with a entity that the integration creates. This will reload the integration and you don’t need to restart the home assistant