3 ms·
I'm pretty sure home assistant has at least one way to find out how long it's been since there was a state change on something. In fact I know it does, because
by KennyBlanken 2y ago
I'm pretty sure home assistant has at least one way to find out how long it's been since there was a state change on something. In fact I know it does, because I have a toggleable control one of my outlets to limit its maximum on time.
This might get you started:
https://www.google.com/search?q=home+assistant+time+since+last+change https://www.google.com/search?q=home+assistant+time+since+la...
Here's one example: https://community.home-assistant.io/t/show-time-since-last-state-change-in-lovelace/180893 https://community.home-assistant.io/t/show-time-since-last-s...
Here's another: https://community.home-assistant.io/t/get-difference-from-now-to-last-changed-in-minutes/569588 https://community.home-assistant.io/t/get-difference-from-no...
Hope this helps!
- Nextgrid 2y agoDon't rely on this for any kind of interlocking or complex logic. They will get into an inconsistent/broken state sooner or later. I believe the "how long since a state change" only starts counting from the state change and within the same session. If the server restarts, the counter stops and will restart from scratch only from the next state change. This means if an automation relies on such timers to reset itself back to its idle state, a server restart will forever leave it in that state. Automations are nice for quick one-off actions but for anything that lasts more than a few seconds I'd suggest looking for alternatives. Something as complex as managing multiple devices with interdependent states is way too complex and is bound to go wrong even if you actually manage to express it in an automation (and don't give up because of the absolutely awful automation editor UI). Home Assistant is great as a proxy/aggregator to connect many different devices/protocols and expose them under a single, consistent API, but it's terrible at logic. For any kind of complex task I'd suggest making a stand-alone app that interacts with the Home Assistant API to observe device states and control them.
- metadat 2y agoIf you also have the target device hooked up to a smart outlet, you can easily reset it to known state, even if the target is IR only.