@@ -14,45 +14,95 @@ card_esh_room:
14
14
ulm_custom_card_esh_room_climate_entity : null
15
15
ulm_card_thermostat_enable_popup : false
16
16
ulm_card_light_enable_popup : false
17
+ ulm_card_dynamic_color : false
17
18
label : >-
18
19
[[[
19
- if (!entity) {
20
- return "<br/>";
21
- } else if (entity.state == "on"){
22
- var bri = Math.round(entity.attributes.brightness / 2.55);
23
- return (bri ? bri + "%" : variables.ulm_translation_state) ;
24
- } else {
25
- return variables.ulm_translation_state;
26
- }
20
+ var label_entity = variables.ulm_custom_card_esh_room_light_entity
21
+ ? states[variables.ulm_custom_card_esh_room_light_entity]
22
+ : entity;
23
+ if (!label_entity) {
24
+ return "<br />";
25
+ } else if (label_entity.state == "on") {
26
+ var bri = Math.round(label_entity.attributes.brightness / 2.55);
27
+ return (bri ? bri + "%" : variables.ulm_translation_state);
28
+ } else {
29
+ return variables.ulm_translation_state;
30
+ }
27
31
]]]
28
32
styles :
29
33
card :
30
34
- border-radius : " 20px"
31
35
- box-shadow : " var(--box-shadow)"
32
36
- padding : " 12px"
37
+ - background-color : >-
38
+ [[[
39
+ if (variables.ulm_custom_card_esh_room_light_entity) {
40
+ var color = states[variables.ulm_custom_card_esh_room_light_entity].attributes.rgb_color;
41
+ if (states[variables.ulm_custom_card_esh_room_light_entity].state == "on") {
42
+ if (color && variables.ulm_card_dynamic_color) {
43
+ return 'rgba(' + color + ', 0.2)';
44
+ }
45
+ return 'rgba(var(--color-background-yellow), 0.2)';
46
+ }
47
+ }
48
+ return 'var(--ha-card-background, var(--card-background-color, white))';
49
+ ]]]
33
50
grid :
34
51
- grid-template-areas : >-
35
52
[[[
36
53
if (variables.ulm_custom_card_esh_room_light_entity && variables.ulm_custom_card_esh_room_climate_entity) {
37
- return "'i light' 'n climate' 'l climate'";
54
+ return "'i light' 'n climate' 'l climate'";
38
55
} else if (variables.ulm_custom_card_esh_room_light_entity) {
39
- return "'i light' 'n n' 'l l'";
56
+ return "'i light' 'n n' 'l l'";
40
57
} else if (variables.ulm_custom_card_esh_room_climate_entity) {
41
- return "'i .' 'n climate' 'l climate'";
58
+ return "'i .' 'n climate' 'l climate'";
42
59
} else {
43
- return "'i .' 'n n' 'l l'";
60
+ return "'i .' 'n n' 'l l'";
44
61
}
45
62
]]]
46
63
- grid-template-columns : " 1fr 1fr"
47
64
- grid-template-rows : " min-content"
48
65
icon :
49
- - color : " rgba(var(--color-theme),0.2)"
66
+ - filter : >-
67
+ [[[
68
+ if (variables.ulm_custom_card_esh_room_light_entity
69
+ && states[variables.ulm_custom_card_esh_room_light_entity].state == "on"
70
+ && variables.ulm_card_dynamic_color) {
71
+ return "contrast(0.6) saturate(1.7)";
72
+ }
73
+ ]]]
74
+ - color : >-
75
+ [[[
76
+ if (variables.ulm_custom_card_esh_room_light_entity) {
77
+ var color = states[variables.ulm_custom_card_esh_room_light_entity].attributes.rgb_color;
78
+ if (states[variables.ulm_custom_card_esh_room_light_entity].state == "on") {
79
+ if (color && variables.ulm_card_dynamic_color) {
80
+ return 'rgba(' + color + ', 1)';
81
+ }
82
+ return 'rgba(var(--color-yellow), 1)';
83
+ }
84
+ }
85
+ return 'rgba(var(--color-theme), 0.2)';
86
+ ]]]
50
87
img_cell :
51
- - background-color : " rgba(var(--color-theme),0.05)"
52
88
- border-radius : " 50%"
53
- - place-self : " center "
89
+ - place-self : " flex-start "
54
90
- width : " 42px"
55
91
- height : " 42px"
92
+ - margin-left : " 12px"
93
+ - background-color : >-
94
+ [[[
95
+ if (variables.ulm_custom_card_esh_room_light_entity) {
96
+ var color = states[variables.ulm_custom_card_esh_room_light_entity].attributes.rgb_color;
97
+ if (states[variables.ulm_custom_card_esh_room_light_entity].state == "on") {
98
+ if (color && variables.ulm_card_dynamic_color) {
99
+ return 'rgba(' + color + ', 0.3)';
100
+ }
101
+ return 'rgba(var(--color-yellow), 0.2)';
102
+ }
103
+ }
104
+ return 'rgba(var(--color-theme), 0.05)';
105
+ ]]]
56
106
name :
57
107
- align-self : " end"
58
108
- justify-self : " start"
@@ -62,25 +112,47 @@ card_esh_room:
62
112
- margin-top : >-
63
113
[[[
64
114
if (variables.ulm_custom_card_esh_room_light_entity && variables.ulm_custom_card_esh_room_climate_entity) {
65
- return "8px";
115
+ return "8px";
66
116
} else if (variables.ulm_custom_card_esh_room_light_entity) {
67
- return "12px";
117
+ return "12px";
68
118
} else if (variables.ulm_custom_card_esh_room_climate_entity) {
69
- return "8px";
119
+ return "8px";
70
120
} else {
71
- return "12px";
121
+ return "12px";
72
122
}
73
123
]]]
74
124
- max-width : >-
75
125
[[[
76
126
if (variables.ulm_custom_card_esh_room_light_entity && variables.ulm_custom_card_esh_room_climate_entity) {
77
- return "85%";
127
+ return "85%";
78
128
} else if (variables.ulm_custom_card_esh_room_light_entity) {
79
- return "100%";
129
+ return "100%";
80
130
} else if (variables.ulm_custom_card_esh_room_climate_entity) {
81
- return "85%";
131
+ return "85%";
82
132
} else {
83
- return "100%";
133
+ return "100%";
134
+ }
135
+ ]]]
136
+ - color : >-
137
+ [[[
138
+ if (variables.ulm_custom_card_esh_room_light_entity) {
139
+ var color = states[variables.ulm_custom_card_esh_room_light_entity].attributes.rgb_color;
140
+ if (states[variables.ulm_custom_card_esh_room_light_entity].state == "on") {
141
+ if (color && variables.ulm_card_dynamic_color) {
142
+ return 'rgba(' + color + ', 1)';
143
+ }
144
+ return 'rgba(var(color-yellow-text), 1)';
145
+ }
146
+ return 'rgba(var(--color-theme), 0.6)';
147
+ }
148
+ return 'rgba(var(--color-theme), 0.6)';
149
+ ]]]
150
+ - filter : >-
151
+ [[[
152
+ if (variables.ulm_custom_card_esh_room_light_entity
153
+ && states[variables.ulm_custom_card_esh_room_light_entity].state == "on"
154
+ && variables.ulm_card_dynamic_color) {
155
+ return "contrast(0.6) saturate(1.7)";
84
156
}
85
157
]]]
86
158
label :
@@ -93,25 +165,25 @@ card_esh_room:
93
165
- margin-bottom : >-
94
166
[[[
95
167
if (variables.ulm_custom_card_esh_room_light_entity && variables.ulm_custom_card_esh_room_climate_entity) {
96
- return "0px";
168
+ return "0px";
97
169
} else if (variables.ulm_custom_card_esh_room_light_entity) {
98
- return "3px";
170
+ return "3px";
99
171
} else if (variables.ulm_custom_card_esh_room_climate_entity) {
100
- return "0px";
172
+ return "0px";
101
173
} else {
102
- return "3px";
174
+ return "3px";
103
175
}
104
176
]]]
105
177
- max-width : >-
106
178
[[[
107
179
if (variables.ulm_custom_card_esh_room_light_entity && variables.ulm_custom_card_esh_room_climate_entity) {
108
- return "85%";
180
+ return "85%";
109
181
} else if (variables.ulm_custom_card_esh_room_light_entity) {
110
- return "100%";
182
+ return "100%";
111
183
} else if (variables.ulm_custom_card_esh_room_climate_entity) {
112
- return "85%";
184
+ return "85%";
113
185
} else {
114
- return "100%";
186
+ return "100%";
115
187
}
116
188
]]]
117
189
state :
@@ -125,20 +197,20 @@ card_esh_room:
125
197
light :
126
198
- display : >
127
199
[[[
128
- if (variables.ulm_custom_card_esh_room_light_entity) {
129
- return "block";
130
- } else {
131
- return "none";
132
- }
200
+ if (variables.ulm_custom_card_esh_room_light_entity) {
201
+ return "block";
202
+ } else {
203
+ return "none";
204
+ }
133
205
]]]
134
206
climate :
135
207
- display : >
136
208
[[[
137
- if (variables.ulm_custom_card_esh_room_climate_entity) {
138
- return "block";
139
- } else {
140
- return "none";
141
- }
209
+ if (variables.ulm_custom_card_esh_room_climate_entity) {
210
+ return "block";
211
+ } else {
212
+ return "none";
213
+ }
142
214
]]]
143
215
custom_fields :
144
216
light :
@@ -150,9 +222,18 @@ card_esh_room:
150
222
icon : " mdi:lightbulb"
151
223
styles :
152
224
icon :
153
- - color : " rgba(var(--color-yellow),1)"
225
+ - color : " rgba(var(--color-yellow), 1)"
154
226
img_cell :
155
- - background-color : " rgba(var(--color-yellow), 0.2)"
227
+ - background-color : >-
228
+ [[[
229
+ if (variables.ulm_custom_card_esh_room_light_entity) {
230
+ var color = states[variables.ulm_custom_card_esh_room_light_entity].attributes.rgb_color;
231
+ if (color && variables.ulm_card_dynamic_color) {
232
+ return 'rgba(' + color + ', 0.3)';
233
+ }
234
+ }
235
+ return 'rgba(var(--color-yellow), 0.2)';
236
+ ]]]
156
237
- value : " off"
157
238
icon : " mdi:lightbulb-off"
158
239
type : " custom:button-card"
@@ -163,8 +244,7 @@ card_esh_room:
163
244
[[[
164
245
let vars = {};
165
246
vars.ulm_card_light_enable_popup = variables.ulm_card_light_enable_popup;
166
-
167
- if(variables.ulm_card_light_enable_popup) {
247
+ if (variables.ulm_card_light_enable_popup) {
168
248
vars.ulm_custom_popup = {
169
249
'template': 'popup_light_brightness',
170
250
'popup_variables': {
@@ -174,7 +254,6 @@ card_esh_room:
174
254
}
175
255
return vars;
176
256
]]]
177
-
178
257
climate :
179
258
card :
180
259
entity : " [[[ return variables.ulm_custom_card_esh_room_climate_entity ]]]"
@@ -235,8 +314,7 @@ card_esh_room:
235
314
[[[
236
315
let vars = {};
237
316
vars.ulm_card_thermostat_enable_popup = variables.ulm_card_light_enable_popup;
238
-
239
- if(variables.ulm_card_thermostat_enable_popup) {
317
+ if (variables.ulm_card_thermostat_enable_popup) {
240
318
vars.ulm_custom_popup = {
241
319
'template': 'popup_thermostat_temperature',
242
320
'popup_variables': {
0 commit comments