-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlightning.yaml
More file actions
84 lines (80 loc) · 2.33 KB
/
lightning.yaml
File metadata and controls
84 lines (80 loc) · 2.33 KB
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
type: custom:button-card
variables:
background: /local/viewassist/bliksem.png
bliksemcardversion: 1.0.1
var_font_size: 45px
bliksem_entity: sensor.blitzortung_lightning_distance
template:
- variable_template
- body_template
styles:
grid:
- grid-template-areas: |
"title status"
"message message"
"card assist"
- grid-template-rows: auto 1fr auto
card:
- background: "[[[ return `center / cover repeat url(${variables.background})` ]]]"
- background-size: cover
custom_fields:
message:
- font-size: "[[[ return variables.var_font_size ]]]"
- position: relative
- padding: 10px
- border-radius: 10px
- max-width: 95%
- text-align: start
- text-wrap: wrap
- align-self: center
- justify-self: center
- padding: 2%
- font-weight: bold
- text-shadow: 3px 3px black
custom_fields:
title:
card:
type: custom:button-card
icon: mdi:clock
name: "[[[ return variables.var_current_time ]]]"
tap_action:
action: call-service
service: input_boolean.toggle
service_data:
entity_id: input_boolean.bliksem
styles:
card:
- background-color: transparent
- border-width: 0px
- width: auto
- padding: 5px
grid:
- grid-template-areas: "\"i n\""
- grid-template-rows: min-content min-content
- grid-template-columns: 100px auto
name:
- font-size: 8vh
- font-weight: bold
- color: white
- text-shadow: 2px 2px black
icon:
- filter: drop-shadow(2px 2px 2px black)
- width: 12vh
- color: white
message: |
[[[
let distance = states[variables.bliksem_entity].state;
let strikes = states["sensor.blitzortung_lightning_counter"].state;
let message = "";
if (strikes > 0) {
message = `⚡️ ${strikes} inslagen op ${distance} km afstand.`;
} else {
message = "✅ Geen bliksem gedetecteerd.";
}
if (distance <= 10 && strikes > 0) {
message += " ⚠️ Bliksem is dichtbij. Sluit ramen en deuren!";
} else if (distance <= 20 && strikes > 0) {
message += " 🌩️ Bliksem in de buurt. Wees voorzichtig!";
}
return message;
]]]