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

385 lines
12 KiB
YAML

homeassistant:
customize:
input_select.theme:
persistent: true
input_select.light_profile:
persistent: true
group.light_profile:
order: 1
script.dim_light_profile:
icon: mdi:brightness-low
script.brighten_light_profile:
icon: mdi:brightness-high
group:
light_profile:
name: Light Profile
entities:
- input_select.theme
- input_select.light_profile
- light.apartment_light_level
light_profile_triggers:
name: Light Profile Triggers
entities:
- group.hallway_motion_triggers
- group.bathroom_motion_triggers
- group.kitchen_motion_triggers
- group.livingroom_motion_triggers
- group.office_motion_triggers
- group.bedroom_motion_triggers
light_profile_rooms:
entities:
- group.hallway_light_profile
- group.bathroom_light_profile
- group.kitchen_light_profile
- group.livingroom_light_profile
- group.office_light_profile
- group.bedroom_light_profile
light_profile_themes:
entities:
- input_select.theme
- sensor.theme_primary_color
- sensor.theme_primary_color_hue
- sensor.theme_secondary_color
- sensor.theme_secondary_color_hue
input_select:
light_profile:
name: Light Profile
options:
- Bright
- Default
- Dimmed
- Ambient
- Night
- 'Off'
initial: Default
inactive_light_profile:
name: Inactive Light Profile
options:
- Default
- Dimmed
- Ambient
- Night
- 'Off'
initial: Dimmed
theme:
name: Theme
options:
- Tron
- Halloween
- Christmas
- Little
- Portal
- Portal Inverted
- Dragon
- Red and Blue
- Yellow and Green
- Screaming Pink
- Red
- Green
- Blue
- Yellow
- Purple
- Orange
- Spring Blossom
initial: Portal
light:
- platform: mqtt_json
name: apartment light level
command_topic: "virtual/apartment-light-level/set"
brightness: true
retain: true
sensor:
- platform: template
sensors:
theme_primary_color: # Usually the warmer color
friendly_name: Primary Color
value_template: >
{% if is_state('input_select.theme', 'Tron') -%}
45,100
{% elif is_state('input_select.theme', 'Halloween') -%}
6,100
{% elif is_state('input_select.theme', 'Christmas') -%}
0,100
{% elif is_state('input_select.theme', 'Little') -%}
304,90
{% elif is_state('input_select.theme', 'Portal') -%}
6,100
{% elif is_state('input_select.theme', 'Portal Inverted') -%}
234,100
{% elif is_state('input_select.theme', 'Dragon') -%}
277,100
{% elif is_state('input_select.theme', 'Red and Blue') -%}
0,100
{% elif is_state('input_select.theme', 'Yellow and Green') -%}
12,100
{% elif is_state('input_select.theme', 'Screaming Pink') -%}
330,100
{% elif is_state('input_select.theme', 'Red') -%}
0,100
{% elif is_state('input_select.theme', 'Green') -%}
105,100
{% elif is_state('input_select.theme', 'Blue') -%}
240,100
{% elif is_state('input_select.theme', 'Yellow') -%}
6,100
{% elif is_state('input_select.theme', 'Purple') -%}
277,100
{% elif is_state('input_select.theme', 'Orange') -%}
12,100
{% elif is_state('input_select.theme', 'Spring Blossom') -%}
327,9
{% endif -%}
theme_primary_color_hue:
friendly_name: Secondary Color Hue
value_template: >
{% if is_state('input_select.theme', 'Tron') -%}
45,100
{% elif is_state('input_select.theme', 'Halloween') -%}
15,100
{% elif is_state('input_select.theme', 'Christmas') -%}
0,100
{% elif is_state('input_select.theme', 'Little') -%}
285,90
{% elif is_state('input_select.theme', 'Portal') -%}
26,100
{% elif is_state('input_select.theme', 'Portal Inverted') -%}
254,100
{% elif is_state('input_select.theme', 'Dragon') -%}
265,100
{% elif is_state('input_select.theme', 'Red and Blue') -%}
0,100
{% elif is_state('input_select.theme', 'Yellow and Green') -%}
45,100
{% elif is_state('input_select.theme', 'Screaming Pink') -%}
330,100
{% elif is_state('input_select.theme', 'Red') -%}
0,100
{% elif is_state('input_select.theme', 'Green') -%}
125,100
{% elif is_state('input_select.theme', 'Blue') -%}
255,100
{% elif is_state('input_select.theme', 'Yellow') -%}
45,100
{% elif is_state('input_select.theme', 'Purple') -%}
265,100
{% elif is_state('input_select.theme', 'Orange') -%}
15,100
{% elif is_state('input_select.theme', 'Spring Blossom') -%}
327,9
{% endif -%}
theme_secondary_color: # Usually the colder color
friendly_name: Secondary Color
value_template: >
{% if is_state('input_select.theme', 'Tron') -%}
179,100
{% elif is_state('input_select.theme', 'Halloween') -%}
277,100
{% elif is_state('input_select.theme', 'Christmas') -%}
0,0
{% elif is_state('input_select.theme', 'Little') -%}
226,96
{% elif is_state('input_select.theme', 'Portal') -%}
234,100
{% elif is_state('input_select.theme', 'Portal Inverted') -%}
6,100
{% elif is_state('input_select.theme', 'Dragon') -%}
120,100
{% elif is_state('input_select.theme', 'Red and Blue') -%}
240,100
{% elif is_state('input_select.theme', 'Yellow and Green') -%}
120,100
{% elif is_state('input_select.theme', 'Screaming Pink') -%}
330,100
{% elif is_state('input_select.theme', 'Red') -%}
0,100
{% elif is_state('input_select.theme', 'Green') -%}
120,100
{% elif is_state('input_select.theme', 'Blue') -%}
210,100
{% elif is_state('input_select.theme', 'Yellow') -%}
30,100
{% elif is_state('input_select.theme', 'Purple') -%}
266,100
{% elif is_state('input_select.theme', 'Orange') -%}
6,100
{% elif is_state('input_select.theme', 'Spring Blossom') -%}
339,58
{% endif -%}
theme_secondary_color_hue:
friendly_name: Secondary Color Hue
value_template: >
{% if is_state('input_select.theme', 'Tron') -%}
199,100
{% elif is_state('input_select.theme', 'Halloween') -%}
266,100
{% elif is_state('input_select.theme', 'Christmas') -%}
0,0
{% elif is_state('input_select.theme', 'Little') -%}
225,70
{% elif is_state('input_select.theme', 'Portal') -%}
254,100
{% elif is_state('input_select.theme', 'Portal Inverted') -%}
26,100
{% elif is_state('input_select.theme', 'Dragon') -%}
140,100
{% elif is_state('input_select.theme', 'Red and Blue') -%}
255,100
{% elif is_state('input_select.theme', 'Yellow and Green') -%}
140,100
{% elif is_state('input_select.theme', 'Screaming Pink') -%}
330,100
{% elif is_state('input_select.theme', 'Red') -%}
0,100
{% elif is_state('input_select.theme', 'Green') -%}
140,100
{% elif is_state('input_select.theme', 'Blue') -%}
220,100
{% elif is_state('input_select.theme', 'Yellow') -%}
44,81
{% elif is_state('input_select.theme', 'Purple') -%}
269,94
{% elif is_state('input_select.theme', 'Orange') -%}
26,100
{% elif is_state('input_select.theme', 'Spring Blossom') -%}
339,58
{% endif -%}
script:
dim_light_profile:
sequence:
service: input_select.select_next
entity_id: input_select.light_profile
brighten_light_profile:
sequence:
service: input_select.select_previous
entity_id: input_select.light_profile
activate_bright_scene:
sequence:
service: input_select.select_option
data:
entity_id: input_select.light_profile
option: Bright
activate_default_scene:
sequence:
service: input_select.select_option
data:
entity_id: input_select.light_profile
option: Default
activate_dimmed_scene:
sequence:
service: input_select.select_option
data:
entity_id: input_select.light_profile
option: Dimmed
activate_ambient_scene:
sequence:
service: input_select.select_option
data:
entity_id: input_select.light_profile
option: Ambient
activate_night_scene:
sequence:
service: input_select.select_option
data:
entity_id: input_select.light_profile
option: Night
activate_off_scene:
sequence:
service: input_select.select_option
data:
entity_id: input_select.light_profile
option: 'Off'
automation:
- alias: Apartment light level initializer
initial_state: true
trigger:
platform: homeassistant
event: start
action:
- service: light.turn_on
data:
entity_id: light.apartment_light_level
brightness: 127
- alias: Apartment light level setter
trigger:
- platform: numeric_state
entity_id: light.apartment_light_level
value_template: '{{ state.attributes.brightness }}'
below: 120
- platform: numeric_state
entity_id: light.apartment_light_level
value_template: '{{ state.attributes.brightness }}'
above: 135
action:
- service_template: "input_select.select_{%- if states.light.apartment_light_level.attributes.brightness | int < 120 -%}next{%- else -%}previous{%- endif -%}"
data:
entity_id: input_select.light_profile
- service: light.turn_on
data:
entity_id: light.apartment_light_level
brightness: 127
- alias: Inactive Light Profile Setter
trigger:
platform: state
entity_id: input_select.light_profile
action:
service: input_select.select_option
data_template:
entity_id: input_select.inactive_light_profile
option: >
{% if is_state('input_select.light_profile', 'Bright') %}
Default
{% elif is_state('input_select.light_profile', 'Default') %}
Dimmed
{% elif is_state('input_select.light_profile', 'Dimmed') %}
Ambient
{% elif is_state('input_select.light_profile', 'Ambient') %}
Night
{% else %}
Off
{% endif %}
scene:
- name: Bright
entities:
input_select.light_profile:
option: 'Bright'
- name: Default
entities:
input_select.light_profile:
option: 'Default'
- name: Dimmed
entities:
input_select.light_profile:
option: 'Dimmed'
- name: Ambient
entities:
input_select.light_profile:
option: 'Ambient'
- name: Night
entities:
input_select.light_profile:
option: 'Night'
- name: 'Off'
entities:
input_select.light_profile:
option: 'Off'