forked from caiosweet/Package-Natural-Events
-
Notifications
You must be signed in to change notification settings - Fork 0
/
card_natural_events_light.yaml
681 lines (656 loc) · 30.3 KB
/
card_natural_events_light.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
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
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
#################################################################
## NATURAL EVENTS VERTICAL STACK
#################################################################
type: custom:vertical-stack-in-card
style: |
ha-card {
{# imposta colore sfondo e bordo di tutta la scheda #}
background-color: var(--ha-card-background); {# oppure trasparent; #}
{# oppure background: --ha-card-background: var(--ha-card-background); #}
border:
1px solid {% if is_state('binary_sensor.global_natural_alert', 'on') %}
{{state_attr('binary_sensor.global_natural_alert','level')}} {% else %} Green {% endif %};
}
cards:
#################################################################
## HEADER
#################################################################
- type: markdown
entity_id: binary_sensor.global_natural_alert
style: |
{% set global = 'binary_sensor.global_natural_alert' %}
@keyframes blink {
30% {
background: {% if is_state(global, 'on') %} gray {% endif %};
}
}
ha-card {
border-radius: var(--ha-card-border-radius) var(--ha-card-border-radius) 0px 0px;
box-shadow: none;
{% if is_state(global, 'on') %}
animation: blink 2s linear 3;
background: {{state_attr(global,'level')}};
color: {% if state_attr(global,'level') in ['White','Yellow','Orange'] %} var(--disabled-text-color) {% endif %};
{% else %}
background: Green; border-color: Green;
{% endif %}
}
}
content: |
{% set global = 'binary_sensor.global_natural_alert' %}
{% set summary = states('sensor.dark_sky_daily_summary') %}
{% set risk = {'Green':'Verde', 'Yellow':'Gialla', 'Orange':'Arancione', 'Red':'Rossa'} %}
{% if is_state(global, 'on') %}
<center><b><ha-icon icon="mdi:alarm-light"></ha-icon> EVENTI NATURALI -
MAX ALLERTA {{risk[state_attr(global,'level')]|upper}} <ha-icon icon="{{state_attr(global,'icon')}}"></ha-icon>
{% else %}
<center><ha-icon icon="mdi:shield-check"></ha-icon> NESSUN EVENTO SEGNALATO
<center>{{'' if summary == 'unknown' else summary }}
{% endif %}
#################################################################
## FOLDS
#################################################################
- type: conditional # CARDS VISUALIZZATE SOLO SE INPUT BOOLEAN NATURAL EVENTS ON!!
conditions:
- entity: input_boolean.natural_events
state: 'on'
card:
type: vertical-stack
cards:
- type: entities # CONTENITORE MENU Impostazioni fold
style: |
div#states.card-content {padding-block-end: 0; padding-block-start: 0;}
ha-card {background:none; border-radius: 0px; box-shadow: none;}
entities:
- type: custom:auto-entities # MENU Impostazioni fold
show_empty: false
filter:
include:
- attributes:
package: Natural_events
options:
state_color: true
exclude:
- entity_id: input_boolean.natural_events
- domain: binary_sensor
- domain: group
- domain: sensor
- domain: script
- domain: zone
card:
type: custom:fold-entity-row
head:
entity: input_boolean.natural_events
tap_action:
action: toggle
style: |
:host {
{% if is_state('input_boolean.natural_events', 'on') %}
--paper-item-icon-color: var(--paper-item-icon-active-color);
{% endif %}
}
- type: custom:fold-entity-row # 1 group.meteoalert
style: |
#head {
{% if is_state('group.meteoalert', 'on') %}
--paper-item-icon-color: var(--paper-item-icon-active-color);
{% endif %}
}
# padding: 0 #Allinea icone a sx
head:
entity: group.meteoalert
state_color: true
group_config:
state_color: true
secondary_info: last-changed
style: |
:host {
{% set color = {0:'var(--primary-text-color)', 1:'Green', 2:'Yellow', 3:'Orange', 4:'Red'} %}
color: {% if 'dpc' in config.entity %} {{color[state_attr(config.entity, 'level')|int]}}
{% elif 'binary_sensor.meteoalarm' in config.entity %}
{{state_attr('binary_sensor.global_natural_alert','meteoalarm_level')}}
{% elif 'burze' in config.entity and states(config.entity) == 'on'%}
{% set d = state_attr(config.entity,'distance') %}
{% if d %}
{% if d <= 1 %}Red{% elif 1 < d <= 5 %}Orange{% elif 5 < d <= 10 %}Yellow{% else %}Green{% endif %}
{% endif %}
{% endif %};
{% if 'meteoalarm_custom' in config.entity and states(config.entity) > '0' %}
--paper-item-icon-color: var(--paper-item-icon-active-color);
{% endif %}
}
- type: custom:fold-entity-row # 2 group.geoalert
style: |
#head {
{% if is_state('group.geoalert', 'on') %}
--paper-item-icon-color: var(--paper-item-icon-active-color);
{% endif %}
}
head:
entity: group.geoalert
state_color: true
group_config:
state_color: true
secondary_info: last-changed
style: |
:host {
{% set color = {0:'var(--primary-text-color)', 1:'Green', 2:'Yellow', 3:'Orange', 4:'Red'} %}
color: {% if 'dpc' in config.entity %} {{color[state_attr(config.entity, 'level')|int]}}
{% elif 'meteoalarm' in config.entity %} {{state_attr('binary_sensor.global_natural_alert','meteoalarm_level')}}
{% elif 'quake' in config.entity and states('binary_sensor.lastquake') == 'on' %} {{color[state_attr('binary_sensor.lastquake', 'level')|int]}}
{% endif %};
{% if 'gdacs' in config.entity and states(config.entity) > '0' %} --paper-item-icon-color: var(--paper-item-icon-active-color);{% endif %}
}
#################################################################
## AUTOENTITIES SENSORS ON AND BUTTONS MAPS
#################################################################
- type: conditional # CARDS VISUALIZZATE SOLO SE INPUT BOOLEAN NATURAL EVENTS OFF!!
conditions:
- entity: input_boolean.natural_events
state: 'off'
card:
type: custom:auto-entities # SENSORI ON + Pulsanti MAPS
card:
type: entities
show_empty: false
style: |
ha-card { background: none; border-radius: 0px; box-shadow: none; }
# .card-content {padding: 0px}
div#states.card-content {padding-block-end: 0; padding-block-start: 0;}
header:
type: custom:paper-buttons-row
buttons:
- entity: input_boolean.natural_events
name: Info
- entity: group.natural_events
name: Map
icon: mdi:image-off
style:
button:
color: var(--paper-item-icon-color)
ripple:
color: orange
tap_action:
action: call-service
service: input_select.select_option
service_data:
entity_id: input_select.geo_map, input_select.meteo_map, input_select.meteo_iframe
option: Nessuna
- entity: input_select.geo_map
name: Geo
tap_action:
action: call-service
service: input_select.select_next
service_data:
entity_id: input_select.geo_map
style:
button:
color: var(--paper-item-icon-active-color)
state_styles:
Nessuna:
button:
color: var(--paper-item-icon-color)
- entity: input_select.meteo_map
name: Meteo
state_text:
Nuvole Infrared: Notte
Nuvole e Sole: Giorno
Pioggia: Pioggia
Neve: Neve
Il Meteo: Il meteo
Burze: Burze
Burze Nord Ovest: Burze NO
Burze Nord Est: Burze NE
Burze Sud Ovest: Burze SO
Burze Sud Est: Burze SE
WWLLN: WWLLN
tap_action:
action: call-service
service: input_select.select_next
service_data:
entity_id: input_select.meteo_map
style:
button:
color: var(--paper-item-icon-active-color)
state_styles:
Nessuna:
button:
color: var(--paper-item-icon-color)
- entity: input_select.meteo_iframe
name: I-Frame
state_text:
Windy Alert: Alert
Protezione Civile: DPC
Blitzortung: Blitz
tap_action:
action: call-service
service: input_select.select_next
service_data:
entity_id: input_select.meteo_iframe
style:
button:
color: var(--paper-item-icon-active-color)
state_styles:
Nessuna:
button:
color: var(--paper-item-icon-color)
entities:
# - type: divider
- type: conditional
conditions:
- entity: binary_sensor.global_natural_alert
state: 'on'
row:
type: divider
filter:
exclude:
- entity_id: 'binary_sensor.global_natural_alert'
- entity_id: 'binary_sensor.shakemap'
include:
- entity_id: 'binary_sensor.*'
state: 'on'
attributes:
package: Natural_events
options:
entity: this.entity_id
secondary_info: last-changed
state_color: true
style: |
:host {
--color:
{% set color = {0:'White', 1:'Green', 2:'Yellow', 3:'Orange', 4:'Red'} %}
{% if 'dpc' in config.entity %} {{color[state_attr(config.entity, 'level')|int]}}
{% elif 'meteoalarm' in config.entity %} {{state_attr('binary_sensor.global_natural_alert','meteoalarm_level')}}
{% elif 'quake' in config.entity %} {{color[state_attr('binary_sensor.lastquake', 'level')|int]}}
{% elif 'burze' in config.entity and states(config.entity) == 'on'%}
{% set d = state_attr(config.entity,'distance') %}
{% if d %}
{% if d <= 1 %}Red{% elif 1 < d <= 5 %}Orange{% elif 5 < d <= 10 %}Yellow{% else %}Green{% endif %}
{% endif %}
{% endif %};
color: var(--color);
{#--paper-item-icon-color: var(--color); #}
}
- entity_id: 'sensor.m*'
state: '> 0'
attributes:
package: Natural_events
options:
entity: this.entity_id
secondary_info: last-changed
style: |
:host {
{% set dict_code={'Green':'1','Yellow':'2','Orange':'3','Red':'4'} %}
{% set color = {0:'White', 1:'Green', 2:'Yellow', 3:'Orange', 4:'Red'} %}
{% macro code() %}
{%- for s in ['today', 'tomorrow'] -%}
{% set v = state_attr('sensor.meteoalarm_custom', s) -%}
{% if v -%}
{% for d in v -%}
{{dict_code[d['code']]}}
{% endfor -%}
{% endif -%}
{%- endfor -%}
{% endmacro -%}
--color: {{color[code()|max|int]}};
color: var(--color);
--paper-item-icon-color: var(--paper-item-icon-active-color);
}
#################################################################
## INFO
#################################################################
- type: conditional # CARDS VISUALIZZATE SOLO SE INPUT BOOLEAN NATURAL EVENTS ON!!
conditions:
- entity: input_boolean.natural_events
state: 'on'
card:
type: vertical-stack
cards:
#################################################################
## BURZE
#################################################################
- type: conditional # BURZE conditional divider markdown
conditions:
- entity: binary_sensor.burze_storms_nearby
state: 'on'
card:
type: markdown
style: |
ha-card {background: none; border-radius: 0px; box-shadow: none;}
content: >-
___
#### TEMPORALI
<font color= var(--error-color)>{{state_attr('binary_sensor.burze_storms_nearby', 'number')}}</font>
<font color= yellow><ha-icon icon="mdi:flash" style="width: 24px; height: 24px; transform: rotate(35deg);"></ha-icon></font>
in <font color= var(--error-color)> {{state_attr('binary_sensor.burze_storms_nearby', 'period')}}</font> minuti.
Il più vicino è caduto a <font color= var(--error-color)> {{state_attr('binary_sensor.burze_storms_nearby', 'distance')}} Km </font>
a <font color= var(--error-color)> {{state_attr('binary_sensor.global_natural_alert','burze_direction')}} </font>
</font> da casa.
[Burze](https://burze.dzis.net) ~ [Blitzortung](http://map.blitzortung.org/#5.11/43.00/13.00)
#################################################################
## DPC
#################################################################
- type: 'custom:auto-entities' # DPC conditional divider markdown
show_empty: false
filter:
include:
- entity_id: binary_sensor.dpc_*
state: 'on'
# attributes:
# level: '> 0'
card:
type: markdown
entity_id: this.entity_id
style: |
ha-card {background: none; border-radius: 0px; box-shadow: none;}
# .card-content {padding: 0}
content: >
___
#### PROTEZIONE CIVILE
{% set color = {0:'White', 1:'Green', 2:'Yellow', 3:'Orange', 4:'Red'} %}
{% for e in config.entities %}
<font color= {{color[state_attr(e.entity, 'level')|int]}}>
<ha-icon icon="{{ 'mdi:numeric-' ~ state_attr(e.entity, 'level')|int ~ '-box'}}" style="width: 36px; height: 36px;"></ha-icon>
<ha-icon icon="{{ state_attr(e.entity, 'icon')}}" style="width: 36px; height: 36px;"></ha-icon>
{{state_attr(e.entity, 'friendly_name')}} - {{state_attr(e.entity, 'allerta')}} {{state_attr(e.entity, 'info')}}</font>
{%- endfor %}
[Protezione Civile](http://www.protezionecivile.it/home) ~ [Vigilanza Meteo](http://www.protezionecivile.gov.it/dettaglio/-/journal_content/56/20182/1131180?refererPlid=42041&controlPanelCategory=current_site.content)
~ [Criticità Idro](http://www.protezionecivile.gov.it/attivita-rischi/meteo-idro/attivita/previsione-prevenzione/centro-funzionale-centrale-rischio-meteo-idrogeologico/previsionale/bollettini-criticita/bollettino-odierno) ~ [Radar](http://www.protezionecivile.gov.it/radar-dpc)
#################################################################
## METEOALARM
#################################################################
- type: conditional
conditions:
- entity: binary_sensor.meteoalarm
state: 'on'
card:
type: markdown
style: |
ha-card {background: none; border-radius: 0px; box-shadow: none;}
content: >
___
#### METEOALARM
{% set global = 'binary_sensor.global_natural_alert' %}
{% set l = state_attr('binary_sensor.meteoalarm', 'awareness_level')%}
{% set t = state_attr('binary_sensor.meteoalarm', 'awareness_type')%}
<font color= {{state_attr(global,'meteoalarm_level')}}> <ha-icon icon="{{state_attr(global, 'meteoalarm_level_icon')}}"></ha-icon></font>
<font color= {{state_attr(global,'meteoalarm_level')}}> <ha-icon icon="{{state_attr(global, 'meteoalarm_type_icon')}}"></ha-icon></font>
<font color= {{state_attr(global,'meteoalarm_level')}}> {{state_attr('binary_sensor.meteoalarm', 'event')}}
<img src="https://www.meteoalarm.eu/documents/rss/wflag-l{{'0' if not l else l.split(';')[0]}}-t{{'0' if not t else t.split(';')[0]}}.jpg"></font>
<font color= var(--primary-text-color)> **{{state_attr('binary_sensor.meteoalarm', 'urgency')|upper}}**</font><br>
{% set days = ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"] %}
{% set start = as_timestamp(state_attr('binary_sensor.meteoalarm', 'effective')) %}
{% set end = as_timestamp(state_attr('binary_sensor.meteoalarm', 'expires')) %}
<font>Da {{days[start|timestamp_custom('%w')|int]}}{{start|timestamp_custom(' %d alle %H:%M')}}</font>
a {{days[end|timestamp_custom('%w')|int]}}{{end|timestamp_custom(' %d alle %H:%M')}}</font><br><br>
**Titolo**<br>
<font color= var(--primary-text-color)> {{state_attr('binary_sensor.meteoalarm', 'headline')}} </font><br><br>
**Descrizione**<br>
<font color= var(--primary-text-color)> {{state_attr('binary_sensor.meteoalarm', 'description')}} </font><br><br>
**Istruzioni**<br>
<font color= var(--primary-text-color)> {{state_attr('binary_sensor.meteoalarm', 'instruction')}} </font><br><br>
[MeteoAlarm]({{state_attr('binary_sensor.meteoalarm', 'web')}})
- type: conditional
conditions:
- entity: sensor.meteoalarm_custom
state_not: '0'
card:
type: markdown
style: |
ha-card {background: none; border-radius: 0px; box-shadow: none;}
content: >
___
#### METEOALARM CUSTOM
{%set day = {'today':'Oggi', 'tomorrow':'Domani'} %}
{%set color = {'Green':'Verde', 'Yellow':'Gialla', 'Orange':'Arancione', 'Red':'Rossa'} %}
{%set dict_code={'Green':'1','Yellow':'2','Orange':'3','Red':'4'}%}
{%set dict_type={'No-warnings': 'Nessun Avviso','Wind': 'Vento',
'Snow/ice': 'Neve-Ghiaccio','Thunderstorms': 'Temporali',
'Fog': 'Nebbia','High/temperature': 'Caldo intenso',
'Low-temperature': 'Freddo intenso',
'Costal-event': 'Eventi Costieri','Forest/fire': 'Incendi bischivi',
'Avalanche': 'Valanghe','Rain': 'Pioggia',
'Unavailable': 'Non disponibile','Flooding': 'Alluvione',
'Rain/flooding': 'Pioggia/Alluvione'}%}
{%set type={'No-warnings': '0','Wind': '1',
'Snow/ice': '2','Thunderstorms': '3',
'Fog': '4','High/temperature': '5',
'Low-temperature': '6',
'Costal-event': '7','Forest/fire': '8',
'Avalanche': '9','Rain': '10',
'Unavailable': '11','Flooding': '12',
'Rain/flooding': '13'}%}
{%- if not is_state('sensor.meteoalarm_custom', '0') -%}
{%- for s in ['today', 'tomorrow'] -%}
{%- set v = state_attr('sensor.meteoalarm_custom', s) -%}
{%- if v -%}
{%- for d in v %}
{% set l = dict_code[d['code']] %}
{% set t = type[d['event']] %}
**{{day[s]}}:** <img src="https://www.meteoalarm.eu/documents/rss/wflag-l{{'0' if not l else l.split(';')[0]}}-t{{'0' if not t else t.split(';')[0]}}.jpg"> <font color= {{d['code']}}>**{{dict_type[d['event']]}}** </font>
**Allerta:** <font color= {{d['code']}}><ha-icon icon="{{'mdi:numeric-'~dict_code[d['code']]~'-box'}}" style="width: 36px; height: 36px;"></ha-icon>{{color[d['code']]}}</font><br>
Descrizione: <font color= var(--primary-text-color)>{{d['italiano']}}</font><br>
Data: <font color= var(--primary-text-color)>{{d['start']|trim("CEST")|replace('.','/')}} - {{d['end']|trim("CEST")|replace('.','/')}}</font><br>
{%- endfor -%}
{%- endif -%}
{%- endfor -%}
{%- endif %}
[MeteoAlarm]({{state_attr('binary_sensor.meteoalarm', 'web')}})
#################################################################
## LASTQUAKE
#################################################################
- type: conditional # TERREMOTO conditional
conditions:
- entity: binary_sensor.lastquake
state: 'on'
card:
type: vertical-stack
cards:
- type: markdown
style: |
ha-card {background: none; border-radius: 0px; box-shadow: none; color: var(--secondary-text-color);}
content: >-
___
#### TERREMOTI - ULTIME 24h
[<img src="https://www.hsit.it/images/favicon.png"/> Hai Sentito Il Terremoto](http://www.haisentitoilterremoto.it/)
<!-- Setting -->
{%- set person = 'person.claudio' -%}
{%- set url = "http://shakemap.rm.ingv.it/shake/{}/download/{}.jpg" -%}
{%- set entityid = 'binary_sensor.lastquake' -%}
{%- set id = state_attr(entityid, 'event_id') -%}
{%- set data_utc = state_attr(entityid, 'publication_date') -%}
{%- set magnitudo = (state_attr(entityid, 'magnitude')|float) if not none else '0' -%}
{%- set code = {0:'White', 1:'Green', 2:'Yellow', 3:'Orange', 4:'Red'} -%}
{%- set color = code[state_attr('binary_sensor.lastquake', 'level')|int] -%}
{%- set lat = state_attr(entityid, 'lat') -%}
{%- set long = state_attr(entityid, 'long') -%}
<font color= var(--primary-text-color)>
**<font color={{color}}>{{as_timestamp(data_utc)|timestamp_custom ('%H:%M:%S del %d/%m/%Y')}}</font>**<br><br>
Un terremoto di magnitudo **<font color={{color}}>{{magnitudo}}</font>**<br>
è avvenuto nella zona: [{{state_attr(entityid, 'region')}}](http://maps.google.com/maps?z=8&q=loc:{{lat}}+{{long}})<br>
a <font color={{color}}>**{{state_attr(entityid, 'distance')}}**</font> km da casa,<br>
con coordinate geografiche (lat, long) {{lat}},{{long}}.<br>
{{("Tu ti trovi a " ~ distance(lat, long, person)) ~ " km dall'epicentro." if is_state(person, 'not_home') else ''}}
</font>
{% if magnitudo >= 3 %}<br>
[Shakemap]({{url.format(id,'intensity')}}) ~
[PGA]({{url.format(id,'pga')}}) ~ [PGV]({{url.format(id,'pgv')}}) ~ [TvMap]({{url.format(id,'tvmap')}}) ~ [TvMap2]({{url.format(id,'tvmap_bare')}}) ~
[HaiSentitoIlTerremoto](http://eventi.haisentitoilterremoto.it/{{id}}/{{id}}_mcs.jpg)
<!-- Scegli il titpo di immagine da visualizzare [intensity,pga,pgv,tvmap,tvmap_bare] -->
<img src="{{url.format(id,'intensity')}}"/>
<!-- <img src="{{url.format(id,'pga')}}"/> -->
{% endif %}
- type: custom:auto-entities # CONDITIONAL ULTIMI xx TERREMOTI
show_empty: false
sort:
{attribute: publication_date, method: attribute, reverse: true, count: 3, first: 1}
filter:
include:
- entity_id: geo_location.*
attributes:
source: ingv_centro_nazionale_terremoti
# options:
card:
type: markdown
entity_id: this.entity_id
style: |
ha-card {background: none; border-radius: 0px; box-shadow: none; color: var(--secondary-text-color);}
content: >-
<center>
<img src="http://terremoti.ingv.it/favicon.ico" width="16"/>
<a href="http://terremoti.ingv.it/"> LISTA ULTIMI TERREMOTI </a></center>
{% set url = "http://shakemap.rm.ingv.it/shake/{}/download/{}.jpg" %}
{% set url2 = "https://e.hsit.it/{}/{}_{}.jpg" %}
{% set code = {1:'White', 2:'Green', 3:'Yellow', 4:'Orange', 5:'Red'} %}
{% for e in config.entities %} {% set id = state_attr(e.entity, 'event_id') %}<br>
<font color= var(--primary-text-color)>
<font color = var(--disabled-text-color)>{{state_attr(e.entity, 'publication_date').strftime("%d/%m %H:%M") }}</font>
<font color = {{code[state_attr(e.entity, 'magnitude')|int]}}>
<ha-icon icon="{{state_attr(e.entity, 'icon')}}"></ha-icon></font> {{state_attr(e.entity, 'friendly_name')}} 🏡➡ {{states(e.entity)}} Km
</font>
{% if state_attr(e.entity, 'magnitude') >= 3 %}
<center>
<a href="{{state_attr(e.entity, 'image_url')}}"> <img src="{{state_attr(e.entity, 'image_url')}}" height="50"></a>
<a href="{{url.format(id,'pga')}}"> <img src="{{url.format(id,'pga')}}" height="50" ></a>
<a href="{{url.format(id,'pgv')}}"> <img src="{{url.format(id,'pgv')}}" height="50" ></a>
<a href="{{url.format(id,'tvmap')}}"> <img src="{{url.format(id,'tvmap')}}" height="50" ></a>
<a href="{{url2.format(id,id,'mcs')}}"> <img src="{{url2.format(id,id,'mcs')}}" height="50" ></a>
<a href="{{url2.format(id,id,'filledMCS')}}"> <img src="{{url2.format(id,id,'filledMCS')}}" height="50" ></a>
<a href="{{url2.format(id,id,'emailMap')}}"> <img src="{{url2.format(id,id,'emailMap')}}" height="50" ></a>
</center>
{% endif %}
{%- endfor %}
#################################################################
## GDACS
#################################################################
- type: custom:auto-entities
show_empty: false
# sort:
# {attribute: from_date, method: attribute, reverse: true, count: 3, first: 1}
filter:
include:
- entity_id: geo_location.*
attributes:
source: gdacs
alert_level: "/^((?!Green).)*$/" # Escludi string
card:
type: markdown
style: |
ha-card {background: none; border-radius: 0px; box-shadow: none;}
content: |
___
#### GDACS
{% for state in states.geo_location %}
{% if state.attributes.source=="gdacs" %}
<font color="{{ state.attributes.alert_level }}"><ha-icon icon="{{ state.attributes.icon }}"></ha-icon> **{{ state.name }}</font>**
Descrizione: <font color= var(--primary-text-color)>{{ state.attributes.description }}</font>
*Rilasciato: <font color= var(--primary-text-color)>{{ state.attributes.from_date.strftime("%d.%m.%Y %H:%M") }}*</font>
*Fine: <font color= var(--primary-text-color)>{{ state.attributes.to_date.strftime("%d.%m.%Y %H:%M") }}*</font>
{% endif %}
{% endfor %}
#################################################################
## MAPS
#################################################################
- type: conditional # METEO
conditions:
- entity: input_select.meteo_map
state_not: 'Nessuna'
card:
type: picture-entity
style: |
ha-card {
border-radius: var(--ha-card-border-radius);
border: solid 1px var(--accent-color);
box-shadow: none;
margin: 16px;
}
title: Nuvole
entity: input_select.meteo_map
tap_action:
action: call-service
service: input_select.select_next
service_data:
entity_id: input_select.meteo_map
hold_action:
action: call-service
service: input_select.select_previous
service_data:
entity_id: input_select.meteo_map
state_image:
"Nuvole e Sole": https://api.sat24.com/animated/IT/visual/3/
"Nuvole Infrared": https://api.sat24.com/animated/IT/infraPolair/3/
"Pioggia": https://api.sat24.com/animated/IT/rainTMC/3/
"Neve": https://api.sat24.com/animated/EU/snow/3/
"Il Meteo": http://cdn-radar.ilmeteo.it/italy.gif
"Burze": https://burze.dzis.net/italia_fulmine_lebhaft.gif
"Burze Nord Ovest": https://burze.dzis.net/italia_fulmine_lebhaft_gruppi_nw.gif
"Burze Nord Est": https://burze.dzis.net/italia_fulmine_lebhaft_gruppi_ne.gif
"Burze Sud Ovest": https://burze.dzis.net/italia_fulmine_lebhaft_gruppi_sw.gif
"Burze Sud Est": https://burze.dzis.net/italia_fulmine_lebhaft_gruppi_se.gif
"WWLLN": https://wwlln.net/WWLLN_movies/Movie_of_Lightning_in_EurAfrica_BIG.gif
entities:
- entity: input_select.meteo_map
- type: conditional # GEO
conditions:
- entity: input_select.geo_map
state: 'Posizione Geografica'
card:
type: map
style: |
ha-card {
border-radius: var(--ha-card-border-radius);
border: solid 1px var(--accent-color);
box-shadow: none;
margin: 16px;
}
# entities:
# - entity: person.claudio
geo_location_sources:
- all
dark_mode: true
default_zoom: 8
aspect_ratio: '16:9' #100%
hours_to_show: 72
- type: conditional # IFRAME
conditions:
- entity: input_select.meteo_iframe
state: 'Windy Alert'
card:
type: iframe
style: |
ha-card {
border-radius: var(--ha-card-border-radius);
border: solid 1px var(--accent-color);
margin: 16px;
}
aspect_ratio: 100%
url: https://embed.windy.com/embed2.html?lat=42.000&lon=12.000&zoom=5&level=surface&overlay=capAlerts&menu=&type=map&location=coordinates&detail=&detailLat=42.000&detailLon=12.000
- type: conditional # DPC
conditions:
- entity: input_select.meteo_iframe
state: 'Protezione Civile'
card:
type: iframe
style: |
ha-card {
border-radius: var(--ha-card-border-radius);
border: solid 1px var(--accent-color);
margin: 16px;
}
aspect_ratio: 100%
url: 'http://www.protezionecivile.gov.it/radar-dpc'
- type: conditional # Blitzortung
conditions:
- entity: input_select.meteo_iframe
state: 'Blitzortung'
card:
type: iframe
style: |
ha-card {
border-radius: var(--ha-card-border-radius);
border: solid 1px var(--accent-color);
margin: 16px;
}
aspect_ratio: 100%
url: 'http://map.blitzortung.org/#5.11/42.5/12.51' # Il Centro geografico d'Italia
# <img src="http://terremoti.ingv.it/images/ingv_logo_colore.png" background="white"/><br>