DarkFox-homeassistant/packages/automation/light_profiles/bedroom.yaml

464 lines
14 KiB
YAML

homeassistant:
customize:
input_boolean.bedroom_activity_override:
persistent: true
input_select.room_state_bedroom:
persistent: true
input_select.bedroom_light_profile:
persistent: true
script:
light_profile_bedroom_bright:
sequence:
- service: switch.turn_off
data:
entity_id:
- switch.party_light_1
- switch.party_light_2
- switch.party_light_3
# White temp lights
- service: light.turn_on
data:
brightness: 255
color_temp: 370
entity_id:
- group.cloud
# Dimmable Lights
- service: light.turn_on
data:
brightness: 255
color_temp: 350
entity_id:
- light.bedroom_shelf_strip
- light.bedside
# Primary RGB lights
- service: light.turn_on
data_template:
brightness: 255
hs_color: [ "{{ states.sensor.theme_primary_color.state.split(',')[0]|int }}", "{{ states.sensor.theme_primary_color.state.split(',')[1]|int }}"]
entity_id:
- light.bedroom_shelves
# Secondary RGB lights
- service: light.turn_on
data_template:
brightness: 255
hs_color: [ "{{ states.sensor.theme_secondary_color_hue.state.split(',')[0]|int }}", "{{ states.sensor.theme_secondary_color_hue.state.split(',')[1]|int }}" ]
entity_id:
- light.bedroom_ps
light_profile_bedroom_default:
sequence:
# Off Lights
- service: switch.turn_off
data:
entity_id:
- switch.party_light_1
- switch.party_light_2
- switch.party_light_3
- service: light.turn_off
data:
entity_id:
- light.cloud_west
- light.cloud_east
# White temp lights
- service: light.turn_on
data:
brightness: 255
color_temp: 370
entity_id:
- light.cloud_north
- light.bedroom_shelf_strip
- service: light.turn_on
data:
brightness: 200
color_temp: 370
entity_id:
- light.bedside
# Primary RGB lights
- service: light.turn_on
data_template:
brightness: 255
hs_color: [ "{{ states.sensor.theme_primary_color.state.split(',')[0]|int }}", "{{ states.sensor.theme_primary_color.state.split(',')[1]|int }}"]
entity_id:
- light.bedroom_shelves
# Secondary RGB lights
- service: light.turn_on
data_template:
brightness: 255
hs_color: [ "{{ states.sensor.theme_secondary_color_hue.state.split(',')[0]|int }}", "{{ states.sensor.theme_secondary_color_hue.state.split(',')[1]|int }}" ]
entity_id:
- light.bedroom_ps
light_profile_bedroom_dimmed:
sequence:
- service: switch.turn_off
data:
entity_id:
- switch.party_light_1
- switch.party_light_2
- switch.party_light_3
- service: light.turn_off
data:
entity_id:
- light.bedroom_shelf_strip
# Dimmable Lights
- service: light.turn_on
data:
brightness: 127
color_temp: 460
entity_id:
- light.bedside
- service: light.turn_on
data:
brightness: 32
color_temp: 350
entity_id:
- light.bedroom_shelf_strip
# Primary RGB lights
- service: light.turn_on
data_template:
brightness: 86
hs_color: [ "{{ states.sensor.theme_primary_color_hue.state.split(',')[0]|int }}", "{{ states.sensor.theme_primary_color_hue.state.split(',')[1]|int }}"]
entity_id:
- group.cloud
# Secondary RGB lights
- service: light.turn_on
data_template:
brightness: 127
hs_color: [ "{{ states.sensor.theme_secondary_color_hue.state.split(',')[0]|int }}", "{{ states.sensor.theme_secondary_color_hue.state.split(',')[1]|int }}" ]
entity_id:
- light.bedroom_ps
- light.bedroom_shelves
light_profile_bedroom_ambient:
sequence:
# Off Lights
- service: switch.turn_off
data:
entity_id:
- switch.party_light_1
- switch.party_light_2
- switch.party_light_3
- service: light.turn_off
data:
entity_id:
- light.cloud_west
- light.cloud_east
- light.bedroom_shelf_strip
# Primary RGB lights
# - service: light.turn_on
# data_template:
# brightness: 1
# hs_color: [ "{{ states.sensor.theme_primary_color.state.split(',')[0]|int }}", "{{ states.sensor.theme_primary_color.state.split(',')[1]|int }}"]
# entity_id:
- service: light.turn_on
data_template:
brightness: 1
hs_color: [ "{{ states.sensor.theme_primary_color_hue.state.split(',')[0]|int }}", "{{ states.sensor.theme_primary_color_hue.state.split(',')[1]|int }}"]
entity_id:
- light.cloud_north
# Secondary RGB lights
- service: light.turn_on
data_template:
brightness: 64
hs_color: [ "{{ states.sensor.theme_secondary_color.state.split(',')[0]|int }}", "{{ states.sensor.theme_secondary_color.state.split(',')[1]|int }}" ]
entity_id:
- light.bedroom_shelves
- service: light.turn_on
data_template:
brightness: 64
hs_color: [ "{{ states.sensor.theme_secondary_color_hue.state.split(',')[0]|int }}", "{{ states.sensor.theme_secondary_color_hue.state.split(',')[1]|int }}" ]
entity_id:
- light.bedside
- light.bedroom_ps
light_profile_bedroom_night:
sequence:
# Off Lights
- service: switch.turn_off
data:
entity_id:
- switch.party_light_1
- switch.party_light_2
- switch.party_light_3
- service: light.turn_off
data:
entity_id:
- group.cloud
- light.bedroom_shelf_strip
- service: light.turn_on
data:
brightness: 32
rgb_color: [255,0,0]
entity_id:
- light.bedroom_shelves
- service: light.turn_on
data:
brightness: 1
rgb_color: [255,0,0]
entity_id:
- light.bedside
- light.bedroom_ps
light_profile_bedroom_off:
sequence:
# Off Lights
- service: switch.turn_off
data:
entity_id:
- switch.party_light_1
- switch.party_light_2
- switch.party_light_3
- service: light.turn_off
data:
entity_id:
- light.bedroom_lights
light_profile_bedroom_party:
sequence:
# Off Lights
- service: light.turn_off
data:
entity_id:
- light.bedroom_shelf_strip
- light.cloud_west
- light.cloud_north
- service: switch.turn_on
data:
entity_id:
- switch.party_light_1
- switch.party_light_2
- switch.party_light_3
- service: light.turn_on
data:
effect: "rainbow"
entity_id:
- light.bedroom_shelves
- service: light.turn_on
data:
effect: "colorloop"
brightness: 32
entity_id:
- light.bedside
- light.bedroom_ps
- service: light.turn_on
data:
effect: "colorloop"
brightness: 24
entity_id:
- light.cloud_east
group:
light_profile_bedroom:
entities:
- binary_sensor.bedroom_activity
- input_boolean.bedroom_activity_override
- input_select.light_profile
- input_select.bedroom_light_profile
light_profile_scenes_bedroom:
name: Bedroom Scenes
entities:
- script.light_profile_bedroom_bright
- script.light_profile_bedroom_default
- script.light_profile_bedroom_dimmed
- script.light_profile_bedroom_ambient
- script.light_profile_bedroom_night
- script.light_profile_bedroom_off
light_profile_automations_bedroom:
entities:
- automation.light_profile_change_active_bedroom
- automation.light_profile_change_inactive_bedroom
- automation.light_profile_change_off_bedroom
motion_triggers_bedroom:
entities:
- automation.room_state_active_trigger_bedroom
- automation.room_state_inactive_trigger_bedroom
- automation.room_state_off_trigger_bedroom
input_boolean:
bedroom_activity_override:
name: Bedroom Activity Override
initial: off
input_select:
room_state_bedroom:
name: Bedroom State
options:
- active
- inactive
- 'off'
initial: 'off'
bedroom_light_profile:
name: Bedroom Light Profile
options:
- Bright
- Default
- Dimmed
- Ambient
- Night
- 'Off'
initial: Bright
bedroom_inactive_light_profile:
options:
- Default
- Dimmed
- Ambient
- Night
- 'Off'
initial: Dimmed
binary_sensor:
- platform: template
sensors:
bedroom_activity:
friendly_name: 'Bedroom Activity'
value_template: >
{% if is_state('binary_sensor.bedroom_sensor', 'on')
or is_state('input_boolean.bedroom_activity_override', 'on')
or is_state('input_select.latest_motion', 'Bedroom')
or is_state('input_select.martin_activity', 'Sleeping')
or is_state('input_select.martin_activity', 'Waking')
or is_state('media_player.bedroom_chromecast', 'playing')
or is_state('media_player.bedroom_tv', 'playing') -%}
true
{% else -%}
false
{% endif -%}
automation:
- alias: Bedroom Inactive Light Profile Setter
trigger:
platform: state
entity_id: input_select.bedroom_light_profile
action:
service: input_select.select_option
data_template:
entity_id: input_select.bedroom_inactive_light_profile
option: >
{% if is_state('input_select.bedroom_light_profile', 'Bright') %}
Default
{% elif is_state('input_select.bedroom_light_profile', 'Default') %}
Dimmed
{% elif is_state('input_select.bedroom_light_profile', 'Dimmed') %}
Ambient
{% elif is_state('input_select.bedroom_light_profile', 'Ambient') %}
Night
{% else %}
Off
{% endif %}
- alias: bedroom_light_profile_sync
trigger:
platform: state
entity_id: input_select.light_profile
condition:
condition: state
entity_id: input_boolean.guests
state: 'off'
action:
service: input_select.select_option
data_template:
entity_id: input_select.bedroom_light_profile
option: "{{trigger.to_state.state}}"
# Room State Triggers #
- alias: room_state_active_trigger_bedroom
trigger:
platform: state
entity_id: binary_sensor.bedroom_activity
to: 'on'
action:
service: input_select.select_option
data_template:
entity_id: input_select.room_state_bedroom
option: 'active'
- alias: room_state_inactive_trigger_bedroom
trigger:
platform: state
entity_id: binary_sensor.bedroom_activity
to: 'off'
for:
minutes: 2
action:
service: input_select.select_option
data_template:
entity_id: input_select.room_state_bedroom
option: 'inactive'
- alias: room_state_off_trigger_bedroom
trigger:
platform: state
entity_id: binary_sensor.bedroom_activity
to: 'off'
for:
minutes: 5
action:
service: input_select.select_option
data_template:
entity_id: input_select.room_state_bedroom
option: 'off'
# Room Scene Triggers #
- alias: light_profile_change_active_bedroom
trigger:
- platform: state
entity_id: input_select.room_state_bedroom
- platform: state
entity_id: input_select.bedroom_light_profile
- platform: state
entity_id: input_select.theme
- platform: state
entity_id: input_boolean.party_mode
condition:
- condition: state
entity_id: input_select.room_state_bedroom
state: 'active'
action:
service: script.turn_on
data_template:
entity_id: >
{% if is_state('input_boolean.party_mode', 'on') -%}
script.light_profile_bedroom_party
{% else -%}
script.light_profile_bedroom_{{ states('input_select.bedroom_light_profile') | lower }}
{%- endif -%}
- alias: light_profile_change_inactive_bedroom
trigger:
- platform: state
entity_id: input_select.room_state_bedroom
- platform: state
entity_id: input_select.bedroom_inactive_light_profile
- platform: state
entity_id: input_select.theme
condition:
- condition: state
entity_id: input_select.room_state_bedroom
state: 'inactive'
action:
service: script.turn_on
data_template:
entity_id: >
script.light_profile_bedroom_{{ states('input_select.bedroom_inactive_light_profile') | lower }}
- alias: light_profile_change_off_bedroom
trigger:
- platform: state
entity_id: input_select.room_state_bedroom
- platform: state
entity_id: input_select.bedroom_light_profile
condition:
- condition: state
entity_id: input_select.room_state_bedroom
state: 'off'
action:
service: script.turn_on
data_template:
entity_id: >
script.light_profile_bedroom_off