Files
fresh-home/automations/rooms/garage/garage_lights_to_on.yaml
T
2025-02-10 15:08:18 -05:00

136 lines
3.8 KiB
YAML

alias: Garage Lights to On
id: automation_garage_lights_to_on
mode: single
# Hide warnings when triggered while in delay.
max_exceeded: silent
trigger:
- platform: state
id: "occupied"
entity_id: input_boolean.garage_occupied
to: "on"
- platform: state
id: "too_dim"
entity_id: binary_sensor.garage_naturally_lit
from: "on"
to: "off"
# - platform: state
# id: "motion"
# entity_id: group.garage_motion
# from: "off"
# to: "on"
- platform: state
id: "garage_door_opened"
entity_id: binary_sensor.garage_door
from: "off"
to: "on"
- platform: state
id: "garage_door_closed"
entity_id: binary_sensor.garage_door
from: "on"
to: "off"
- platform: state
id: "doors_open"
entity_id:
- binary_sensor.inner_garage_door
- binary_sensor.inner_garage_door_contact
- binary_sensor.outer_garage_door
- binary_sensor.outer_garage_door_contact
from: "off"
to: "on"
- platform: state
id: "doors_closed"
entity_id:
- binary_sensor.inner_garage_door
- binary_sensor.inner_garage_door_contact
- binary_sensor.outer_garage_door
- binary_sensor.outer_garage_door_contact
from: "on"
to: "off"
- platform: state
id: "workshop_motion"
entity_id: group.workshop_motion
from: "off"
to: "on"
# Only turn on the lights when necessary
condition:
- alias: Check if the lights should turn on
condition: or
conditions:
- alias: "Garage door was opened"
condition: trigger
id: "garage_door_opened"
- alias: Check if the light should turn on when the home is occupied
condition: and
conditions:
- alias: "Home is occupied"
condition: state
entity_id: input_boolean.home_occupied
state: "on"
- alias: "Check if light should turn on"
condition: or
conditions:
- alias: "Guest mode is on"
condition: state
entity_id: input_boolean.guest_mode
state: "on"
- alias: "Motion in dark garage, or workshop regardless of light level"
condition: or
conditions:
- alias: "Motion or occupancy were detected in a dim room"
condition: and
conditions:
- alias: "Room not naturally lit"
condition: state
entity_id: binary_sensor.garage_naturally_lit
state: 'off'
- alias: "Motion, occupancy, or door opening were detected"
condition: or
conditions:
- alias: "Motion was detected"
condition: trigger
id: "motion"
- alias: "Occupancy was detected"
condition: trigger
id: "occupied"
- alias: "Occupancy was detected"
condition: trigger
id: "doors_open"
- condition: state
entity_id: input_boolean.garage_occupied
state: "on"
- alias: "Motion in the workshop"
condition: and
conditions:
- condition: trigger
id: "workshop_motion"
- condition: state
entity_id: input_boolean.garage_occupied
state: "on"
action:
- alias: "Make sure Z-Wave switch is turned on"
service: homeassistant.turn_on
target:
entity_id: switch.garage_switch
- delay: 1