-
Notifications
You must be signed in to change notification settings - Fork 12
/
theme.yaml
156 lines (150 loc) · 5.73 KB
/
theme.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
################################################################
## Packages / Theme
## Change frontend theme to match holiday sensor
## Change lights to match theme
## Change Doorbell tone to match theme
## Color Picker - https://www.google.ca/search?q=rgb+color+picker&rlz=1C1GGRV_enCA749CA749&oq=rgb+color+picker&aqs=chrome.0.0l6.3705j0j4&sourceid=chrome&ie=UTF-8
################################################################
automation:
- alias: 'theme_set'
initial_state: 'on'
trigger:
- platform: state
entity_id: input_select.theme
- platform: homeassistant
event: start
action:
- service: input_select.select_option
data_template:
entity_id: input_select.theme
option: >-
{% set holiday = states.sensor.holiday.state %}
{% set sun= states.sun.sun.state %}
{%- if holiday == "Standard" and sun == "above_horizon"-%} Night
{%- elif holiday == "Standard" and sun == "below_horizon"-%} Night
{%- else -%} {{states.sensor.holiday.state}}
{%- endif -%}
- service: frontend.set_theme
data_template:
name: '{{states.input_select.theme.state}}'
- alias: 'theme_holiday'
initial_state: 'on'
trigger:
- platform: state
entity_id: sensor.holiday
condition:
- condition: template
value_template: '{{states.sensor.holiday.state != "Standard"}}'
action:
- service: input_select.select_option
data_template:
entity_id: input_select.theme
option: '{{states.sensor.holiday.state}}'
- alias: 'theme_night_day'
initial_state: 'on'
trigger:
- platform: state
entity_id: sun.sun
- platform: state
entity_id: sensor.holiday
to: 'Standard'
condition:
- condition: template
value_template: '{{states.input_select.theme.state == "Day" or states.input_select.theme.state == "Night" or states.sensor.holiday.state == "Standard"}}'
action:
- service: input_select.select_option
data_template:
entity_id: input_select.theme
option: >
{% if states.sun.sun.state == "above_horizon" %} Day
{% else %} Night
{% endif %}
- alias: 'theme_light'
initial_state: 'on'
trigger:
- platform: state
entity_id: sun.sun
to: "below_horizon"
- platform: state
entity_id: input_boolean.away
to: 'off'
condition:
- condition: template
value_template: '{{states.input_boolean.away.state == "off" and states.sun.sun.state == "below_horizon"}}'
action:
- service: light.turn_on
data:
entity_id:
- light.front_door
brightness: 250
data_template:
rgb_color: [ "{{ states.sensor.theme_color.state.split(',')[0]|int }}", "{{ states.sensor.theme_color.state.split(',')[1]|int }}", "{{ states.sensor.theme_color.state.split(',')[2]|int }}" ]
- alias: 'theme_light_auto_off'
initial_state: 'on'
trigger:
- platform: state
entity_id: sun.sun
from: "below_horizon"
to: "above_horizon"
action:
- service: light.turn_off
data:
entity_id: light.front_door
sensor:
- platform: template
sensors:
theme_color:
friendly_name: 'Porch Light RGB Value'
value_template: >
{%- if is_state('input_select.theme', "New Year's Day") -%} 255,0,0
{%- elif is_state('input_select.theme', "Groundhog Day") -%} 255,0,0
{%- elif is_state('input_select.theme', "Valentine's Day") -%} 255,196,250
{%- elif is_state('input_select.theme', "St. Patrick's Day") -%} 85,255,56
{%- elif is_state('input_select.theme', "Starwars Day") -%} 86,66,244
{%- elif is_state('input_select.theme', "Good Friday") -%} 255,255,56
{%- elif is_state('input_select.theme', "Easter Sunday") -%} 255,255,56
{%- elif is_state('input_select.theme', "Earth Day") -%} 82,255,56
{%- elif is_state('input_select.theme', "Mother's Day") -%} 255,196,250
{%- elif is_state('input_select.theme', "Victoria Day") -%} 255,0,0
{%- elif is_state('input_select.theme', "Father's Day") -%} 56,56,255
{%- elif is_state('input_select.theme', "Canada Day") -%} 255,0,0
{%- elif is_state('input_select.theme', "Labour Day") -%} 255,0,0
{%- elif is_state('input_select.theme', "Thanksgiving Day") -%} 255,110,0
{%- elif is_state('input_select.theme', "Halloween") -%} 255,168,39
{%- elif is_state('input_select.theme', "Remembrance Day") -%} 252,10,10
{%- elif is_state('input_select.theme', "Christmas Eve") -%} 33,55,0
{%- elif is_state('input_select.theme', "Christmas Day") -%} 33,55,0
{%- elif is_state('input_select.theme', "Boxing Day") -%} 33,55,0
{%- elif is_state('input_select.theme', "New Year's Eve") -%} 255,0,0
{%- else -%} 255,255,255
{%- endif -%}
icon_template: "{% if is_state('sun.sun', 'above_horizon') %} mdi:led-on {% else %}mdi:led-on{% endif %}"
input_select:
theme:
name: Theme
options:
- "Day"
- "Night"
- "New Year's Day"
- "Groundhog Day"
- "Valentine's Day"
- "St. Patrick's Day"
- "Starwars Day"
- "Good Friday"
- "Easter Sunday"
- "Earth Day"
- "Mother's Day"
- "Victoria Day"
- "Father's Day"
- "Canada Day"
- "Labour Day"
- "Thanksgiving Day"
- "Halloween"
- "Remembrance Day"
- "Christmas Eve"
- "Christmas Day"
- "Boxing Day"
- "New Year's Eve"
- "Standard"
initial: "Day"
icon: 'mdi:palette'