Hey people,
I got two sensors for my front door and security gate
I setup an automation that if the front door opens, and if the security gate is open then to turn on the light. (incase the gate is open then the light will turn on. but if we open the front door to allow air to come in the house and the gate is closed to not turn on the light)
Now the second automation is for the security gate.
if the front door is closed then turn on the light.
if the front door is open, but the first automation was not triggered then turn on the light.
if the front door is open but the first automation was triggered then do nothing.
can anyone help with this ?
First automation:
alias: Front door light (contacts)
description: ''
trigger:
- type: opened
platform: device
device_id: a7223aaa6640076ed71b7924d11f5ebb
entity_id: binary_sensor.front_door_contact
domain: binary_sensor
condition:
- condition: sun
before: sunrise
after: sunset
- type: is_open
condition: device
device_id: e09a646bed9be9ed622d1f61d33f596a
entity_id: binary_sensor.front_door_gate_contact
domain: binary_sensor
- condition: device
type: is_off
device_id: 4c968000db6a8557e6b1fc6253344c42
entity_id: switch.sonoff_mini_fd_2
domain: switch
action:
- type: turn_on
device_id: 4c968000db6a8557e6b1fc6253344c42
entity_id: switch.sonoff_mini_fd_2
domain: switch
- delay:
hours: 0
minutes: 1
seconds: 20
milliseconds: 0
- condition: device
type: is_on
device_id: 4c968000db6a8557e6b1fc6253344c42
entity_id: switch.sonoff_mini_fd_2
domain: switch
- type: turn_off
device_id: 4c968000db6a8557e6b1fc6253344c42
entity_id: switch.sonoff_mini_fd_2
domain: switch
mode: single