-
Notifications
You must be signed in to change notification settings - Fork 1
/
card.txt
460 lines (458 loc) · 15.6 KB
/
card.txt
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
type: custom:button-card
variables:
power_meter: sensor.generale_power
triggers_update: all
styles:
card:
- background-color: var(--card-background-color)
- border-radius: 20px
grid:
- grid-template-areas: |-
" logo logo watt watt watt . "
" . marquee marquee marquee marquee . "
" graph graph graph graph graph graph "
" . lista setting push media . "
- grid-template-columns: 1.4vw repeat(4, 1fr) 1.3vw
- grid-template-rows: min-content 1vw min-content min-content
- grid-column-gap: 0.1em
custom_fields:
marquee:
card:
type: custom:button-card
tap_action:
action: none
style: |
ha-card {
background: none;
border: 100px;
}
name: |
[[[
if (states['sensor.marquee_power_control'].state !== 'unknown') {
return `<marquee style="width: 100%; margin-right: 150px; margin-top: 14px;"><span style='color: var(--secondary-text-color);'>${states['sensor.marquee_power_control'].state}</span></marquee>`;
} else {
return `<marquee style="width: 100%; margin-right: 150px; margin-top: 14px;"><span style='color: var(--secondary-text-color);'>In attesa della prima attivazione</span></marquee>`;
}
]]]
watt:
card:
type: custom:button-card
label: |
[[[
return 'Istantaneo '+ states[variables.power_meter].state + 'W';
]]]
show_label: true
tap_action:
action: none
name: Power Control
styles:
grid:
- grid-template-areas: |-
" l"
" n "
" timer "
label:
- font-color: var(--secondary-text-color)
- justify-self: left
- padding-left: 28px
- margin-top: 14px
card:
- background-color: transparent
- border-style: none
- height: 120px
name:
- font-weight: bold
- font-size: clamp(16px, 30px, 35px)
- letter-spacing: "-2.0px"
- justify-self: left
- padding-left: 25px
- color: var(--primary-text-color)
custom_fields:
timer:
card:
type: custom:button-card
entity: timer.distacco_carico
layout: name_state
name: |
[[[
if (states['input_boolean.check_distacco'].state === 'on') {
return 'Protezione in corso 🛡️ '; }
else if (states['timer.distacco_carico'].state !== 'idle') {
return 'Distacco tra '; }
else {
return 'Assorbimento: Ok👍'; }
]]]
show_icon: false
show_state: |
[[[
return (states['timer.distacco_carico'].state !== 'idle');
]]]
styles:
card:
- background-color: |
[[[
if (states['input_boolean.check_distacco'].state === 'on') {
return 'Chocolate'; }
else if (states['timer.distacco_carico'].state !== 'idle') {
return 'red'; }
else {
return 'var(--disabled-text-color)';}
]]]
- border-style: none
- width: calc(140% - 5px)
- height: 30px
- margin-left: 6px
- justify-self: left
name:
- margin-left: "-4px"
- margin-top: "-4px"
logo:
card:
type: custom:button-card
color: transparent
entity: automation.power_control
name: |
[[[
if (states['automation.power_control'].state == 'on') return "Attivo";
else return "Spento";
]]]
icon: |
[[[
if (states['automation.power_control'].state == 'on') return "mdi:head-flash";
else return "mdi:hand-back-right-off";
]]]
show_entity_picture: false
styles:
card:
- background-color: |
[[[
if (states['automation.power_control'].state == 'on') return "OliveDrab ";
else return "#606060";
]]]
- border-radius: 30%
- border-style: none
- padding-bottom: 6px
- width: 70%
- margin-left: 30%
name:
- font-weight: bold
- font-size: clamp(12px, 1vw, 15px)
- color: var(--primay-text-color)
icon:
- width: calc(70% - 8px)
- color: |
[[[
if (states['automation.power_control'].state == 'on') return "white ";
else return "#252525";
]]]
tap_action:
action: call-service
service: automation.toggle
service_data:
entity_id: automation.power_control
graph:
card:
type: custom:apexcharts-card
graph_span: 3h
header:
show: true
show_states: false
colorize_states: true
series:
- entity: "[[[return variables.power_meter ]]]"
stroke_width: 2
show:
extremas: true
card_mod:
style: |
ha-card {
border: 100px;
background: none;
width: 97%;
padding-left: 10px
}
lista:
card:
type: custom:button-card
icon: mdi:view-list-outline
show_state: false
show_icon: true
show_name: false
styles:
card:
- background-color: var(--primary-color)
- border-radius: 18px
- border-style: none
- box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.2)
- height: 50px
- width: 70px
icon:
- width: 30px
- height: 30px
- color: white
- align-self: start
- text-align: start
- padding: 8px
tap_action:
action: fire-dom-event
browser_mod:
service: browser_mod.popup
data:
card_mod:
style: |
:host {
--ha-card-background: var(--app-header-background-color);
--mdc-dialog-scrim-color: rgba(15,15,15,0.9);
}
content:
type: vertical-stack
cards:
- type: custom:mushroom-select-card
style: |
ha-card {
background: var(--ha-card-background);
border: 100px;
border-radius: 0px;
}
entity: select.escludi_dispositivi_dal_ripristino_carico
fill_container: true
icon_type: none
secondary_info: none
- type: markdown
style: |
ha-card {
background: var(--ha-card-background);
border: 100px;
border-radius: 0px;
}
content: >-
``` {% if
state_attr('sensor.dispositivi_esclusi_dal_ripristino_carico',
'list_exclude') is not none and
state_attr('sensor.dispositivi_esclusi_dal_ripristino_carico',
'list_exclude')|count != 0 %} {% for t in
state_attr('sensor.dispositivi_esclusi_dal_ripristino_carico',
'list_exclude') %}
{{ states[t].name -}}
{% endfor %} {% else %}
Nessuno
{% endif %}
- type: markdown
style: |
ha-card {
background: var(--ha-card-background);
border: 100px;
border-radius: 0px;
}
content: |-
**<center>Lista carichi<center>**
{% from 'power_control.jinja' import dict_device %}
{% set my_dict = (dict_device() | from_json) %}
| Dispositivo | Stato | Consumo |
|:--------|:---------:|:-------------:|
|{% for device_name, device_info in my_dict.items() %}
| {{ device_name }} | {{ device_info['state'] | upper }} | {{ device_info['power'] ~ ' W' if device_info['power'] != 'sconosciuto'}} |
|{% endfor %}
setting:
card:
type: custom:button-card
color: transparent
show_name: false
name: Power
icon: mdi:cog
styles:
card:
- background-color: var(--primary-color)
- border-radius: 18px
- border-style: none
- box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.2)
- width: 70px
- aspect-ratio: 1/0.7
icon:
- color: white
- align-self: center
tap_action:
action: fire-dom-event
browser_mod:
service: browser_mod.popup
data:
card_mod:
style: |
:host {
--mdc-dialog-scrim-color: rgba(15,15,15,0.9);
}
content:
type: custom:button-card
styles:
card:
- background-color: transparent
- border-radius: 20px
grid:
- grid-template-areas: |-
" . tempi soglie . "
" . rit_dist dis_carichi . "
" . rit_ripr dis_emergenza . "
- grid-template-columns: 0.1vw repeat(2, 1fr) 0.1vw
- grid-column-gap: 0.3em
- grid-row-gap: 0.3em
custom_fields:
tempi:
card:
style: |
ha-card {
background: none;
border: 100px;
}
type: custom:button-card
name: Tempi
styles:
name:
- font-weight: bolder
tap_action:
action: none
rit_dist:
card:
type: custom:mushroom-number-card
entity: input_number.ritardo_distacco_carico
layout: vertical
icon_color: green
tap_action:
action: none
hold_action:
action: none
double_tap_action:
action: none
card_mod:
style: |
:host {
--ha-card-background: var(--card-background-color);
--mdc-dialog-scrim-color: rgba(15,15,15,0.9);
}
rit_ripr:
card:
type: custom:mushroom-number-card
entity: input_number.ripristino_carico
layout: vertical
icon_color: red
tap_action:
action: none
hold_action:
action: none
double_tap_action:
action: none
card_mod:
style: |
:host {
--ha-card-background: var(--card-background-color);
--mdc-dialog-scrim-color: rgba(15,15,15,0.9);
}
soglie:
card:
style: |
ha-card {
background: none;
border: 100px;
}
type: custom:button-card
name: Valori
styles:
name:
- font-weight: bolder
tap_action:
action: none
dis_carichi:
card:
type: custom:mushroom-number-card
entity: input_number.distacco_carico
layout: vertical
card_mod:
style: |
:host {
--ha-card-background: var(--card-background-color);
--mdc-dialog-scrim-color: rgba(15,15,15,0.9);
}
dis_emergenza:
card:
type: custom:mushroom-number-card
entity: input_number.distacco_urgente
layout: vertical
tap_action:
action: none
hold_action:
action: none
double_tap_action:
action: none
card_mod:
style: |
:host {
--ha-card-background: var(--card-background-color);
--mdc-dialog-scrim-color: rgba(15,15,15,0.9);
}
push:
card:
type: custom:button-card
color: transparent
show_name: false
icon: |
[[[
if (states['automation.notify_control_power_push'].state == 'on') return "mdi:cellphone-check";
else return "mdi:cellphone-off";
]]]
styles:
card:
- background-color: |
[[[
if (states['automation.notify_control_power_push'].state == 'on') return "var(--primary-color)";
else return "var(--disabled-color)";
]]]
- border-radius: 18px
- border-style: none
- box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.2)
- width: 70px
- aspect-ratio: 1/0.7
icon:
- align-self: center
- color: |
[[[
if (states['automation.notify_control_power_push'].state == 'on') return "white ";
else return "dimGray";
]]]
tap_action:
action: call-service
service: automation.toggle
service_data:
entity_id: automation.notify_control_power_push
media:
card:
type: custom:button-card
color: transparent
show_name: false
icon: |
[[[
if (states['automation.notify_control_power_media_player'].state == 'on') return "mdi:account-voice";
else return "mdi:speaker-off";
]]]
styles:
card:
- background-color: |
[[[
if (states['automation.notify_control_power_media_player'].state == 'on') return "var(--primary-color)";
else return "var(--disabled-color)";
]]]
- border-radius: 18px
- border-style: none
- box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.2)
- width: 70px
- aspect-ratio: 1/0.7
icon:
- align-self: center
- color: |
[[[
if (states['automation.notify_control_power_media_player'].state == 'on') return "white ";
else return "dimGray";
]]]
tap_action:
action: call-service
service: automation.toggle
service_data:
entity_id: automation.notify_control_power_media_player