So I have a couple of automations that are conflicting and not working together. I live alone so I don’t have to worry about SO.
I’m trying to do:
A) When home, after sunset turn on all_lights group.
B) When arriving home, after sunset, unlock the front door, turn on all_lights group.
C) After sunset, If bedroom sensor is occupied after 5 minutes turn off all_lights group.
arriveHome:
alias: arriveHome
description: Arrive Home
trigger:
- platform: zone
entity_id: person.me
zone: zone.home
event: enter
condition:
- condition: state
entity_id: sun.sun
state: below_horizon
action:
- service: lock.unlock
data: {}
target:
entity_id: lock.front_door
- service: switch.turn_on
data: {}
target:
entity_id: switch.alllights
mode: single
lightcontrol:
alias: lights-control
description: Lights Control
trigger:
- platform: time_pattern
minutes: /5
condition: []
action:
- choose:
- conditions:
- condition: sun
after: sunrise
sequence:
- service: switch.turn_off
data: {}
target:
entity_id: switch.alllights
- conditions:
- condition: state
entity_id: binary_sensor.sleepnumber_master_bedroom_aram_is_in_bed
state: "off"
- condition: sun
after: sunset
after_offset: "-00:30:00"
before: sunset
before_offset: "00:15:00"
sequence:
- service: switch.turn_on
data: {}
target:
entity_id: switch.alllights
default: []
mode: single
turn off lights:
alias: Turn off lights when in Bed
description: ""
trigger: []
condition:
- condition: state
entity_id: binary_sensor.sleepnumber_master_bedroom_aram_is_in_bed
state: "on"
for:
hours: 0
minutes: 5
seconds: 0
attribute: device_class
action:
- service: switch.turn_off
data: {}
target:
entity_id: switch.alllights
mode: single
Any help in the conflict between A&C or general improvements would be appreciated.