I have a nodemcuv2 flashed with ESPhome and a PIR motion sensor in the bedroom and a sonoff basic also flashed ESPhome wired to a light in the hall. Everything works. I created an automation using the editor to turn the hall light on when motion is detected at night and turn it off after 10 minutes no motion. The automation fails. Can anybody see what is wrong with this automation. I have been all over the help files. The config validates.
- id: '1587479986727'
alias: Night Light
description: turn on hall light when motion detected in bedroom
trigger:
- entity_id: binary_sensor.bedroom_motion
platform: state
to: 'ON'
condition: []
action:
- data:
entity_id: switch.hall_light_relay
entity_id: switch.hall_light_relay
service: switch.turn_on
- alias: Turn off hall light 10 minutes after last movement
trigger:
- entity_id: binary_sensor.bedroom_motion
for: 0:10:00
platform: state
to: 'off'
action:
- entity_id: switch.hall_light_relay
service: switch.turn_off
id: 05d0ada90893403cbf5986579112f6a6