I have the following automation that switches off my lightstrip when my PC is shutdown but only after 2 minutes. For reference the switch used in my automation is a WOL script.
- alias: Office Lights off when PC shutdown
initial_state: true
hide_entity: false
trigger:
- platform: state
entity_id: switch.gamingpc
from: 'on'
to: 'off'
- platform: state
entity_id: device_tracker.gamingpc
state: 'not_home'
condition:
- condition: state
entity_id: device_tracker.gamingpc
state: 'not_home'
for:
hours: 0
minutes: 2
seconds: 0
action:
service: light.turn_off
entity_id: light.desk_lightstrip
My problem is the device tracker takes a long time to update so it can be up to 10 minutes before the light goes off. I tried to make the condition the switch entity state however the value “for” wasnt valid for this config.
Any ideas on how to make this better?