1
0
Fork 0
ha-config/config/packages/offices.yaml

104 lines
3.1 KiB
YAML
Raw Normal View History

2022-05-11 16:41:13 +10:00
# If door opens when sun is down, turn lights on
# If sun sets and door is open or presense detected, turn lights on
# If lights on but no presence for one hour, turn lights off
# When lights turned off, turn off desk and couch plugs
# When lights turned on, turn on desk and couch plugs
# When bo leaves home, turn off desk plug
# When everybody leaves home, turn off couch plug
automation:
- id: a1459b6c502b7d9df65a101dd31c9c55f164388c
2022-05-12 14:27:42 +10:00
alias: Turn on Bo's office when door opened or motion detected
2022-05-11 16:41:13 +10:00
trigger:
- platform: state
2022-05-12 14:27:42 +10:00
entity_id:
- binary_sensor.bo_s_office_door_contact
- binary_sensor.bo_s_office_motion
2022-05-11 16:41:13 +10:00
from: "off"
to: "on"
action:
# - if:
# - "{{ is_state('sun.sun', 'below_horizon') }}"
# then:
- service: light.turn_on
data:
transition: 0.25
2022-05-12 14:27:42 +10:00
kelvin: 3000
2022-05-11 16:41:13 +10:00
brightness_pct: 100
target:
area_id: bo_s_office
- service: switch.turn_on
target:
area_id: bo_s_office
2022-05-12 14:27:42 +10:00
- id: 8a32a559bfcf43ddfd6ec03a8071eecfbf8161bb
alias: Turn off Bo's office if no motion for a while
trigger:
- platform: state
entity_id: binary_sensor.bo_s_office_motion
from: "on"
to: "off"
for:
minutes: 15
2022-05-13 08:27:25 +10:00
condition: "{{ is_state('binary_sensor.bo_s_office_is_occupied', 'off') }}"
2022-05-12 14:27:42 +10:00
action:
- service: light.turn_off
target:
area_id:
- bo_s_office
- if:
- "{{ is_state('binary_sensor.bo_s_office_door_contact', 'off') }}" # closed
then:
2022-05-13 08:27:25 +10:00
- if:
- or:
- "{{ is_state('sensor.bandersnatch_displays', '1') }}"
- not: "{{ is_state('device_tracker.bandersnatch_hass', 'home') }}"
then:
- service: switch.turn_off
target:
entity_id: switch.bo_s_desk_plug
2022-05-12 14:27:42 +10:00
- service: switch.turn_off
target:
2022-05-13 08:27:25 +10:00
entity_id: switch.bo_s_office_plug
2022-05-12 14:27:42 +10:00
2022-05-11 16:41:13 +10:00
- id: 2d1034acdee3afde7b67224b4898bd87b5cd356c
alias: Turn on Ri's office when door opened
trigger:
- platform: state
entity_id: binary_sensor.ri_s_office_door_contact
from: "off"
to: "on"
action:
- if:
- "{{ is_state('sun.sun', 'below_horizon') }}"
then:
- service: light.turn_on
data:
transition: 0.25
2022-05-12 14:27:42 +10:00
kelvin: 3000
2022-05-11 16:41:13 +10:00
brightness_pct: 100
target:
area_id: ri_s_office
- service: switch.turn_on
target:
area_id: ri_s_office
- id: b3f8aa9d20fee297accbd6aad27ba29c28aa02dc
alias: Turn off offices when in bed
trigger:
- platform: state
entity_id: group.everyone_in_bed
to: "on"
for:
minutes: 5
action:
- service: light.turn_off
target:
area_id:
- bo_s_office
- ri_s_office
- service: switch.turn_off
target:
area_id:
- bo_s_office
- ri_s_office