forked from arsaboo/homeassistant-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsensor.yaml
executable file
·326 lines (325 loc) · 11.6 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
- platform: version
- platform: uptime
unit_of_measurement: minutes
- platform: season
- platform: cert_expiry
host: !secret ha_url
- platform: speedtest
hour:
- 12
monitored_conditions:
- download
- platform: history_stats
name: Total TV Time
entity_id: media_player.panasonic_viera_tv
state: 'on'
type: time
start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
end: '{{ now() }}'
- platform: currencylayer
api_key: !secret currencylayer_key
base: USD
quote:
- INR
- platform: arlo
#Forecast.io weather sensors
- platform: darksky
api_key: !secret darksky_key
monitored_conditions:
- wind_speed
- cloud_cover
- hourly_summary
- daily_summary
#Time and Date Sensor
- platform: time_date
display_options:
- 'time_date'
- 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
api_key: !secret google_key
origin: !secret add_home
destination: !secret add_buckhead
#Evening Commute Google Travel Time Sensor
- platform: google_travel_time
name: Evening Commute
api_key: !secret google_key
origin: !secret add_buckhead
destination: !secret add_home
- platform: google_travel_time
name: Alok to Home
friendly_name: "Commute to Home"
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: gearbest
currency: USD
items:
- url: https://www.gearbest.com/alarm-systems/pp_659226.html
name: Xiaomi Aqara Human Body Sensor
- url: https://www.gearbest.com/access-control/pp_626702.html
name: Xiaomi Aqara Temperature Humidity Sensor
- url: https://www.gearbest.com/smart-light-bulb/pp_278478.html
name: Xiaomi Yeelight White
- url: https://www.gearbest.com/smart-light-bulb/pp_257677.html
name: Xiaomi Door Window Sensor
# Add in your secrets.yaml file pollen_url: https://www.pollen.com/api/forecast/current/pollen/ZIPCODE
- platform: rest
name: pollen
resource: !secret pollen_url
value_template: "{{value_json.Location.periods[1].Index}}"
scan_interval: 21600
headers:
Referer: "https://www.pollen.com"
# Add in your secrets.yaml file pollen_url: https://www.pollen.com/api/forecast/current/pollen/ZIPCODE
- platform: rest
name: cold_flu
resource: !secret cold_flu_url
value_template: "{{value_json.Location.periods[0].Index}}"
scan_interval: 21600
headers:
Referer: "https://www.pollen.com"
- 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: "PyPi HASS Version"
command: python3 -c "import requests; print(requests.get('https://pypi.python.org/pypi/homeassistant/json').json()['info']['version'])"
- platform: template
sensors:
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
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 -%}
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: >-
# {%- if states.camera.front_door.attributes.video_url != None -%}
# {{states.camera.front_door.attributes.video_url.split('?')[0]}}
# {%- else -%}
# unknown
# {%- endif -%}
hoursslept:
friendly_name: "Hours Slept"
unit_of_measurement: "hrs"
value_template: >-
{%- if states.sensor.sleep_minutesasleep != None -%}
{{(states.sensor.sleep_minutesasleep.state|int/60)|round(2)}}
{%- else -%}
unknown
{%- endif -%}
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 -%}
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.livingroomsonos.attributes.volume_level != None -%}
{{ (states.media_player.livingroomsonos.attributes.volume_level|default(0) * 100) |int }}
{%- else -%}
NA
{%- endif -%}
friendly_name: 'Sonos Volume'
leeotemp:
friendly_name: "Leeo Temperature"
unit_of_measurement: '°F'
value_template: >-
{%- if states.input_number.leeotemperature.state != None -%}
{{ states.input_number.leeotemperature.state }}
{%- else -%}
NA
{%- endif -%}
leeohumid:
friendly_name: "Leeo Humidity"
unit_of_measurement: '%'
value_template: >-
{%- if states.input_number.leeohumidity.state != None -%}
{{ states.input_number.leeohumidity.state }}
{%- else -%}
NA
{%- endif -%}
leeouptemp:
friendly_name: "Leeo Upstairs Temperature"
unit_of_measurement: '°F'
value_template: >-
{%- if states.input_number.leeoupstairstemp.state != None -%}
{{ states.input_number.leeoupstairstemp.state }}
{%- else -%}
NA
{%- endif -%}
leeouphumid:
friendly_name: "Leeo Upstairs Humidity"
unit_of_measurement: '%'
value_template: >-
{%- if states.input_number.leeoupstairshumidity.state != None -%}
{{ states.input_number.leeoupstairshumidity.state }}
{%- else -%}
NA
{%- endif -%}
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: >-
{%- if states.sensor.pollen.state|float <= 2.4 %}
Low
{%- elif states.sensor.pollen.state|float <= 4.8 %}
Medium-Low
{%- elif states.sensor.pollen.state|float <= 7.2 %}
Medium
{%- elif states.sensor.pollen.state|float <= 9.6 %}
Medium-High
{%- elif states.sensor.pollen.state|float <= 12.0 %}
High
{% else %}
Unknown
{%- endif %}
cold_flu_risk:
friendly_name: 'Cold & Flu Risk'
value_template: >-
{%- if states.sensor.cold_flu.state|float <= 2.4 %}
Low
{%- elif states.sensor.cold_flu.state|float <= 4.8 %}
Medium-Low
{%- elif states.sensor.cold_flu.state|float <= 7.2 %}
Medium
{%- elif states.sensor.cold_flu.state|float <= 9.6 %}
Medium-High
{%- elif states.sensor.cold_flu.state|float <= 12.0 %}
High
{% else %}
Unknown
{%- endif %}
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 -%}.