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

492 lines
14 KiB
YAML

homeassistant:
customize:
input_boolean.office_activity_override:
persistent: true
input_select.room_state_office:
persistent: true
input_select.office_light_profile:
persistent: true
script:
light_profile_office_bright:
sequence:
# White temp lights
- service: light.turn_on
data:
brightness: 255
color_temp: 370
entity_id:
- group.office_spots
- light.office_strip
# Dimmable Lights
- service: light.turn_on
data:
brightness: 255
entity_id:
- light.office_desk
- light.office_shelves
- light.hobby_desk
# 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.office_desk_shelf
- light.office_shelf_bar
# Secondary RGB lights
- service: light.turn_on
data_template:
brightness: 255
hs_color: [ "{{ states.sensor.theme_secondary_color.state.split(',')[0]|int }}", "{{ states.sensor.theme_secondary_color.state.split(',')[1]|int }}" ]
entity_id:
- light.screen_shelf
light_profile_office_default:
sequence:
# White temp lights
- service: light.turn_on
data:
brightness: 150
color_temp: 370
entity_id:
- group.office_spots
# Dimmable Lights
- service: light.turn_on
data:
brightness: 255
entity_id:
- light.office_desk
- light.office_shelves
- light.hobby_desk
# Primary RGB lights
- service: light.turn_on
data_template:
brightness: 255
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.office_strip
- 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.office_desk_shelf
- light.office_shelf_bar
# Secondary RGB lights
- service: light.turn_on
data_template:
brightness: 255
hs_color: [ "{{ states.sensor.theme_secondary_color.state.split(',')[0]|int }}", "{{ states.sensor.theme_secondary_color.state.split(',')[1]|int }}" ]
entity_id:
- light.screen_shelf
light_profile_office_dimmed:
sequence:
# Off Lights
- service: light.turn_off
data:
entity_id:
- group.office_spots
# Dimmable Lights
- service: light.turn_on
data:
brightness: 127
entity_id:
- light.office_desk
- light.office_shelves
- light.hobby_desk
# Primary RGB lights
- service: light.turn_on
data_template:
brightness: 127
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.office_strip
- service: light.turn_on
data_template:
brightness: 127
hs_color: [ "{{ states.sensor.theme_primary_color.state.split(',')[0]|int }}", "{{ states.sensor.theme_primary_color.state.split(',')[1]|int }}"]
entity_id:
- light.office_shelf_bar
- light.office_desk_shelf
# Secondary RGB lights
- service: light.turn_on
data_template:
brightness: 127
hs_color: [ "{{ states.sensor.theme_secondary_color.state.split(',')[0]|int }}", "{{ states.sensor.theme_secondary_color.state.split(',')[1]|int }}" ]
entity_id:
- light.screen_shelf
light_profile_office_ambient:
sequence:
# Off Lights
- service: light.turn_off
data:
entity_id:
- group.office_spots
- light.office_desk
- light.hobby_desk
# Dimmable Lights
- service: light.turn_on
data:
brightness: 1
entity_id:
- light.office_shelves
# Primary RGB lights
- service: light.turn_on
data_template:
brightness: 42
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.office_strip
- service: light.turn_on
data_template:
brightness: 42
hs_color: [ "{{ states.sensor.theme_primary_color.state.split(',')[0]|int }}", "{{ states.sensor.theme_primary_color.state.split(',')[1]|int }}"]
entity_id:
- light.office_shelf_bar
- light.office_desk_shelf
- service: light.turn_on
data_template:
brightness: 127
hs_color: [ "{{ states.sensor.theme_secondary_color.state.split(',')[0]|int }}", "{{ states.sensor.theme_secondary_color.state.split(',')[1]|int }}" ]
entity_id:
- light.screen_shelf
light_profile_office_night:
sequence:
# Off Lights
- service: light.turn_off
data:
entity_id:
- group.office_spots
- light.office_desk
- light.hobby_desk
- light.office_shelves
# Primary RGB lights
- service: light.turn_on
data_template:
brightness: 16
rgb_color: [255, 0, 0]
entity_id:
- light.office_shelf_bar
- light.office_desk_shelf
# Secondary RGB lights
- service: light.turn_on
data_template:
brightness: 24
rgb_color: [255, 0, 0]
entity_id:
- light.office_strip
- light.screen_shelf
light_profile_office_off:
sequence:
# Off Lights
- service: light.turn_off
data:
entity_id:
- light.office_lights
light_profile_office_party:
sequence:
# Off Lights
- service: light.turn_off
data:
entity_id:
- group.office_spots
- light.office_desk
- light.hobby_desk
# Dimmable Lights
- service: light.turn_on
data:
brightness: 1
entity_id:
- light.office_shelves
- service: light.turn_on
data_template:
effect: "rainbow"
entity_id:
- light.office_desk_shelf
- light.screen_shelf
- light.office_shelf_bar
- service: light.turn_on
data_template:
effect: "colorloop"
entity_id:
- light.office_strip
group:
light_profile_office:
entities:
- binary_sensor.office_activity
- binary_sensor.hobby_desk_activity
- input_boolean.office_activity_override
- input_select.light_profile
- input_select.office_light_profile
light_profile_scenes_office:
name: Office Scenes
entities:
- script.light_profile_office_bright
- script.light_profile_office_default
- script.light_profile_office_dimmed
- script.light_profile_office_ambient
- script.light_profile_office_night
- script.light_profile_office_off
light_profile_automations_office:
entities:
- automation.light_profile_change_active_office
- automation.light_profile_change_inactive_office
- automation.light_profile_change_off_office
motion_triggers_office:
entities:
- automation.room_state_active_trigger_office
- automation.room_state_inactive_trigger_office
- automation.room_state_off_trigger_office
input_boolean:
office_activity_override:
name: Office Activity Override
initial: off
input_select:
room_state_office:
name: Office State
options:
- active
- inactive
- 'off'
initial: 'off'
office_light_profile:
name: Office Light Profile
options:
- Bright
- Default
- Dimmed
- Ambient
- Night
- 'Off'
initial: Default
office_inactive_light_profile:
options:
- Default
- Dimmed
- Ambient
- Night
- 'Off'
initial: Dimmed
binary_sensor:
- platform: template
sensors:
hobby_desk_activity:
friendly_name: 'Hobby Desk Activity'
value_template: >
{% if is_state('binary_sensor.home_assistant_loaded', 'off') -%}
false
{% elif not is_state('light.hobby_desk_lamp', 'unavailable') -%}
true
{% else -%}
false
{% endif -%}
office_activity:
friendly_name: 'Office Activity'
value_template: >
{% if is_state('binary_sensor.office_sensor', 'on')
or is_state('input_boolean.office_activity_override', 'on')
or is_state('switch.pc', 'on')
or is_state('binary_sensor.hobby_desk_activity', 'on')
or is_state('media_player.projector_chromecast', 'playing')
or is_state('input_select.latest_motion', 'Office') -%}
true
{% else -%}
false
{% endif -%}
automation:
- alias: hobby desk pinger on
trigger:
platform: time
minutes: '/5'
seconds: 0
condition:
condition: and
conditions:
- condition: state
entity_id: light.hobby_desk_lamp
state: 'on'
- condition: state
entity_id: binary_sensor.home_assistant_loaded
state: 'on'
action:
- service_template: "light.turn_on"
data:
entity_id: light.hobby_desk_lamp
brightness: 254
- service_template: "light.turn_on"
data:
entity_id: light.hobby_desk_lamp
brightness: 255
- alias: hobby desk pinger off
trigger:
platform: time
minutes: '/5'
seconds: 0
condition:
condition: and
conditions:
- condition: state
entity_id: light.hobby_desk_lamp
state: 'off'
- condition: state
entity_id: binary_sensor.home_assistant_loaded
state: 'on'
action:
- service_template: "light.turn_on"
data:
entity_id: light.hobby_desk_lamp
brightness: 1
- service_template: "light.turn_off"
data:
entity_id: light.hobby_desk_lamp
- alias: Office Inactive Light Profile Setter
trigger:
platform: state
entity_id: input_select.office_light_profile
action:
service: input_select.select_option
data_template:
entity_id: input_select.office_inactive_light_profile
option: >
{% if is_state('input_select.office_light_profile', 'Bright') %}
Default
{% elif is_state('input_select.office_light_profile', 'Default') %}
Dimmed
{% elif is_state('input_select.office_light_profile', 'Dimmed') %}
Ambient
{% elif is_state('input_select.office_light_profile', 'Ambient') %}
Night
{% else %}
Off
{% endif %}
- alias: office_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.office_light_profile
option: "{{trigger.to_state.state}}"
# Room State Triggers #
- alias: room_state_active_trigger_office
trigger:
platform: state
entity_id: binary_sensor.office_activity
to: 'on'
action:
service: input_select.select_option
data_template:
entity_id: input_select.room_state_office
option: 'active'
- alias: room_state_inactive_trigger_office
trigger:
platform: state
entity_id: binary_sensor.office_activity
to: 'off'
for:
minutes: 2
action:
service: input_select.select_option
data_template:
entity_id: input_select.room_state_office
option: 'inactive'
- alias: room_state_off_trigger_office
trigger:
platform: state
entity_id: binary_sensor.office_activity
to: 'off'
for:
minutes: 5
action:
service: input_select.select_option
data_template:
entity_id: input_select.room_state_office
option: 'off'
# Room Scene Triggers #
- alias: light_profile_change_active_office
trigger:
- platform: state
entity_id: input_select.room_state_office
- platform: state
entity_id: input_select.office_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_office
state: 'active'
action:
service: script.turn_on
data_template:
entity_id: >
{% if is_state('input_boolean.party_mode', 'on') -%}
script.light_profile_office_party
{% else -%}
script.light_profile_office_{{ states('input_select.office_light_profile') | lower }}
{% endif -%}
- alias: light_profile_change_inactive_office
trigger:
- platform: state
entity_id: input_select.room_state_office
- platform: state
entity_id: input_select.office_inactive_light_profile
- platform: state
entity_id: input_select.theme
condition:
- condition: state
entity_id: input_select.room_state_office
state: 'inactive'
action:
service: script.turn_on
data_template:
entity_id: >
script.light_profile_office_{{ states('input_select.office_inactive_light_profile') | lower }}
- alias: light_profile_change_off_office
trigger:
- platform: state
entity_id: input_select.room_state_office
- platform: state
entity_id: input_select.office_light_profile
condition:
- condition: state
entity_id: input_select.room_state_office
state: 'off'
action:
service: script.turn_on
data_template:
entity_id: >
script.light_profile_office_off