forked from basnijholt/home-assistant-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsensors.yaml
executable file
·409 lines (339 loc) · 11 KB
/
sensors.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
---
- platform: template
sensors:
washing_machine_watts:
value_template: >
{{ state_attr("switch.washing_machine", "current_power_w") | replace(" W", "") | float("Unavailable") }}
unit_of_measurement: Watt
friendly_name: Washing machine usage
dishwasher_watts:
value_template: >
{{ state_attr("switch.dishwasher", "current_power_w") | replace(" W", "") | float("Unavailable") }}
unit_of_measurement: Watt
friendly_name: Dishwasher usage
count_automations:
entity_id: sensor.date
value_template: "{{ states.automation | count }}"
count_scripts:
entity_id: sensor.date
value_template: "{{ states.script| count }}"
count_device_trackers:
entity_id: sensor.date
value_template: "{{ states.device_tracker | count }}"
count_binary_sensors:
entity_id: sensor.date
value_template: "{{ states.binary_sensor| count }}"
count_sensors:
entity_id: sensor.date
value_template: "{{ states.sensor | count }}"
count_switches:
entity_id: sensor.date
value_template: "{{ states.switch | count }}"
count_zones:
entity_id: sensor.date
value_template: "{{ states.zone | count }}"
count_input_booleans:
entity_id: sensor.date
value_template: "{{ states.input_boolean | count }}"
count_input_numbers:
entity_id: sensor.date
value_template: "{{ states.input_number | count }}"
count_input_texts:
entity_id: sensor.date
value_template: "{{ states.input_text | count }}"
count_input_selects:
entity_id: sensor.date
value_template: "{{ states.input_select | count }}"
count_input_datetimes:
entity_id: sensor.date
value_template: "{{ states.input_datetime | count }}"
favorite_playlist_of_nearest_person:
value_template: >
{% if state_attr('proximity.home', 'nearest') == "basnijholt-iphone"%}
6rPTm9dYftKcFAfwyRqmDZ
{% else %}
2Alq4aFJY8jRA2MnBL5d9A
{% endif %}
tv_volume:
value_template: >
{{ state_attr("media_player.tv", "volume_level") }}
unit_of_measurement: "%"
kef_ls50_volume:
value_template: >
{{ state_attr("media_player.kef_ls50", "volume_level") }}
unit_of_measurement: "%"
kef_lsx_volume:
value_template: >
{{ state_attr("media_player.kef_lsx", "volume_level") }}
unit_of_measurement: "%"
timestamp_start_of_today:
value_template: >
{{ as_timestamp(now().replace(hour=0).replace(minute=0).replace(second=0)) }}
unit_of_measurement: "s"
time_at_work_prognosis:
value_template: >
{% set day = [now().weekday(), 4] | min %}
{% set t_total = states("sensor.time_at_work_this_week")|float %}
{% set t_today = states("sensor.time_at_work_today")|float %}
{% set hours_per_day_including_today = t_total / (day + 1) %}
{% set hours_per_day_excluding_today = (t_total - t_today ) / (day + 10**-16) %}
{% set seven_oclock = as_timestamp(now().replace(hour=19).replace(minute=0).replace(second=0)) %}
{% if t_today > hours_per_day_excluding_today
or (not is_state("person.bas", "Work") and t_today > 0)
or (as_timestamp(now()) > seven_oclock)
or day == 0
or now().weekday() > 4
or 5 * hours_per_day_including_today > 40 %}
{% set hours_per_day = hours_per_day_including_today %}
{% else %}
{% set hours_per_day = hours_per_day_excluding_today %}
{% endif %}
{{ (5 * hours_per_day)|round(2) }}
unit_of_measurement: h
daily_power:
friendly_name: Daily Power
unit_of_measurement: kWh
value_template: >
{{ states("sensor.daily_power_offpeak")|float + states("sensor.daily_power_peak")|float }}
monthly_power:
friendly_name: Monthly Power
unit_of_measurement: kWh
value_template: >
{{ states("sensor.monthly_power_offpeak")|float + states("sensor.monthly_power_peak")|float }}
- platform: min_max
name: Temperature mean
type: mean
entity_ids:
- sensor.temperature_living_room
- sensor.temperature_bedroom
- sensor.temperature_bathroom
- sensor.temperature_hall
- platform: command_line
name: RPi CPU Temperature
command: "cat /sys/class/thermal/thermal_zone0/temp"
unit_of_measurement: "°C"
value_template: "{{ value | multiply(0.001) | round(2) }}"
- platform: command_line
name: RPi GPU Temperature
command: "/opt/vc/bin/vcgencmd measure_temp"
unit_of_measurement: "°C"
value_template: '{{ value | replace("temp=", "") | replace("''C", "") }}'
- platform: systemmonitor
resources:
- type: disk_use_percent
arg: "/"
- type: memory_use_percent
- type: network_in
arg: eth0
- type: network_out
arg: eth0
- type: processor_use
- type: last_boot
- platform: dnsip
- platform: time_date
- platform: version
name: Installed Version
source: local
- platform: version
name: Latest Available Version
beta: false
image: raspberrypi4
source: hassio
- platform: uptime
unit_of_measurement: hours
- platform: filesize
file_paths:
- /config/home-assistant_v2.db
- /config/.storage/lovelace
- platform: github
access_token: !secret hass_sensor_gh_token
repositories:
- path: "basnijholt/lovelace-ios-dark-mode-theme"
- path: "basnijholt/lovelace-ios-light-mode-theme"
- path: "python-adaptive/adaptive"
- path: "basnijholt/home-assistant-config"
# Work time tracker
- platform: history_stats
name: Time at work this week
entity_id: person.bas
state: Work
type: time
start: >
{{ states("sensor.timestamp_start_of_today")|float - now().weekday() * 86400 }}
end: "{{ now() }}"
- platform: history_stats
name: Time at work today
entity_id: person.bas
state: Work
type: time
start: >
{{ states("sensor.timestamp_start_of_today")|float - 0 * 86400 }}
duration:
hours: 24
- platform: history_stats
name: Time at work on Monday
entity_id: person.bas
state: Work
type: time
duration:
hours: 24
start: >
{% set day = now().weekday() - 0 %}
{% if day < 0 %}{% set day = day + 7 %}{% endif %}
{{ states("sensor.timestamp_start_of_today")|float - day * 86400}}
- platform: history_stats
name: Time at work on Tuesday
entity_id: person.bas
state: Work
type: time
duration:
hours: 24
start: >
{% set day = now().weekday() - 1 %}
{% if day < 0 %}{% set day = day + 7 %}{% endif %}
{{ states("sensor.timestamp_start_of_today")|float - day * 86400}}
- platform: history_stats
name: Time at work on Wednessday
entity_id: person.bas
state: Work
type: time
duration:
hours: 24
start: >
{% set day = now().weekday() - 2 %}
{% if day < 0 %}{% set day = day + 7 %}{% endif %}
{{ states("sensor.timestamp_start_of_today")|float - day * 86400}}
- platform: history_stats
name: Time at work on Thursday
entity_id: person.bas
state: Work
type: time
duration:
hours: 24
start: >
{% set day = now().weekday() - 3 %}
{% if day < 0 %}{% set day = day + 7 %}{% endif %}
{{ states("sensor.timestamp_start_of_today")|float - day * 86400}}
- platform: history_stats
name: Time at work on Friday
entity_id: person.bas
state: Work
type: time
duration:
hours: 24
start: >
{% set day = now().weekday() - 4 %}
{% if day < 0 %}{% set day = day + 7 %}{% endif %}
{{ states("sensor.timestamp_start_of_today")|float - day * 86400}}
# From the "Meterkast" Home Assistant
- platform: mqtt
state_topic: homeassistant/sensor/gas_consumption/state
unit_of_measurement: m3
name: Gas Consumption
icon: mdi:fire
- platform: mqtt
state_topic: homeassistant/sensor/hourly_gas_consumption/state
unit_of_measurement: m3/h
name: Hourly Gas Consumption
icon: mdi:fire
- platform: mqtt
state_topic: homeassistant/sensor/long_power_failure_count/state
name: Long Power Failure Count
icon: mdi:flash-off
- platform: mqtt
state_topic: homeassistant/sensor/power_consumption/state
unit_of_measurement: kW
name: Power Consumption
icon: mdi:flash
- platform: mqtt
state_topic: homeassistant/sensor/power_consumption_low/state
unit_of_measurement: kWh
name: Power Consumption (low)
icon: mdi:flash
- platform: mqtt
state_topic: homeassistant/sensor/power_consumption_normal/state
unit_of_measurement: kWh
name: Power Consumption (normal)
icon: mdi:flash
- platform: mqtt
state_topic: homeassistant/sensor/power_consumption_phase_l1/state
unit_of_measurement: kW
name: Power Consumption Phase L1
icon: mdi:flash
- platform: mqtt
state_topic: homeassistant/sensor/power_consumption_phase_l2/state
name: Power Consumption Phase L2
icon: mdi:flash
- platform: mqtt
state_topic: homeassistant/sensor/power_consumption_phase_l3/state
name: Power Consumption Phase L3
icon: mdi:flash
- platform: mqtt
state_topic: homeassistant/sensor/power_consumption_total/state
name: Power Consumption (total)
icon: mdi:flash
- platform: mqtt
state_topic: homeassistant/sensor/power_production/state
unit_of_measurement: kW
name: Power Production
icon: mdi:flash
- platform: mqtt
state_topic: homeassistant/sensor/power_production_low/state
unit_of_measurement: kWh
name: Power Production (low)
icon: mdi:flash
- platform: mqtt
state_topic: homeassistant/sensor/power_production_normal/state
unit_of_measurement: kWh
name: Power Production (normal)
icon: mdi:flash
- platform: mqtt
state_topic: homeassistant/sensor/power_production_phase_l1/state
unit_of_measurement: kW
name: Power Production Phase L1
icon: mdi:flash
- platform: mqtt
state_topic: homeassistant/sensor/power_production_phase_l2/state
name: Power Production Phase L2
icon: mdi:flash
- platform: mqtt
state_topic: homeassistant/sensor/power_production_phase_l3/state
name: Power Production Phase L3
icon: mdi:flash
- platform: mqtt
state_topic: homeassistant/sensor/power_tariff/state
name: Power Tariff
icon: mdi:flash
- platform: mqtt
state_topic: homeassistant/sensor/voltage_phase_l1/state
name: Voltage Phase L1
- platform: mqtt
state_topic: homeassistant/sensor/voltage_phase_l2/state
name: Voltage Phase L2
- platform: mqtt
state_topic: homeassistant/sensor/voltage_phase_l3/state
name: Voltage Phase L3
- platform: mqtt
state_topic: homeassistant/sensor/voltage_sags_phase_l1/state
name: Voltage Sags Phase L1
icon: mdi:pulse
- platform: mqtt
state_topic: homeassistant/sensor/voltage_sags_phase_l2/state
name: Voltage Sags Phase L2
icon: mdi:pulse
- platform: mqtt
state_topic: homeassistant/sensor/voltage_sags_phase_l3/state
name: Voltage Sags Phase L3
icon: mdi:pulse
- platform: mqtt
state_topic: homeassistant/sensor/voltage_swells_phase_l1/state
name: Voltage Swells Phase L1
icon: mdi:pulse
- platform: mqtt
state_topic: homeassistant/sensor/voltage_swells_phase_l2/state
name: Voltage Swells Phase L2
icon: mdi:pulse
- platform: mqtt
state_topic: homeassistant/sensor/voltage_swells_phase_l3/state
name: Voltage Swells Phase L3
icon: mdi:pulse