I am trying to build an automation/script that can turn on/off my lights. I am using an ESP Human Presence device that I would like to turn on/off my lights when presence is detected or not.
This is the current script I have:
alias: Master Lights On/Off
sequence:
- if:
- type: is_occupied
condition: device
device_id: c972ad9670833a69ce359ea2a05f9f35
entity_id: dd4166a965e0ba723d26674d34dc3d69
domain: binary_sensor
- condition: and
conditions:
- condition: time
after: "17:00:00"
before: "01:00:00"
then:
- service: light.turn_on
metadata: {}
data: {}
target:
entity_id:
- light.laineys_bedroom_main_lights
else:
- if:
- type: is_not_occupied
condition: device
device_id: c972ad9670833a69ce359ea2a05f9f35
entity_id: dd4166a965e0ba723d26674d34dc3d69
domain: binary_sensor
- condition: and
conditions:
- condition: time
after: "17:00:00"
before: "01:00:00"
then:
- service: light.turn_off
metadata: {}
data: {}
target:
entity_id: light.laineys_bedroom_main_lights
mode: parallel
icon: mdi:lightbulb-multiple-outline
max: 2
Is my idea achievable with this script?
Thank you.
Edit: I have it to do the automation/script at certain times only as you can see.