Hi,
Playing around with one of my first automations and wanting to have the execution of one automation dependent on whether another is enabled. Searched for ages on the forum and couldn’t find an answer, and the following doesn’t appear to work:
- id: lights_night_sensor_on
alias: 'Night light Sensor - 11pm to Dawn'
trigger:
platform: state
entity_id:
- binary_sensor.wemo_motion_kitchen
- binary_sensor.wemo_motion_hallway
from: 'off'
to: 'on'
condition:
condition: or
conditions:
- condition: time
after: '23:10:00'
- condition: sun
before: sunrise
action:
service: switch.turn_on
entity_id:
- switch.wemo_switch_dining
- switch.wemo_switch_hallway
- id: lights_night_sensor_2min_off
alias: 'Night light Sensor - 2mins off'
hide_entity: True
trigger:
platform: state
entity_id:
- binary_sensor.wemo_motion_kitchen
- binary_sensor.wemo_motion_hallway
from: 'on'
to: 'off'
for:
minutes: 2
condition:
- condition: state
entity_id: automation.lights_night_sensor_on
state: 'on'
action:
service: switch.turn_off
entity_id:
- switch.wemo_switch_dining
- switch.wemo_switch_hallway
The lights turn on with motion detection, and without the automation condition on the light off after 2 mins automation, it fires fine. With the condition set, nothing happens. I only want it to turn the lights off after 2 minutes if the automation to turn them on with the sensor is actually active.
The use of the automation state seems to be false in the automation, even though its enabled.