I’ve created an automation too - I’d like the switch to turn off once the templated sensor has been in the “Low Power” state for 30 mins.
- id: '9C89A2AE-71F4-4C25-957A-896F4C954212'
alias: "Charging Station / Off"
trigger:
- entity_id: sensor.charging_station_status
platform: state
to: 'Low Power'
for:
minutes: 30
action:
- service: switch.turn_off
data:
entity_id:
- switch.study_charging_station
This used to work (I don’t think I’ve changed anything), but it doesn’t anymore. I’ve validated the entity names, and in Lovelace the “last changed” value of the charging status sensor is more than the required 30 mins.
I’m sure I’m missing a trick … would someone be able to please point me in the right direction?
The quotes just ensure the text is a string, so you’re good there. Everything looks good. I noticed you don’t have an initial state set for the automation, so is the automation on?
I don’t normally turn automations off, which was why I didn’t set an initial state, but the more I think about it the more I realise it won’t hurt. I’ll go back at some point and add that in.
Looking in Dev Tools / States, both charging station automations are on.
Apparently charging station off was last triggered 2 days ago (least it’s been triggered?!) but that doesn’t explain why it’s not triggering now.
It was user error. When rebooting Home Assistant, the sensors would very briefly change to “Unknown” and would throw everything off. A few tweaks later and I’m back up and running.