Hi,
I have a cupboard with a LED strip in it, i have an esp setup with two magnetic sensors on the doors, left and right door.
I want the light on when either of the doors are open and the light off when either are shut
I have this automation, which works well for doors open, but does not for doors closed, so i need to split this out into its own automation or can it all be done in one?
alias: Office Cupboard LED Strip
description: Turns on LED strip if cupboard doors are opened.
trigger:
- platform: state
entity_id:
- binary_sensor.left_door_status
from: "off"
to: "on"
- platform: state
entity_id:
- binary_sensor.right_door_status
from: "off"
to: "on"
condition:
- condition: state
entity_id: switch.powerboard_pb89ha_socket_1
state: "off"
action:
- service: switch.turn_on
data: {}
target:
entity_id: switch.powerboard_pb89ha_socket_1
- if:
- condition: state
entity_id: binary_sensor.left_door_status
state: "off"
- condition: state
entity_id: binary_sensor.right_door_status
state: "off"
then:
- service: switch.turn_off
data: {}
target:
entity_id: switch.powerboard_pb89ha_socket_1
mode: single