I am trying to detect when the robot vacuum hasn’t been in the cleaning
state for at least 12 hours. I want to check this at a specific time each day. My issue with the commonly suggested options is that the vacuum has several states (charging, docked, unknown), that I do not care for.
So if I use last_changed
, it might be skewed by the robot reporting leaving the charging state and entering the docked state.
I imagine that for this, I would have to use a history_stats
template, but am unsure how to define it, as they seem to require a specific state.
Here’s what I have so far:
sensor:
- platform: history_stats
name: Time since last clean
entity_id: vacuum.brenda
state: "cleaning"
type: time
start: "No clue what should go here. Not states.vacuum.brenda.last_changed, as that would be influenced by the charging and docked states"
end: "{{ now() }}"