217 lines
5.6 KiB
YAML
217 lines
5.6 KiB
YAML
homeassistant:
|
|
customize:
|
|
input_boolean.bathroom_activity_override:
|
|
persistent: true
|
|
input_select.room_state_bathroom:
|
|
persistent: true
|
|
|
|
script:
|
|
light_profile_bathroom_bright:
|
|
sequence:
|
|
# White temp lights
|
|
- service: light.turn_on
|
|
data:
|
|
brightness: 255
|
|
color_temp: 250
|
|
entity_id:
|
|
- light.bathroom
|
|
|
|
light_profile_bathroom_default:
|
|
sequence:
|
|
# White temp lights
|
|
- service: light.turn_on
|
|
data:
|
|
brightness: 255
|
|
color_temp: 250
|
|
entity_id:
|
|
- light.bathroom
|
|
|
|
light_profile_bathroom_dimmed:
|
|
sequence:
|
|
# White temp lights
|
|
- service: light.turn_on
|
|
data:
|
|
brightness: 127
|
|
color_temp: 370
|
|
entity_id:
|
|
- light.bathroom
|
|
|
|
light_profile_bathroom_ambient:
|
|
sequence:
|
|
# White temp lights
|
|
- service: light.turn_on
|
|
data:
|
|
brightness: 127
|
|
color_temp: 370
|
|
entity_id:
|
|
- light.bathroom
|
|
|
|
light_profile_bathroom_night:
|
|
sequence:
|
|
# White temp lights
|
|
- service: light.turn_on
|
|
data:
|
|
brightness: 1
|
|
color_temp: 455
|
|
entity_id:
|
|
- light.bathroom
|
|
|
|
light_profile_bathroom_off:
|
|
sequence:
|
|
# Primary RGB lights
|
|
- service: light.turn_off
|
|
data:
|
|
entity_id:
|
|
- light.bathroom
|
|
|
|
group:
|
|
light_profile_bathroom:
|
|
entities:
|
|
- binary_sensor.bathroom_activity
|
|
- input_boolean.bathroom_activity_override
|
|
- input_select.light_profile
|
|
- input_select.room_state_bathroom
|
|
|
|
light_profile_scenes_bathroom:
|
|
name: Bathroom Scenes
|
|
entities:
|
|
- script.light_profile_bathroom_bright
|
|
- script.light_profile_bathroom_default
|
|
- script.light_profile_bathroom_dimmed
|
|
- script.light_profile_bathroom_ambient
|
|
- script.light_profile_bathroom_night
|
|
- script.light_profile_bathroom_off
|
|
|
|
light_profile_automations_bathroom:
|
|
entities:
|
|
- automation.light_profile_change_active_bathroom
|
|
- automation.light_profile_change_inactive_bathroom
|
|
- automation.light_profile_change_off_bathroom
|
|
|
|
motion_triggers_bathroom:
|
|
entities:
|
|
- automation.room_state_active_trigger_bathroom
|
|
- automation.room_state_inactive_trigger_bathroom
|
|
- automation.room_state_off_trigger_bathroom
|
|
|
|
input_boolean:
|
|
bathroom_activity_override:
|
|
name: Bathroom Activity Override
|
|
initial: off
|
|
|
|
input_select:
|
|
room_state_bathroom:
|
|
name: Bathroom State
|
|
options:
|
|
- active
|
|
- inactive
|
|
- 'off'
|
|
initial: 'off'
|
|
|
|
binary_sensor:
|
|
- platform: template
|
|
sensors:
|
|
bathroom_activity:
|
|
friendly_name: 'Bathroom Activity'
|
|
value_template: >
|
|
{% if is_state('binary_sensor.toilet_sensor', 'on')
|
|
or is_state('input_boolean.bathroom_activity_override', 'on')
|
|
or is_state('input_select.latest_motion', 'Bathroom')
|
|
or is_state('input_select.martin_activity', 'Showering') -%}
|
|
true
|
|
{% else -%}
|
|
false
|
|
{% endif -%}
|
|
|
|
automation:
|
|
# Room State Triggers #
|
|
- alias: room_state_active_trigger_bathroom
|
|
trigger:
|
|
platform: state
|
|
entity_id: binary_sensor.bathroom_activity
|
|
to: 'on'
|
|
action:
|
|
service: input_select.select_option
|
|
data_template:
|
|
entity_id: input_select.room_state_bathroom
|
|
option: 'active'
|
|
|
|
- alias: room_state_inactive_trigger_bathroom
|
|
trigger:
|
|
platform: state
|
|
entity_id: binary_sensor.bathroom_activity
|
|
to: 'off'
|
|
for:
|
|
minutes: 5
|
|
action:
|
|
service: input_select.select_option
|
|
data_template:
|
|
entity_id: input_select.room_state_bathroom
|
|
option: 'inactive'
|
|
|
|
- alias: room_state_off_trigger_bathroom
|
|
trigger:
|
|
platform: state
|
|
entity_id: binary_sensor.bathroom_activity
|
|
to: 'off'
|
|
for:
|
|
minutes: 10
|
|
action:
|
|
service: input_select.select_option
|
|
data_template:
|
|
entity_id: input_select.room_state_bathroom
|
|
option: 'off'
|
|
|
|
# Room Scene Triggers #
|
|
- alias: light_profile_change_active_bathroom
|
|
trigger:
|
|
- platform: state
|
|
entity_id: input_select.room_state_bathroom
|
|
- platform: state
|
|
entity_id: input_select.light_profile
|
|
- platform: state
|
|
entity_id: input_select.theme
|
|
condition:
|
|
- condition: state
|
|
entity_id: input_select.room_state_bathroom
|
|
state: 'active'
|
|
action:
|
|
service: script.turn_on
|
|
data_template:
|
|
entity_id: >
|
|
script.light_profile_bathroom_{{ states('input_select.light_profile') | lower }}
|
|
|
|
- alias: light_profile_change_inactive_bathroom
|
|
trigger:
|
|
- platform: state
|
|
entity_id: input_select.room_state_bathroom
|
|
- platform: state
|
|
entity_id: input_select.inactive_light_profile
|
|
- platform: state
|
|
entity_id: input_select.theme
|
|
condition:
|
|
- condition: state
|
|
entity_id: input_select.room_state_bathroom
|
|
state: 'inactive'
|
|
action:
|
|
service: script.turn_on
|
|
data_template:
|
|
entity_id: >
|
|
script.light_profile_bathroom_{{ states('input_select.inactive_light_profile') | lower }}
|
|
|
|
- alias: light_profile_change_off_bathroom
|
|
trigger:
|
|
- platform: state
|
|
entity_id: input_select.room_state_bathroom
|
|
- platform: state
|
|
entity_id: input_select.light_profile
|
|
condition:
|
|
- condition: state
|
|
entity_id: input_select.room_state_bathroom
|
|
state: 'off'
|
|
action:
|
|
service: script.turn_on
|
|
data_template:
|
|
entity_id: >
|
|
script.light_profile_bathroom_off
|