Hi all, this is my first automation setup and I’m having trouble with the hass syntax I think. What I’d like to do is pretty basic - when someone arrives home (triggered by Life360 through IFTTT) and it’s after sunset, turn on a switch (ESP8266 homemade switch activated through a curl command) for 5 minutes, then turn off.
Here’s what I have so far, not working obviously. Anyone any suggestions?
#SCRIPTS
script:
porchlight_timer:
alias: Entryway Light Timer
sequence:
- event: LOGBOOK_ENTRY
event_data:
name: Entryway Light
message: is turned ON
entity_id: switch.zsoltswitch
domain: switch
- alias: Entryway Light Turns ON
service: switch.turn_on
data:
entity_id: switch.zsoltswitch
- delay:
minutes: 5
- alias: Entryway Light Turns OFF
service: switch.turn_off
data:
entity_id: switch.zsoltswitch
#AUTOMATION
automation:
alias: 'P1 arrived home after dark'
# IFTTT sends trigger
trigger:
platform: event
event_type: p1ArrivedHome
condition:
platform: state
entity_id: sun.sun
state: 'below_horizon'
action:
service: porchlight_timer