-
Notifications
You must be signed in to change notification settings - Fork 55
/
sensors.yaml
422 lines (354 loc) · 14.8 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
410
411
412
413
414
415
416
417
418
419
420
421
422
#https://home-assistant.io/components/sensor/
####################################################
# #
# HA SERVER METRICS #
# #
####################################################
#https://home-assistant.io/components/sensor.systemmonitor/
- platform: systemmonitor
resources:
- type: disk_use_percent
arg: /home
- type: memory_use_percent
- type: processor_use
- type: since_last_boot
- type: network_in
arg: ens32
- type: network_out
arg: ens32
#https://home-assistant.io/components/sensor.cpuspeed/
- platform: cpuspeed
name: CPU
#https://home-assistant.io/components/sensor.api_stream/
- platform: api_streams
#https://home-assistant.io/components/sensor.command_line/
- platform: command_line
command: python3 -c "import requests; print(requests.get('https://pypi.python.org/pypi/homeassistant/json').json()['info']['version'])"
name: Current HA Version
- platform: command_line
name: Installed version
command: "head -5 /home/ha/.homeassistant/.HA_VERSION"
####################################################
# #
# UPS DATA #
# #
####################################################
#https://home-assistant.io/components/sensor.nut/
- platform: nut
resources:
- ups.load
- input.voltage
- battery.runtime
- battery.voltage
- battery.charge
host: 192.168.2.2
name: UPS
#https://home-assistant.io/components/sensor.template/
- platform: template
sensors:
approxwattage:
unit_of_measurement: 'W'
value_template: '{{ states("sensor.ups_load") | float /100*900 }}'
upsstate:
value_template: "{%if states.sensor.ups_load.attributes.state == 'Online' %}Online{% elif states.sensor.ups_load.attributes.state == 'Online Battery Charging' %}Online Battery Charging{% elif states.sensor.ups_load.attributes.state == 'unknown' %}Power Outage{% endif %}"
####################################################
# #
# INTERNET PERFORMANCE METRICS #
# #
####################################################
#https://home-assistant.io/components/sensor.speedtest/
- platform: speedtest
server_id: 1776
monitored_conditions:
- download
- upload
- ping
hour:
- 0
- 3
- 6
- 9
- 12
- 15
- 18
- 21
####################################################
# #
# WEATHER UNDERGROUND DATA #
# #
####################################################
#https://home-assistant.io/components/sensor.wunderground/
- platform: wunderground
api_key: !secret wu_api_key
pws_id: !secret wu_pws_id
monitored_conditions:
- temp_f
- precip_today_in
- wind_string
- relative_humidity
- weather
- weather_1d
- weather_1n
- weather_2d
- weather_2n
- weather_3d
- weather_3n
- weather_4d
- weather_4n
- weather_1h
- weather_6h
- visibility_mi
- precip_1hr_in
- feelslike_f
####################################################
# #
# iPHONE BATTERY STATUS #
# #
####################################################
#https://home-assistant.io/components/sensor.template/
- platform: template
sensors:
battery_adamsiphone:
unit_of_measurement: '%'
value_template: '{{ states.device_tracker.adamsiphone.attributes.battery | round(0) }}'
battery_iphone:
unit_of_measurement: '%'
value_template: '{{ states.device_tracker.amysiphone.attributes.battery | round(0) }}'
charging_adamsiphone:
value_template: '{{ states.device_tracker.adamsiphone.attributes.battery_status }}'
gps_adamsiphone:
value_template: '{{ states.device_tracker.adamsiphone.attributes.gps_accuracy | round(0) }}'
interval_adamsiphone:
unit_of_measurement: 'min'
value_template: '{{ states.device_tracker.adamsiphone.attributes.interval | round(0) }}'
####################################################
# #
# CORRECTING VALUE OUTPUT OF MULTIPLE SENSORS #
# #
####################################################
#https://home-assistant.io/components/sensor.template/
- platform: template
sensors:
adamwifi:
value_template: '{% if is_state("device_tracker.bc9fef3f3205", "home") %}Online{% else %}Offline{% endif %}'
amywifi:
value_template: '{% if is_state("device_tracker.bc9fef2f1fe3", "home") %}Online{% else %}Offline{% endif %}'
since_last_boot_templated:
value_template: >-
{%- set slb = states.sensor.since_last_boot.state.split(' ') -%}
{%- set count = slb | length -%}
{%- set hms = slb[count - 1] -%}
{%- set hms_trimmed = hms.split('.')[0] -%}
{%- set hms_split = hms_trimmed.split(':') -%}
{%- set hours = hms_split[0] | int -%}
{%- if count == 3 -%}
{{ slb[0] ~ ' ' ~ slb[1] ~ ' ' }}
{%- endif -%}
{%- if hours > 0 -%}
{%- if hours == 1 -%}
1 hour
{%- else -%}
{{ hours }} hours
{%- endif -%}
{%- endif -%}
####################################################
# #
# NEST SENSORS #
# #
####################################################
#https://home-assistant.io/components/sensor.nest/
- platform: nest
monitored_conditions:
- temperature
- target
- humidity
- operation_mode
- hvac_state
#https://home-assistant.io/components/sensor.template/
- platform: template
sensors:
downstairs_away_mode:
value_template: "{{ is_state_attr('climate.downstairs', 'away_mode', 'on') }}"
####################################################
# #
# EXTERNAL IP ADDRESS CHANGE #
# #
####################################################
#https://home-assistant.io/components/sensor.template/
- platform: template
sensors:
ipchange:
value_template: !secret external_ip
# https://home-assistant.io/components/sensor.rest/
- platform: dnsip
hostname: myip.opendns.com
resolver: 208.67.222.222
####################################################
# #
# EDIMAX SWTICH POWER CONSUMPTION #
# #
####################################################
#https://home-assistant.io/components/sensor.template/
- platform: template
sensors:
edimax1_watts:
value_template: '{{ states.switch.edimax1.attributes["current_power_w"] | float * 1000000 | round(2) }}'
unit_of_measurement: 'W'
edimax1_kwh:
value_template: '{{ states.switch.edimax1.attributes["today_energy_kwh"] | float * 1000 | round(2) }}'
unit_of_measurement: 'kWh'
edimax1_cost:
value_template: '{{ states("sensor.edimax1_kwh") | round (2) | float * 16 }}'
unit_of_measurement: '¢'
edimax2_watts:
value_template: '{{ states.switch.edimax2.attributes["current_power_w"] | float * 1000000 | round(2) }}'
unit_of_measurement: 'W'
edimax2_kwh:
value_template: '{{ states.switch.edimax2.attributes["today_energy_kwh"] | float * 1000 | round(2) }}'
unit_of_measurement: 'kWh'
edimax2_cost:
value_template: '{{ states("sensor.edimax2_kwh") | round (2) | float * 16 }}'
unit_of_measurement: '¢'
####################################################
# #
# HOME ASSISTANT UPTIME #
# #
####################################################
#https://home-assistant.io/components/sensor.command_line/
- platform: command_line
name: "HA Uptime"
command: echo "$(($(date +%s) - $(date -d "$(head -n1 /home/ha/.homeassistant/home-assistant.log | cut -d' ' -f-2)" +%s)))"
scan_interval: 720
value_template: >-
{% set uptime = value | int %}
{% set seconds = uptime % 60 %}
{% set minutes = ((uptime % 3600) / 60) | int %}
{% set hours = ((uptime % 86400) / 3600) | int %}
{% set days = (uptime / 86400) | int %}
{%- if days > 0 -%}
{%- if days == 1 -%}
1 day
{%- else -%}
{{ days }} days
{%- endif -%}
{{ ', ' }}
{%- endif -%}
{{ '%02d' % hours }}:{{ '%02d' % minutes }}
####################################################
# #
# ZWAVE DOOR SENSORS #
# #
####################################################
#https://home-assistant.io/components/sensor.template/
- platform: template
sensors:
gehingepinsensor1:
value_template: "{%if states.sensor.ge_32563_hinge_pin_smart_door_sensor_access_control.state == '23' %}Closed{% elif states.sensor.ge_32563_hinge_pin_smart_door_sensor_access_control.state == '22' %}Open{% endif %}"
gehingepinsensor1batt:
value_template: '{% if states.zwave.ge_32563_hinge_pin_smart_door_sensor %} {{ states.zwave.ge_32563_hinge_pin_smart_door_sensor.attributes.battery_level }} {% else %} Unknown {% endif %}'
unit_of_measurement: '%'
gehingepinsensor2:
value_template: "{%if states.sensor.ge_32563_hinge_pin_smart_door_sensor_access_control_2.state == '23' %}Closed{% elif states.sensor.ge_32563_hinge_pin_smart_door_sensor_access_control_2.state == '22' %}Open{% endif %}"
gehingepinsensor2batt:
value_template: '{% if states.zwave.ge_32563_hinge_pin_smart_door_sensor_2 %} {{ states.zwave.ge_32563_hinge_pin_smart_door_sensor_2.attributes.battery_level }} {% else %} Unknown {% endif %}'
unit_of_measurement: '%'
garagedoorstatus:
value_template: "{%if states.sensor.vision_zg8101_garage_door_detector_alarm_level.state == '0' %}Closed{% elif states.sensor.vision_zg8101_garage_door_detector_alarm_level.state == '255' %}Open{% endif %}"
garagedoorstatusbatt:
value_template: '{% if states.zwave.vision_zg8101_garage_door_detector %} {{ states.zwave.vision_zg8101_garage_door_detector.attributes.battery_level }} {% else %} Unknown {% endif %}'
unit_of_measurement: '%'
backdoorstatus:
value_template: "{%if states.sensor.unknown_id021f_unknown_type0003_id0101_access_control.state == '23' %}Closed{% elif states.sensor.unknown_id021f_unknown_type0003_id0101_access_control.state == '22' %}Open{% endif %}"
backdoorstatusbatt:
value_template: '{% if states.zwave.unknown_id021f_unknown_type0003_id0101 %} {{ states.zwave.unknown_id021f_unknown_type0003_id0101.attributes.battery_level }} {% else %} Unknown {% endif %}'
unit_of_measurement: '%'
####################################################
# #
# SYNOLOGY #
# #
####################################################
#https://home-assistant.io/components/sensor.synologydsm/
- platform: synologydsm
host: 192.168.2.2
port: 5000
username: !secret nas_username
password: !secret nas_password
monitored_conditions:
- cpu_total_load
- memory_real_usage
- network_up
- network_down
- disk_smart_status
- disk_temp
- volume_percentage_used
####################################################
# #
# SONOFFS #
# #
####################################################
#https://home-assistant.io/components/sensor.mqtt/
- platform: mqtt
name: "th161 temperature"
state_topic: "tele/th161/SENSOR"
value_template: "{{ value_json['AM2301'].Temperature }}"
unit_of_measurement: "°F"
- platform: mqtt
name: "th161 humidity"
state_topic: "tele/th161/SENSOR"
value_template: "{{ value_json['AM2301'].Humidity }}"
unit_of_measurement: "%"
- platform: mqtt
name: "POW1 Energy"
state_topic: "tele/pow1/SENSOR"
value_template: '{{ value_json["ENERGY"]["Today"] }}'
unit_of_measurement: "kWh"
- platform: mqtt
name: "POW1 Power"
state_topic: "tele/pow1/SENSOR"
value_template: '{{ value_json["ENERGY"]["Power"] }}'
unit_of_measurement: "W"
- platform: mqtt
name: "POW1 Voltage"
state_topic: "tele/pow1/SENSOR"
value_template: '{{ value_json["ENERGY"]["Voltage"] }}'
unit_of_measurement: "V"
- platform: mqtt
name: "POW1 Current"
state_topic: "tele/pow1/SENSOR"
value_template: '{{ value_json["ENERGY"]["Current"] }}'
unit_of_measurement: "A"
- platform: mqtt
name: "POW2 Energy"
state_topic: "tele/pow2/SENSOR"
value_template: '{{ value_json["ENERGY"]["Today"] }}'
unit_of_measurement: "kWh"
- platform: mqtt
name: "POW2 Power"
state_topic: "tele/pow2/SENSOR"
value_template: '{{ value_json["ENERGY"]["Power"] }}'
unit_of_measurement: "W"
- platform: mqtt
name: "POW2 Voltage"
state_topic: "tele/pow2/SENSOR"
value_template: '{{ value_json["ENERGY"]["Voltage"] }}'
unit_of_measurement: "V"
- platform: mqtt
name: "POW2 Current"
state_topic: "tele/pow2/SENSOR"
value_template: '{{ value_json["ENERGY"]["Current"] }}'
unit_of_measurement: "A"
####################################################
# #
# CERTIFICATE EXPIRY #
# #
####################################################
#https://home-assistant.io/components/sensor.cert_expiry/
- platform: cert_expiry
host: !secret host
port: 8123
name: Lets Encrypt Expiration
####################################################
# #
# END OF CONFIGURATION FILE #
# #
####################################################