forked from caiosweet/Package-Natural-Events
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcard_natural_events_picture.yaml
245 lines (241 loc) · 8.36 KB
/
card_natural_events_picture.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
type: custom:vertical-stack-in-card # type: vertical-stack
style: |
ha-card {
border: 1px solid {% if is_state('binary_sensor.global_natural_alert', 'on') %} {{state_attr('binary_sensor.global_natural_alert','level')}} {% else %} Green {% endif %};
}
cards:
- type: picture-elements
style: |
{% set global = 'binary_sensor.global_natural_alert' %}
@keyframes blink {
30% {
background: {% if is_state(global, 'on') %} gray; {% endif %}
}
}
ha-card {
--my-animation: blink 2s linear 3;
--global-level: {% if is_state(global, 'on') %} {{state_attr(global,'level')}}; {% else %} Green;{% endif %}
--meteoalarm-level: {{state_attr(global,'meteoalarm_level')}};
--meteoalarm-level-left: {% if (state_attr('binary_sensor.meteoalarm', 'urgency')|lower) == 'immediate' %} 5%; {% else %} 90%; {% endif %}
--meteoalarm-type-left: {% if (state_attr('binary_sensor.meteoalarm', 'urgency')|lower) == 'immediate' %} 10%; {% else %} 95%; {% endif %}
--meteoalarmc: {% if 'today' in states('sensor.meteoalarm_custom') %} 10%; {% endif %}
--meteoalarmc: {% if 'tomorrow' in states('sensor.meteoalarm_custom') %} 95%; {% endif %}
--my-border-style: solid;
--my-border-width: {% if is_state('input_boolean.natural_events', 'off') %} 1px; {% else %} 0px; {% endif %}
--my-border-color: {% if is_state(global, 'on') %} var(--global-level); {% endif %}
--my-background: {% if is_state(global, 'on') %} var(--global-level); {% else %} Green;{% endif %}
--my-color: {% if state_attr(global, 'level') in ['White','Yellow','Orange'] %} var(--disabled-text-color); {% endif %}
{% if is_state(global, 'on') %}
--my-border-width: {% if is_state('input_boolean.natural_events', 'off') %} 1px; {% else %} 1px 0px 0px 0px; {% endif %}
{% else %}
--my-border-width: 0px;
--my-color: Wihte;
{% endif %}
border-color: var(--my-border-color);
border-style: var(--my-border-style);
border-width: var(--my-border-width);
background: var(--my-background);
}
image: /local/hassiohelp/pkg_natural_events/background.png
elements:
- type: conditional # Nessun Evento
conditions:
- entity: binary_sensor.global_natural_alert
state: 'off'
elements:
- type: state-label
entity: sensor.dark_sky_summary
tap_action:
action: call-service
service: input_boolean.toggle
service_data:
entity_id: input_boolean.natural_events
hold_action:
action: none
style:
border-color: 'var(--global-level)'
border-style: solid
border-width: 'var(--my-border-width)'
animation: 'var(--my-animation)'
background-color: 'var(--global-level)'
color: 'var(--my-color)'
font-family: Trebuchet MS
font-size: 120%
font-weight: bold
left: 0%
opacity: 0.5
pointer-events: auto
right: 0%
text-align: center
top: 95%
transform: 'translate(0%,-50%)'
z-index: 98
- type: conditional # MeteoAlarm
conditions:
- entity: binary_sensor.meteoalarm
state: 'on'
elements:
- type: state-icon
entity: sensor.meteoalarm_level
style:
'--paper-item-icon-color': 'var(--meteoalarm-level)'
left: 'var(--meteoalarm-level-left)'
top: 20%
z-index: 99
- type: state-icon
entity: sensor.meteoalarm_type
style:
'--paper-item-icon-color': 'var(--meteoalarm-level)'
left: 'var(--meteoalarm-type-left)'
top: 20%
z-index: 99
- type: conditional # Eventi Meteo
conditions:
- entity: group.meteoalert
state: 'on'
elements:
- type: state-label
entity: group.meteoalert
prefix: 'Meteo '
tap_action:
action: call-service
service: input_boolean.toggle
service_data:
entity_id: input_boolean.natural_events
hold_action:
action: none
style:
border-color: 'var(--global-level)'
border-style: solid
border-width: 'var(--my-border-width)'
animation: 'var(--my-animation)'
background-color: 'var(--global-level)'
color: 'var(--my-color)'
font-family: Trebuchet MS
font-size: 120%
font-weight: bold
left: 0%
opacity: 0.5
pointer-events: auto
right: 0%
text-align: center
top: 5%
transform: 'translate(0%,-50%)'
z-index: 98
- entity: binary_sensor.dpc_temporali_oggi
image: /local/hassiohelp/pkg_natural_events/dpc_temporali_oggi.png
state_filter:
'on': opacity(1)
'off': opacity(0)
style:
left: 50%
pointer-events: none
top: 50%
width: 100%
z-index: 1
type: image
- entity: binary_sensor.dpc_temporali_domani
image: /local/hassiohelp/pkg_natural_events/dpc_temporali_domani.png
state_filter:
'on': opacity(1)
'off': opacity(0)
style:
left: 50%
pointer-events: none
top: 50%
width: 100%
z-index: 1
type: image
- type: conditional # Eventi Geologici
conditions:
- entity: group.geoalert
state: 'on'
elements:
- type: state-label
entity: group.geoalert
prefix: 'Geologico '
tap_action:
action: call-service
service: input_boolean.toggle
service_data:
entity_id: input_boolean.natural_events
hold_action:
action: none
style:
border-color: 'var(--global-level)'
border-style: solid
border-width: 'var(--my-border-width)'
animation: 'var(--my-animation)'
background-color: 'var(--global-level)'
color: 'var(--my-color)'
font-family: Trebuchet MS
font-size: 120%
font-weight: bold
left: 0%
opacity: 0.5
pointer-events: auto
right: 0%
text-align: center
top: 95%
transform: 'translate(0%,-50%)'
z-index: 98
- entity: binary_sensor.dpc_idraulico_oggi
image: /local/hassiohelp/pkg_natural_events/dpc_idraulico_oggi.png
state_filter:
'on': opacity(1)
'off': opacity(0)
style:
left: 50%
pointer-events: none
top: 50%
width: 100%
z-index: 2
type: image
- entity: binary_sensor.dpc_idrogeologico_oggi
image: /local/hassiohelp/pkg_natural_events/dpc_idrogeologico_oggi.png
state_filter:
'on': opacity(1)
'off': opacity(0)
style:
left: 50%
pointer-events: none
top: 50%
width: 100%
z-index: 1
type: image
- entity: binary_sensor.dpc_idraulico_domani
image: /local/hassiohelp/pkg_natural_events/dpc_idraulico_domani.png
state_filter:
'on': opacity(1)
'off': opacity(0)
style:
left: 50%
pointer-events: none
top: 50%
width: 100%
z-index: 2
type: image
- entity: binary_sensor.dpc_idrogeologico_domani
image: /local/hassiohelp/pkg_natural_events/dpc_idrogeologico_domani.png
state_filter:
'on': opacity(1)
'off': opacity(0)
style:
left: 50%
pointer-events: none
top: 50%
width: 100%
z-index: 1
type: image
- entity: binary_sensor.lastquake
image: /local/hassiohelp/pkg_natural_events/sisma.png
state_filter:
'on': opacity(1)
'off': opacity(0)
style:
left: 50%
pointer-events: none
top: 50%
width: 100%
z-index: 0
type: image