forked from arsaboo/homeassistant-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsensor.yaml
executable file
·532 lines (532 loc) · 19.3 KB
/
sensor.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
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
- platform: moon
app_id: !secret here_app_id
app_code: !secret here_app_code
zipcode: !secret home_zip
- platform: darksky
api_key: !secret darksky_key
monitored_conditions:
- summary
- daily_summary
- hourly_summary
- temperature
update_interval:
minutes: 20
- platform: season
- platform: tautulli
host: 192.168.2.212
api_key: !secret tautulli_api
monitored_conditions:
- stream_count
- stream_count_transcode
- stream_count_direct_play
- stream_count_direct_stream
- total_bandwidth
- platform: sql
db_url: !secret recorder_db_url
queries:
- name: Portfolio morning
query: "SELECT state FROM states WHERE entity_id='sensor.pc_investment' and (HOUR(last_changed) >= 22 and (DATEDIFF(NOW(), last_changed) = 1 or DATEDIFF(NOW(), last_changed) = 2 or DATEDIFF(NOW(), last_changed) = 3 or DATEDIFF(NOW(), last_changed) = 4)) ORDER BY last_changed desc LIMIT 1;"
column: 'state'
unit_of_measurement: $
- platform: personalcapital
email: !secret pc_username
password: !secret pc_password
monitored_categories:
- investment
- mortgage
- cash
- other_asset
- credit
- loan
- platform: arlo
monitored_conditions:
- captured_today
- last_capture
- battery_level
- signal_strength
- platform: futures_cnn
resources:
- sp
- sp_change_pct
- sp_change
- dow
- dow_change_pct
- dow_change
- nasdaq
- nasdaq_change_pct
- nasdaq_change
- platform: uscis
case_id: !secret alok_485
friendly_name: Alok 485
- platform: uscis
case_id: !secret rashmi_485
friendly_name: Rashmi 485
- platform: uscis
case_id: !secret arnav_485
friendly_name: Arnav 485
- platform: pollen
zip_code: !secret home_zip
monitored_conditions:
- allergy_average_forecasted
- disease_average_forecasted
- platform: version
- platform: uptime
unit_of_measurement: minutes
# - platform: cert_expiry
# host: !secret ha_url
- platform: glances
host: 192.168.2.212
version: 3
resources:
- 'disk_use_percent'
- 'memory_use_percent'
- 'processor_load'
- platform: speedtest
hour:
- 2
monitored_conditions:
- download
- platform: history_stats
name: Total TV Time
entity_id: media_player.living_room_tv
state: 'on'
type: time
start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
end: '{{ now() }}'
- platform: history_stats
name: Downstairs heat
entity_id: sensor.downstairsthermoper
state: 'heat'
type: time
start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
end: '{{ now() }}'
- platform: history_stats
name: Downstairs cool
entity_id: sensor.downstairsthermoper
state: 'cool'
type: time
start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
end: '{{ now() }}'
- platform: history_stats
name: Upstairs heat
entity_id: sensor.upstairsthermoper
state: 'heat'
type: time
start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
end: '{{ now() }}'
- platform: history_stats
name: Upstairs cool
entity_id: sensor.upstairsthermoper
state: 'cool'
type: time
start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
end: '{{ now() }}'
- platform: history_stats
name: Master heat
entity_id: sensor.masterthermoper
state: 'heat'
type: time
start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
end: '{{ now() }}'
- platform: history_stats
name: Master cool
entity_id: sensor.masterthermoper
state: 'cool'
type: time
start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
end: '{{ now() }}'
- platform: plex
name: PlexSpy
host: 192.168.2.212
port: 32400
# token: !secret plex_token
username: !secret plex_user
password: !secret plex_password
#Morning Commute Google Travel Time Sensor
- platform: google_travel_time
name: Morning Commute
scan_interval: 60000
api_key: !secret google_key
origin: !secret add_home
destination: !secret add_buckhead
#Evening Commute Google Travel Time Sensor
- platform: google_travel_time
name: Alok to Home
friendly_name: "Commute to Home"
scan_interval: 60000
api_key: !secret google_key
origin: device_tracker.alok_alok
destination: !secret add_home
# - platform: wunderground
# api_key: !secret wunderground_key
# pws_id: !secret wunderground_pws
# monitored_conditions:
# - weather
# - temp_f
# - wind_string
# - relative_humidity
- platform: sectorperformance
api_key: !secret alphavantage_key
- platform: alpha_vantage
api_key: !secret alphavantage_key
foreign_exchange:
- from: USD
to: INR
name: USDINR
# - platform: mqtt
# state_topic: "owntracks/pi/rashmiphone/step"
# name: "Steps Rashmi"
# value_template: '{{ value_json.steps }}'
# - platform: mqtt
# state_topic: "owntracks/pi/alokphone/step"
# name: "Steps Alok"
# value_template: '{{ value_json.steps }}'
- platform: command_line
name: Grafana temp down
command: !secret grafana_temp_down
scan_interval: 300
- platform: command_line
name: Grafana mode down
command: !secret grafana_mode_down
scan_interval: 300
- platform: command_line
name: Grafana temp up
command: !secret grafana_temp_up
scan_interval: 300
- platform: command_line
name: Grafana mode up
command: !secret grafana_mode_up
scan_interval: 300
- platform: command_line
name: Grafana temp master
command: !secret grafana_temp_master
scan_interval: 300
- platform: command_line
name: Grafana mode master
command: !secret grafana_mode_master
scan_interval: 300
- platform: command_line
name: Grafana portfolio
command: !secret grafana_portfolio
scan_interval: 120
- platform: command_line
name: Grafana networth
command: !secret grafana_networth
scan_interval: 120
- platform: command_line
name: SSL certificate expiry
unit_of_measurement: days
scan_interval: 86400
command: !secret cert_expiry
- platform: command_line
name: 10 Year Treasury
unit_of_measurement: '%'
scan_interval: 18000
command: "wget -O - -q http://money.cnn.com/data/premarket | grep 'last_572094' | awk -F'>' '{print $3}' | awk -F'<' '{print $1}'"
# - platform: scrape
# resource: http://money.cnn.com/data/premarket/
# name: Curr Future
# scan_interval: 86400
# # select: ".wsod_bold.wsod_aRight span"
# select: ".wsod_bold.wsod_aRight"
- platform: rest
method: POST
resource: http://192.168.2.253:1400/DeviceProperties/Control
name: Sonos Stereo
headers:
SOAPACTION: "urn:schemas-upnp-org:service:DeviceProperties:1#GetZoneInfo"
Content-Type: text/xml; charset="utf-8"
payload: '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetZoneInfo xmlns:u="urn:schemas-upnp-org:service:DeviceProperties:1"></u:GetZoneInfo></s:Body></s:Envelope>'
value_template: '{{ value | regex_replace(".*<HTAudioIn>([0-9]+)</HTAudioIn>.*", "\\1") }}'
# value_template: '{{ "<HTAudioIn>2</HTAudioIn>" in value }}'
# - platform: rest
# resource: !secret here_weather
# name: Moon Rise
# scan_interval: 86400
# value_template: '{{value_json.astronomy.astronomy[0].moonrise}}'
# json_attributes:
# - moonset
# - moonPhaseDesc
# - moonPhase
# - sunrise
# - sunset
- platform: template
sensors:
# iframe_windy:
# value_template: iframe
cube_last_action:
friendly_name: "Cube last action"
value_template: >
{% if as_timestamp(now()) - as_timestamp(states.binary_sensor.cube_158d0001035aa7.last_updated) >50 %}
None
{% else %}
{{state_attr('binary_sensor.cube_158d0001035aa7', 'last_action')}}
{% endif %}
livingroom_temp_rounded:
friendly_name: "Living room temperature"
value_template: "{{states('sensor.temperature_158d0001ab3c88')|round}}"
study_temp_rounded:
friendly_name: "Study temperature"
value_template: "{{states('sensor.temperature_158d0001ab3b2b')|round}}"
sonos_audio_in:
friendly_name: "Sonos Audio-in"
value_template: >-
{%- set audio_in = {'0': 'No SPDIF input connected', '2': 'Stereo', '7': 'Dolby 2.0', '18': 'Dolby 5.1', '20': 'Pause Burst', '21': 'Paused', '22': 'Silence'} -%}
{{ audio_in[states.sensor.sonos_stereo.state] | default('NA', true)}}
icon_template: >-
{%- set audio_in = {'2': 'mdi:surround-sound-2-0', '7': 'mdi:dolby', '18': 'mdi:surround-sound-5-1'} -%}
{{ audio_in[states.sensor.sonos_stereo.state] | default('mdi:volume-high', true) }}
battery_status:
friendly_name: "Battery Status"
value_template: >-
{%- set threshold = 25 -%}
{%- set domains = ['light', 'switch', 'sensor', 'zwave', 'binary_sensor', 'camera'] -%}
{%- for domain in domains -%}
{%- for item in states[domain] if ((item.attributes.battery_low is defined and item.attributes['battery_low'] == true) or (item.attributes.battery_level is defined and item.attributes['battery_level'] | int < threshold)) -%}
{{ item.name }}{%- if not loop.last %}, {% endif -%}
{%- endfor -%}
{%- endfor -%}
# hassuptime:
# friendly_name: "HASS Uptime"
# value_template: >-
# {% set uptime = states.sensor.uptime.state | round %}
# {% set minutes = (uptime % 60) | int %}
# {% set hours = ((uptime / 60) % 24) | int %}
# {% set days = (uptime / 1440) | int %}
# {%- if days > 0 -%}
# {%- if days == 1 -%}
# 1 day
# {%- else -%}
# {{ days }} days
# {%- endif -%}
# {{ ', ' }}
# {%- endif -%}
# {{ '%02d' % hours }}:{{ '%02d' % minutes }} hrs
downstairs_hvac_runtime:
friendly_name: "Downstairs HVAC Runtime"
unit_of_measurement: "h"
value_template: >-
{%- if [states.sensor.downstairs_cool.state|float, states.sensor.downstairs_heat.state|float, 0]|max != None -%}
{{ [states.sensor.downstairs_cool.state|float, states.sensor.downstairs_heat.state|float, 0]|max }}
{%- else -%}
0
{%- endif -%}
icon_template: >-
{%- if states('sensor.downstairs_cool')|default(0) < states('sensor.downstairs_heat')|default(0) -%}
mdi:fire
{%- elif states('sensor.downstairs_cool')|default(0) > states('sensor.downstairs_heat')|default(0) -%}
mdi:snowflake
{%- endif -%}
upstairs_hvac_runtime:
friendly_name: "Upstairs HVAC Runtime"
unit_of_measurement: "h"
value_template: >-
{%- if [states.sensor.upstairs_cool.state|float, states.sensor.upstairs_heat.state|float, 0]|max != None -%}
{{ [states.sensor.upstairs_cool.state|float, states.sensor.upstairs_heat.state|float, 0]|max }}
{%- else -%}
0
{%- endif -%}
icon_template: >-
{%- if states('sensor.upstairs_cool')|default(0) < states('sensor.upstairs_heat')|default(0) -%}
mdi:fire
{%- elif states('sensor.upstairs_cool')|default(0) > states('sensor.upstairs_heat')|default(0) -%}
mdi:snowflake
{%- endif -%}
master_hvac_runtime:
friendly_name: "Master HVAC Runtime"
unit_of_measurement: "h"
value_template: >-
{%- if [states.sensor.master_cool.state|float, states.sensor.master_heat.state|float, 0]|max != None -%}
{{ [states.sensor.master_cool.state|float, states.sensor.master_heat.state|float, 0]|max }}
{%- else -%}
0
{%- endif -%}
icon_template: >-
{%- if states('sensor.master_cool')|default(0) < states('sensor.master_heat')|default(0) -%}
mdi:fire
{%- elif states('sensor.master_cool')|default(0) > states('sensor.master_heat')|default(0) -%}
mdi:snowflake
{%- endif -%}
wemopowerused:
friendly_name: "Wemo Current Power"
unit_of_measurement: "w"
value_template: >-
{%- if states.switch.wemoinsight.attributes.current_power_w != None -%}
{{(states.switch.wemoinsight.attributes|default({})).current_power_w|default(0)|round(2)}}
{%- else -%}
0
{%- endif -%}
portfolioval:
friendly_name: "Portfolio Value"
unit_of_measurement: "$"
value_template: >-
{%- if states.input_number.portfoliovalue.state != None -%}
{{states.input_number.portfoliovalue.state|default(0)|round(2)}}
{%- else -%}
0
{%- endif -%}
portfoliochange:
friendly_name: "Portfolio Change"
unit_of_measurement: "$"
value_template: >-
{%- if states.input_number.portfoliochange.state != None -%}
{{states.input_number.portfoliochange.state|default(0)|round(2)}}
{%- else -%}
0
{%- endif -%}
portfoliochange2:
friendly_name: "Portfolio Change (PC)"
unit_of_measurement: "$"
value_template: >-
{{(states('sensor.pc_investment')|float - states('sensor.portfolio_morning')|float)|round (2)}}
hvacmode:
friendly_name: "HVAC Mode"
value_template: >-
{%- if states.climate.upstairs.attributes.operation == "heat" -%}
heat
{%- elif states.climate.downstairs.attributes.operation == "cool" -%}
cool
{%- endif -%}
icon_template: >-
{%- if states.climate.upstairs.attributes.operation == "heat" -%}
mdi:fire
{%- elif states.climate.downstairs.attributes.operation == "cool" -%}
mdi:snowflake
{%- endif -%}
# ringvideourl:
# friendly_name: "Ring Video URL"
# value_template: >-
# {{state_attr('camera.front_door', 'video_url').split('?')[0]}}
garagedoorbattery:
friendly_name: "Garage Door Sensor Battery"
unit_of_measurement: "%"
value_template: >-
{%- if states.zwave.garage_door_tilt_sensor != None -%}
{{ states.zwave.garage_door_tilt_sensor.attributes.battery_level }}
{%- else -%}
unknown
{%- endif -%}
downstairsthermoper:
friendly_name: "Downstairs Thermostat"
value_template: >-
{%- if states.climate.downstairs != None -%}
{{ states.climate.downstairs.attributes.operation }}
{%- else -%}
unknown
{%- endif -%}
icon_template: >-
{%- if states.climate.downstairs.attributes.operation == "heat" -%}
mdi:fire
{%- elif states.climate.downstairs.attributes.operation == "cool" -%}
mdi:snowflake
{%- else -%}
mdi:fan
{%- endif -%}
upstairsthermoper:
friendly_name: "Upstairs Thermostat"
value_template: >-
{%- if states.climate.upstairs != None -%}
{{ states.climate.upstairs.attributes.operation }}
{%- else -%}
unknown
{%- endif -%}
icon_template: >-
{%- if states.climate.upstairs.attributes.operation == "heat" -%}
mdi:fire
{%- elif states.climate.upstairs.attributes.operation == "cool" -%}
mdi:snowflake
{%- else -%}
mdi:fan
{%- endif -%}
masterthermoper:
friendly_name: "Master Thermostat"
value_template: >-
{%- if states.climate.bedroom != None -%}
{{ states.climate.bedroom.attributes.operation }}
{%- else -%}
unknown
{%- endif -%}
icon_template: >-
{%- if states.climate.bedroom.attributes.operation == "heat" -%}
mdi:fire
{%- elif states.climate.bedroom.attributes.operation == "cool" -%}
mdi:snowflake
{%- else -%}
mdi:fan
{%- endif -%}
living_room:
value_template: >-
{%- if states.states.remote.livingroom != None -%}
{{ states.remote.livingroom.attributes.current_activity }}
{%- else -%}
NA
{%- endif -%}
sonos_volume:
value_template: >-
{%- if states.media_player.family_room_2.attributes.volume_level != None -%}
{{ (states.media_player.family_room_2.attributes.volume_level|default(0) * 100) |int }}
{%- else -%}
NA
{%- endif -%}
friendly_name: 'Sonos Volume'
leeoalarmstatus:
friendly_name: "Leeo Alarm"
value_template: >-
{%- if states.input_boolean.leeoalarm.state == 'off' -%}
Off
{%- elif states.input_boolean.leeoalarm.state == 'on' -%}
Active
{%- elif states.input_boolean.leeoalarm.state == None -%}
unknown
{%- endif -%}
pollen_level:
friendly_name: 'Pollen Level'
value_template: >-
{{ state_attr('sensor.allergy_index_forecasted_average', 'rating') }}
entity_picture_template: >-
{{ '/local/icons/' ~ state_attr('sensor.allergy_index_forecasted_average', 'rating').lower().replace('/', '-') ~ '.png'}}
cold_flu_risk:
friendly_name: 'Cold & Flu Risk'
value_template: >-
{{ state_attr('sensor.cold_flu_forecasted_average', 'rating') }}
entity_picture_template: >-
{{ '/local/icons/' ~ state_attr('sensor.cold_flu_forecasted_average', 'rating').lower().replace('/', '-') ~ '.png'}}
emulated_hue_names:
friendly_name: "Emulated Hue Names"
value_template: >-
{% for item in states if item.attributes.emulated_hue_name|length > 0-%}
{%- if loop.first %}{% elif loop.last %}, and {% else %}, {% endif -%}
{{item.attributes.emulated_hue_name|title}}
{%- endfor -%}.
# porchtags:
# friendly_name: "Porch Tags"
# value_template: >-
# {{ states('input_text.porch') }}
# drivewaytags:
# friendly_name: "Driveway Tags"
# value_template: >-
# {{ states('input_text.driveway') }}
# backyardtags:
# friendly_name: "Backyard Tags"
# value_template: >-
# {{ states('input_text.backyard') }}
# patiotags:
# friendly_name: "Patio Tags"
# value_template: >-
# {{ states('input_text.patio') }}
# porchfaces:
# friendly_name: "Porch Faces"
# value_template: >-
# {{ states('input_text.porchfaces') }}
# drivewayfaces:
# friendly_name: "Driveway Faces"
# value_template: >-
# {{ states('input_text.drivewayfaces') }}
# backyardfaces:
# friendly_name: "Backyard Faces"
# value_template: >-
# {{ states('input_text.backyardfaces') }}
# patiofaces:
# friendly_name: "Patio Faces"
# value_template: >-
# {{ states('input_text.patiofaces') }}