-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclock.yaml
More file actions
171 lines (168 loc) · 5.16 KB
/
clock.yaml
File metadata and controls
171 lines (168 loc) · 5.16 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
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
type: custom:button-card
template:
- variable_template
- body_template
variables:
clockaltcardversion: 1.0.1
var_enable_movement: true
var_stop_position:
top: 100%
left: 100%
var_background: |-
[[[
try {
return hass.states[variables.var_assistsat_entity].attributes.background || "";
} catch (e) {
return "";
}
]]]
var_random_opacity: "[[[ Math.random() > 0.5 ? '0.8' : '1' ]]]"
var_positions:
- top: "-250%"
left: 5%
- top: "-230%"
left: 15%
- top: "-210%"
left: 25%
- top: "-200%"
left: 35%
- top: "-180%"
left: 45%
- top: "-160%"
left: 55%
- top: "-150%"
left: 65%
- top: "-130%"
left: 60%
- top: "-110%"
left: 50%
- top: "-90%"
left: 40%
- top: "-80%"
left: 30%
- top: "-70%"
left: 20%
- top: "-60%"
left: 10%
- top: "-40%"
left: 60%
- top: "-55%"
left: 5%
- top: "-85%"
left: 45%
- top: "-95%"
left: 65%
var_random_position: |-
[[[
if (variables.var_enable_movement) {
var positions = variables.var_positions;
if (!window.movementTimer) {
let moveClock = () => {
var randomIndex = Math.floor(Math.random() * positions.length);
var randomPosition = positions[randomIndex];
window.randomPosition = 'translate(' + randomPosition.left + ', ' + randomPosition.top + ')';
/* Wacht 30 seconden voor de volgende beweging */
window.movementTimer = setTimeout(moveClock, 20000);
};
moveClock(); // Start de beweging
}
return window.randomPosition || 'translate(' + positions[0].left + ', ' + positions[0].top + ')';
} else {
var stopPosition = variables.var_stop_position || { top: "0%", left: "0%" };
return 'translate(' + stopPosition.left + ', ' + stopPosition.top + ')';
}
]]]
var_knmi_code: "[[[ return hass.states['sensor.knmi_weercode'].state ]]]"
var_clock_color: |
[[[
var code = hass.states['sensor.knmi_weercode'].state;
if (code === 'groen') return 'white';
if (code === 'geel') return 'yellow';
if (code === 'oranje') return 'orange';
if (code === 'rood') return 'red';
return 'white';
]]]
styles:
card:
- background: |-
[[[
return 'center / cover no-repeat url(' + variables.var_background + ')';
]]]
- background-size: cover
custom_fields:
clock:
- font-weight: bold
- justify-self: start
- align-self: center
- font-size: 500%
- width: max-content
- position: absolute
- top: 80%
- color: "[[[ return variables.var_clock_color ]]]"
- transform: "[[[ return variables.var_random_position ]]]"
- transition: transform 5s ease-in-out
custom_fields:
title: ""
clock:
card:
type: vertical-stack
cards:
- type: horizontal-stack
cards:
- type: custom:button-card
name: "[[[ return variables.var_current_time ]]]"
styles:
name:
- font-size: 1000%
- text-shadow: 3px 3px black
- font-weight: bold
- color: "[[[ return variables.var_clock_color ]]]"
card:
- font-weight: bold
- background-color: transparent
- border-width: 0px
- type: custom:button-card
icon: "[[[ return variables.var_weather_icon ]]]"
name: "[[[ return variables.var_weather_temperature ]]]"
tap_action:
action: navigate
navigation_path: weather
hold_action:
action: navigate
navigation_path: music
styles:
card:
- background-color: transparent
- border-width: 0px
- width: 50%
- position: relative
- bottom: "-40%"
grid:
- grid-template-areas: "\"i n\""
- grid-template-rows: min-content min-content
name:
- font-size: 400%
- text-shadow: 2px 2px black
- font-weight: bold
- color: "[[[ return variables.var_clock_color ]]]"
icon:
- width: 100%
- filter: drop-shadow(2px 2px black)
- color: "[[[ return variables.var_clock_color ]]]"
- type: custom:button-card
name: |
[[[
var now = new Date();
return now.toLocaleDateString('nl-NL', { weekday: 'long', month: 'long', day: 'numeric' });
]]]
styles:
name:
- text-shadow: 2px 2px black
- font-weight: bold
- font-size: 200%
- color: "[[[ return variables.var_clock_color ]]]"
card:
- background-color: transparent
- border-width: 0px
- width: auto
- margin-top: "-15%"