I have an automation that if the garage door is open the garage lights should be on. I also have an automation that if the door from the garage to the house is open the garage lights should be on. If both are open, the lights are on, which is great, but when the garage door shuts it overrides the door to the house being open and turns off the lights.
I’m looking for a way to have HA tell if one or both are open and keep the lights on in that case, but also know that if one is closed it still operates the same.
I hope this makes sense, let me know if you need more explanation. Would I do this with conditions, or is there a way to check device status so that it knows the door to the garage is still open keep the lights on?
There are number of ways you can do this automation, one would be the following. Here these are combined together with a choose type action. If you are an advanced user you can make use of templates to do this also.
alias: Garage Lights
description: ''
mode: single
trigger:
- platform: state
entity_id: sensor.home_door
- platform: state
entity_id: sensor.garage_door
condition: []
action:
- choose:
- conditions:
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.home_door
state: 'on'
- condition: state
entity_id: binary_sensor.garage_door
state: 'on'
sequence:
- service: switch.turn_on
target:
entity_id: switch.garage_light
- conditions:
- condition: and
conditions:
- condition: state
entity_id: binary_sensor.home_door
state: 'off'
- condition: state
entity_id: binary_sensor.garage_door
state: 'off'
sequence:
- service: switch.turn_off
target:
entity_id: switch.garage_light
default: []
I somehow managed to screw up my automation, now it won’t load when i go to configuraiton>Automation I get an Automaiton Load Error
- id: '1589151804789'
alias: Garage Lights at Night
description: Turn on Garage Lights if Garage Door or House door is open 15 minutes
before sunset and during darkness
mode: single
trigger:
- platform: state
entity_id: binary_sensor.house_garage_door_sensor_ias_zone
- platform: state
entity_id: binary_sensor.third_reality_inc_3rds17bz_ias_zone
condition:
- after: sunset
after_offset: -00:15:00
condition: sun
action:
- choose:
- conditions:
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.house_garage_door_sensor_ias_zone
state: 'on'
- condition: state
entity_id: binary_sensor.third_reality_inc_3rds17bz_ias_zone
state: 'on'
You havent specified any actions in the choose tyoe action.
These are just the conditions, after which you need to add actions.
You can copy the sample automation yaml that I provided earlier and just replace the entity ids with yours. It should work also please add the sunset condition in it.
If you want any more help, please do ask.
I hope I get what you mean, but I have the same situation. The difference is just that I have two tilt doors, not a tilt door and a normal door, but the same issue. You can use a property of groups to make this very simple. If any entity in a group is on, the group is on. If all are off, the group is off. So, make a group with your two entities and adapt my automations.
- alias: "Switch On Garage Light When The First Garage Door Opened"
# interesting edge case: if first cover opened before condition is true
# and then the second door after the condition will be true, the light
# won't turn on (e.g. 1h30 min before sunset). to solve this one needs
# to trigger on the individual state changes and have an xor condition.
initial_state: true
trigger:
platform: state
entity_id:
- group.garage_doors
to: "open"
mode: queued
condition:
# https://www.home-assistant.io/docs/scripts/conditions/#sunsetsunrise-condition
- condition: or
conditions:
- condition: sun
after: sunset
after_offset: "-01:30:00"
- condition: sun
before: sunrise
before_offset: "01:30:00"
action:
- service: light.turn_on
entity_id: light.garage_light
- alias: "Switch Off Garage Light When The Last Garage Door Closed"
initial_state: true
trigger:
platform: state
entity_id:
- group.garage_doors
to: "closed"
mode: queued
condition:
- condition: or
conditions:
- condition: sun
after: sunset
after_offset: "-01:00:00"
- condition: sun
before: sunrise
before_offset: "+01:00:00"
action:
- service: light.turn_off
entity_id: light.garage_light
So I have this correct in my mind. In plain English this automation does the following
Between 30 minutes before sunset and until sunrise the next day
If the garage door is open OR the door from the garage to the house is open, the garage switch will stay ON
Only if both the garage door AND the door from the garage to the house is closed, will the garage switch will stay OFF
This is not working for me currently. I have the garage door closed, the house door open, and its after susnet and the lights don’t come on. If i manually turn them on and shut the door to the house, they do not go off.
- id: '1637856127265'
alias: Test Conditions
description: Test Conditions for Garage Lights
trigger:
- platform: state
entity_id: binary_sensor.garage_door_sensor
- platform: state
entity_id: binary_sensor.house_garage_door_sensor
condition:
- condition: sun
before: sunrise
after: sunset
after_offset: '-30:00'
action:
- choose:
- conditions:
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.garage_door_sensor
state: 'on'
- condition: state
entity_id: binary_sensor.house_garage_door_sensor
state: 'on'
sequence:
- service: switch.turn_on
target:
entity_id: switch.garage
- conditions:
- condition: and
conditions:
- condition: state
entity_id: binary_sensor.garage_door_sensor
state: 'off'
- condition: state
entity_id: binary_sensor.house_garage_door_sensor
state: 'off'
sequence:
- service: switch.turn_off
target:
entity_id: switch.garage
default: []
mode: single