forked from EverythingSmartHome/everything-presence-lite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
epl-map.yml
339 lines (336 loc) · 12.7 KB
/
epl-map.yml
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
#Card based on athua's code (https://github.com/athua/ha-utils) and https://docs.screek.io/2a/add-a-map-card with some custom modifications It requires Plotly Graph Card from HACS.
#This assumes you havent change entity names. Line 16, 18 and 21 needs to change to match your sensor_id.
type: custom:plotly-graph
title: $ex "Living Room Map"
refresh_interval: 1
hours_to_show: current_day
config:
modeBarButtonsToRemove:
- select2d
- lasso2d
- toImage
displaylogo: false
entities:
- entity: ''
sensor_suffix: $ex vars.sensor_id = "2fbc58";
sensor_prefix: >-
$ex vars.sensor_name_prefix = "sensor.everything_presence_lite_" +
vars.sensor_id + "_";
number_prefix: >-
$ex vars.number_name_prefix = "number.everything_presence_lite_" +
vars.sensor_id + "_";
units: >-
$ex vars.is_inch_unit = hass.states[vars.sensor_name_prefix +
"target_1_x"].attributes.unit_of_measurement == false;
- entity: ''
name: Target1
marker:
size: 10
symbol: star-diamond
line:
shape: spline
width: 5
x:
- >-
$ex { var x = hass.states[vars.sensor_name_prefix + "target_1_x"].state;
var y = hass.states[vars.sensor_name_prefix + "target_1_y"].state; if (x
== 0 && y == 0) { return -9999 }; if (vars.is_inch_unit) { x = x * 25.4
}; return x; }
'y':
- >-
$ex { var x = hass.states[vars.sensor_name_prefix + "target_1_x"].state;
var y = hass.states[vars.sensor_name_prefix + "target_1_y"].state; if (x
== 0 && y == 0) { return -9999 }; if (vars.is_inch_unit) { y = y * 25.4
}; return y; }
- entity: ''
name: Target2
marker:
size: 10
symbol: star-diamond
line:
shape: spline
width: 5
x:
- >-
$ex { var x = hass.states[vars.sensor_name_prefix + "target_2_x"].state;
var y = hass.states[vars.sensor_name_prefix + "target_2_y"].state; if (x
== 0 && y == 0) { return -9999 }; if (vars.is_inch_unit) { x = x * 25.4
}; return x; }
'y':
- >-
$ex { var x = hass.states[vars.sensor_name_prefix + "target_2_x"].state;
var y = hass.states[vars.sensor_name_prefix + "target_2_y"].state; if (x
== 0 && y == 0) { return -9999 }; if (vars.is_inch_unit) { y = y * 25.4
}; return y; }
- entity: ''
name: Target3
marker:
size: 10
symbol: star-diamond
line:
shape: spline
width: 5
x:
- >-
$ex { var x = hass.states[vars.sensor_name_prefix + "target_3_x"].state;
var y = hass.states[vars.sensor_name_prefix + "target_3_y"].state; if (x
== 0 && y == 0) { return -9999 }; if (vars.is_inch_unit) { x = x * 25.4
}; return x; }
'y':
- >-
$ex { var x = hass.states[vars.sensor_name_prefix + "target_3_x"].state;
var y = hass.states[vars.sensor_name_prefix + "target_3_y"].state; if (x
== 0 && y == 0) { return -9999 }; if (vars.is_inch_unit) { y = y * 25.4
}; return y; }
- entity: ''
name: Zone1
mode: lines
fill: toself
fillcolor: RGBA(20,200,0,0.06)
line:
color: RGBA(20,200,0,0.2)
shape: line
width: 2
x:
- $ex hass.states[vars.number_name_prefix + "zone_1_begin_x"].state
- $ex hass.states[vars.number_name_prefix + "zone_1_begin_x"].state
- $ex hass.states[vars.number_name_prefix + "zone_1_end_x"].state
- $ex hass.states[vars.number_name_prefix + "zone_1_end_x"].state
- $ex hass.states[vars.number_name_prefix + "zone_1_begin_x"].state
'y':
- $ex hass.states[vars.number_name_prefix + "zone_1_begin_y"].state
- $ex hass.states[vars.number_name_prefix + "zone_1_end_y"].state
- $ex hass.states[vars.number_name_prefix + "zone_1_end_y"].state
- $ex hass.states[vars.number_name_prefix + "zone_1_begin_y"].state
- $ex hass.states[vars.number_name_prefix + "zone_1_begin_y"].state
- entity: ''
name: Zone2
mode: lines
fill: toself
fillcolor: RGBA(200,0,255,0.06)
line:
color: RGBA(200,0,255,0.2)
shape: line
width: 2
x:
- >-
$ex { var zone2_begin_x = hass.states[vars.number_name_prefix + "zone_2_begin_x"];
return zone2_begin_x ? zone2_begin_x.state : -9999; }
- >-
$ex { var zone2_begin_x = hass.states[vars.number_name_prefix + "zone_2_begin_x"];
return zone2_begin_x ? zone2_begin_x.state : -9999; }
- >-
$ex { var zone2_end_x = hass.states[vars.number_name_prefix + "zone_2_end_x"];
return zone2_end_x ? zone2_end_x.state : -9999; }
- >-
$ex { var zone2_end_x = hass.states[vars.number_name_prefix + "zone_2_end_x"];
return zone2_end_x ? zone2_end_x.state : -9999; }
- >-
$ex { var zone2_begin_x = hass.states[vars.number_name_prefix + "zone_2_begin_x"];
return zone2_begin_x ? zone2_begin_x.state : -9999; }
'y':
- >-
$ex { var zone2_begin_y = hass.states[vars.number_name_prefix + "zone_2_begin_y"];
return zone2_begin_y ? zone2_begin_y.state : -9999; }
- >-
$ex { var zone2_end_y = hass.states[vars.number_name_prefix + "zone_2_end_y"];
return zone2_end_y ? zone2_end_y.state : -9999; }
- >-
$ex { var zone2_end_y = hass.states[vars.number_name_prefix + "zone_2_end_y"];
return zone2_end_y ? zone2_end_y.state : -9999; }
- >-
$ex { var zone2_begin_y = hass.states[vars.number_name_prefix + "zone_2_begin_y"];
return zone2_begin_y ? zone2_begin_y.state : -9999; }
- >-
$ex { var zone2_begin_y = hass.states[vars.number_name_prefix + "zone_2_begin_y"];
return zone2_begin_y ? zone2_begin_y.state : -9999; }
- entity: ''
name: Zone3
mode: lines
fill: toself
fillcolor: RGBA(200,120,55,0.06)
line:
color: RGBA(200,120,55,0.2)
shape: line
width: 2
x:
- >-
$ex { var zone3_begin_x = hass.states[vars.number_name_prefix + "zone_3_begin_x"];
return zone3_begin_x ? zone3_begin_x.state : -9999; }
- >-
$ex { var zone3_begin_x = hass.states[vars.number_name_prefix + "zone_3_begin_x"];
return zone3_begin_x ? zone3_begin_x.state : -9999; }
- >-
$ex { var zone3_end_x = hass.states[vars.number_name_prefix + "zone_3_end_x"];
return zone3_end_x ? zone3_end_x.state : -9999; }
- >-
$ex { var zone3_end_x = hass.states[vars.number_name_prefix + "zone_3_end_x"];
return zone3_end_x ? zone3_end_x.state : -9999; }
- >-
$ex { var zone3_begin_x = hass.states[vars.number_name_prefix + "zone_3_begin_x"];
return zone3_begin_x ? zone3_begin_x.state : -9999; }
'y':
- >-
$ex { var zone3_begin_y = hass.states[vars.number_name_prefix + "zone_3_begin_y"];
return zone3_begin_y ? zone3_begin_y.state : -9999; }
- >-
$ex { var zone3_end_y = hass.states[vars.number_name_prefix + "zone_3_end_y"];
return zone3_end_y ? zone3_end_y.state : -9999; }
- >-
$ex { var zone3_end_y = hass.states[vars.number_name_prefix + "zone_3_end_y"];
return zone3_end_y ? zone3_end_y.state : -9999; }
- >-
$ex { var zone3_begin_y = hass.states[vars.number_name_prefix + "zone_3_begin_y"];
return zone3_begin_y ? zone3_begin_y.state : -9999; }
- >-
$ex { var zone3_begin_y = hass.states[vars.number_name_prefix + "zone_3_begin_y"];
return zone3_begin_y ? zone3_begin_y.state : -9999; }
- entity: ''
name: Zone4
mode: lines
fill: toself
fillcolor: RGBA(255,0,0,0.15)
line:
shape: line
width: 1
color: RGBA(255,0,0,0.2)
x:
- >-
$ex { var zone4_begin_x = hass.states[vars.number_name_prefix + "zone_4_begin_x"];
return zone4_begin_x ? zone4_begin_x.state : -9999; }
- >-
$ex { var zone4_begin_x = hass.states[vars.number_name_prefix + "zone_4_begin_x"];
return zone4_begin_x ? zone4_begin_x.state : -9999; }
- >-
$ex { var zone4_end_x = hass.states[vars.number_name_prefix + "zone_4_end_x"];
return zone4_end_x ? zone4_end_x.state : -9999; }
- >-
$ex { var zone4_end_x = hass.states[vars.number_name_prefix + "zone_4_end_x"];
return zone4_end_x ? zone4_end_x.state : -9999; }
- >-
$ex { var zone4_begin_x = hass.states[vars.number_name_prefix + "zone_4_begin_x"];
return zone4_begin_x ? zone4_begin_x.state : -9999; }
'y':
- >-
$ex { var zone4_begin_y = hass.states[vars.number_name_prefix + "zone_4_begin_y"];
return zone4_begin_y ? zone4_begin_y.state : -9999; }
- >-
$ex { var zone4_end_y = hass.states[vars.number_name_prefix + "zone_4_end_y"];
return zone4_end_y ? zone4_end_y.state : -9999; }
- >-
$ex { var zone4_end_y = hass.states[vars.number_name_prefix + "zone_4_end_y"];
return zone4_end_y ? zone4_end_y.state : -9999; }
- >-
$ex { var zone4_begin_y = hass.states[vars.number_name_prefix + "zone_4_begin_y"];
return zone4_begin_y ? zone4_begin_y.state : -9999; }
- >-
$ex { var zone4_begin_y = hass.states[vars.number_name_prefix + "zone_4_begin_y"];
return zone4_begin_y ? zone4_begin_y.state : -9999; }
- entity: ''
name: OccupancyMask1
mode: lines
fill: toself
fillcolor: RGBA(20,20,20,0.06)
line:
color: RGBA(20,20,20,0.2)
shape: line
width: 2
x:
- >-
$ex hass.states[vars.number_name_prefix +
"occupancy_mask_1_begin_x"].state
- >-
$ex hass.states[vars.number_name_prefix +
"occupancy_mask_1_begin_x"].state
- >-
$ex hass.states[vars.number_name_prefix +
"occupancy_mask_1_end_x"].state
- >-
$ex hass.states[vars.number_name_prefix +
"occupancy_mask_1_end_x"].state
- >-
$ex hass.states[vars.number_name_prefix +
"occupancy_mask_1_begin_x"].state
"y":
- >-
$ex hass.states[vars.number_name_prefix +
"occupancy_mask_1_begin_y"].state
- >-
$ex hass.states[vars.number_name_prefix +
"occupancy_mask_1_end_y"].state
- >-
$ex hass.states[vars.number_name_prefix +
"occupancy_mask_1_end_y"].state
- >-
$ex hass.states[vars.number_name_prefix +
"occupancy_mask_1_begin_y"].state
- >-
$ex hass.states[vars.number_name_prefix +
"occupancy_mask_1_begin_y"].state
- entity: ''
name: Coverage
mode: lines
fill: tonexty
fillcolor: rgba(168, 216, 234, 0.15)
line:
shape: line
width: 1
dash: dot
x: >-
$ex { vars.installation_angle = Number(hass.states[vars.number_name_prefix + "installation_angle"]?.state ?? 0);
vars.installation_angle_cos = Math.cos(Math.PI/180 * vars.installation_angle);
vars.installation_angle_sin = Math.sin(Math.PI/180 * vars.installation_angle);
vars.max_distance = 10 * hass.states[vars.number_name_prefix + "max_distance"].state;
var distance_ratio = vars.max_distance/7500;
var coverage_steps = [5500,4500,4000,3000,2000,1000,0,-1000,-2000,-3000,-4000,-4500,-5500];
vars.coverage_x = [0, vars.max_distance * Math.sin(Math.PI/180 * 60)];
coverage_steps.forEach((step) => vars.coverage_x.push(step * distance_ratio));
vars.coverage_x.push(-vars.max_distance * Math.sin(Math.PI/180 * 60), 0);
vars.coverage_y = [0, vars.max_distance * Math.cos(Math.PI/180 * 60)];
coverage_steps.forEach((step) => {
return vars.coverage_y.push(Math.sqrt(vars.max_distance**2 - (step * distance_ratio)**2));
});
vars.coverage_y.push(vars.max_distance * Math.cos(Math.PI/180 * 60), 0);
return vars.coverage_x.map((x, i)=> {
return x * vars.installation_angle_cos +
vars.coverage_y[i] * vars.installation_angle_sin;
});
}
'y': >-
$ex vars.coverage_y.map((y,i)=> {
return -vars.coverage_x[i] * vars.installation_angle_sin
+ y * vars.installation_angle_cos
})
layout:
height: 240
margin:
l: 40
r: 20
t: 20
b: 55
showlegend: false
xaxis:
showticklabels: false
dtick: 1000
gridcolor: RGBA(200,200,200,0.15)
zerolinecolor: RGBA(200,200,200,0.15)
type: number
fixedrange: true
range:
- $ex -vars.max_distance
- $ex vars.max_distance
yaxis:
showticklabels: false
dtick: 1000
gridcolor: RGBA(200,200,200,0.15)
zerolinecolor: RGBA(200,200,200,0.15)
scaleanchor: x
scaleratio: 1
fixedrange: true
range:
- $ex vars.max_distance
- >-
$ex {if(Math.abs(vars.installation_angle) <= 30) return 0;
return -vars.max_distance * Math.sin(Math.PI/180 *
(Math.abs(vars.installation_angle)-30));}
raw_plotly_config: true