-
Notifications
You must be signed in to change notification settings - Fork 0
/
templates.yaml
588 lines (578 loc) · 29.2 KB
/
templates.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
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
- binary_sensor:
- name: 'Both Home'
unique_id: both_home
state: "{{ is_state('person.scott', 'home') and is_state('person.stephanie', 'home') }}"
- name: 'Both Away'
unique_id: both_away
state: "{{ not is_state('person.scott', 'home') and not is_state('person.stephanie', 'home') }}"
- name: 'Motion Home'
unique_id: motion_home
state: >
{%- set counter = namespace(total=0) %}
{%- for sensor in expand('group.motion_sensors') | map(attribute='last_changed') %}
{%- if now() - sensor < timedelta(seconds=600) %}
{%- set counter.total = counter.total + 1 %}
{%- endif %}
{%- endfor %}
{{ iif(counter.total > 0, true, false) }}
- name: 'Door Open'
unique_id: door_open
state: >
{%- set counter = namespace(total=0) %}
{%- for sensor in expand('group.door_sensors') | map(attribute='last_changed') %}
{%- if now() - sensor < timedelta(seconds=600) %}
{%- set counter.total = counter.total + 1 %}
{%- endif %}
{%- endfor %}
{{ iif(counter.total > 0, true, false) }}
- name: 'FamilyRoom Right Red On'
unique_id: familyroom_right_red_on
state: >-
{% set cutoff = 0.75 %}
{% set elevation_cutoff = 0 %}
{% set power = states('sensor.envoy_net_meter_power_demand') | float(default=0) %}
{% set solar_elevation = state_attr('sun.sun', 'elevation') | int(default=0) %}
{{ power > cutoff and solar_elevation > elevation_cutoff }}
- name: 'FamilyRoom Right Yellow On'
unique_id: familyroom_right_yellow_on
state: >-
{% set cutoff = 1.0 %}
{% set elevation_cutoff = 0 %}
{% set power = states('sensor.envoy_net_meter_power_demand') | float(default=0) | abs %}
{% set solar_elevation = state_attr('sun.sun', 'elevation') | int(default=0) %}
{{ power < cutoff and solar_elevation > elevation_cutoff }}
- name: 'FamilyRoom Right Green On'
unique_id: familyroom_right_green_on
state: >-
{% set cutoff = -0.75 %}
{% set elevation_cutoff = 0 %}
{% set power = states('sensor.envoy_net_meter_power_demand') | float(default=0) %}
{% set solar_elevation = state_attr('sun.sun', 'elevation') | int(default=0) %}
{{ power < cutoff and solar_elevation > elevation_cutoff }}
- name: 'FamilyRoom Left Red On'
unique_id: familyroom_left_red_on
state: >-
{% set pool_cutoff = 75 %}
{% set spa_cutoff = 90 %}
{% set pool_temp = states('sensor.pentair_pool_temperature') | float(default=0) %}
{% set spa_temp = states('sensor.pentair_spa_temperature') | float(default=0) %}
{% set pool_pump = states('switch.pentair_0d_ce_47_pool') %}
{% set spa_pump = states('switch.pentair_0d_ce_47_spa') %}
{% set pool_heat = states('climate.pentair_0d_ce_47_pool_heat') %}
{% set spa_heat = states('climate.pentair_0d_ce_47_spa_heat') %}
{{ (pool_temp <= pool_cutoff and pool_pump == "on" and pool_heat == "heat") or (spa_temp <= spa_cutoff and spa_pump == "on" and spa_heat == "heat") }}
- name: 'FamilyRoom Left Yellow On'
unique_id: familyroom_left_yellow_on
state: >-
{% set pool_lower_cutoff = 75 %}
{% set pool_upper_cutoff = 80 %}
{% set spa_lower_cutoff = 90 %}
{% set spa_upper_cutoff = 97 %}
{% set pool_temp = states('sensor.pentair_pool_temperature') | float(default=0) %}
{% set spa_temp = states('sensor.pentair_spa_temperature') | float(default=0) %}
{% set pool_pump = states('switch.pentair_0d_ce_47_pool') %}
{% set spa_pump = states('switch.pentair_0d_ce_47_spa') %}
{% set pool_heat = states('climate.pentair_0d_ce_47_pool_heat') %}
{% set spa_heat = states('climate.pentair_0d_ce_47_spa_heat') %}
{{ (pool_temp > pool_lower_cutoff and pool_temp < pool_upper_cutoff and pool_pump == "on" and pool_heat == "heat") or (spa_temp > spa_lower_cutoff and spa_temp < spa_upper_cutoff and spa_pump == "on" and spa_heat == "heat") }}
- name: 'FamilyRoom Left Green On'
unique_id: familyroom_left_green_on
state: >-
{% set pool_cutoff = 80 %}
{% set spa_cutoff = 97 %}
{% set pool_temp = states('sensor.pentair_pool_temperature') | float(default=0) %}
{% set spa_temp = states('sensor.pentair_spa_temperature') | float(default=0) %}
{% set pool_pump = states('switch.pentair_0d_ce_47_pool') %}
{% set spa_pump = states('switch.pentair_0d_ce_47_spa') %}
{% set pool_heat = states('climate.pentair_0d_ce_47_pool_heat') %}
{% set spa_heat = states('climate.pentair_0d_ce_47_spa_heat') %}
{{ (pool_temp >= pool_cutoff and pool_pump == "on" and pool_heat == "heat") or (spa_temp >= spa_cutoff and spa_pump == "on" and spa_heat == "heat") }}
- name: 'Sun Down'
unique_id: sun_down
state: >-
{{ is_state('sun.sun', 'below_horizon') }}
- name: 'Hot Water Recirc On'
unique_id: hot_water_recirc_on
state: >-
{% set home = 'Home' %}
{% set house_mode = states('input_select.house_mode') %}
{% set recirc_pump = states('binary_sensor.recirc_pump') %}
{{ recirc_pump == "on" and house_mode == home }}
- name: 'Bright Light'
unique_id: bright_light
state: >-
{% set solar_radiation_cutoff = 50 %}
{% set solar_radiation = states('sensor.gw1000_solarradiation') | int(default=0) %}
{% set current_bright = states('binary_sensor.bright_light') %}
{% set sun_up = is_state('sun.sun', 'above_horizon') %}
{{ sun_up and (current_bright == "on" or solar_radiation > solar_radiation_cutoff) }}
- name: 'All Shades Down'
unique_id: all_shades_down
state: >-
{% set elevation_cutoff = states('input_number.solar_elevation_cutoff') | int(default=0) %}
{% set solar_elevation = state_attr('sun.sun', 'elevation') | int(default=0) %}
{% set current_bright = states('binary_sensor.bright_light') %}
{{ solar_elevation > elevation_cutoff and current_bright == "on" }}
- name: 'All Shades Up'
unique_id: all_shades_up
state: >-
{% set elevation_cutoff = states('input_number.solar_elevation_cutoff') | int(default=0) %}
{% set home = 'Home' %}
{% set solar_elevation = state_attr('sun.sun', 'elevation') | int(default=0) %}
{% set house_mode = states('input_select.house_mode') %}
{{ solar_elevation < elevation_cutoff and house_mode == home }}
- name: 'Art Lights On'
unique_id: art_lights_on
state: >-
{% set home = 'Home' %}
{% set house_mode = states('input_select.house_mode') %}
{% set art_lights = states('schedule.art_lights') %}
{{ art_lights == "on" and house_mode == home }}
- name: 'Cellar Alert'
unique_id: cellar_alert
state: >-
{% set low_temp = 50 %}
{% set high_temp = 60 %}
{% set low_humid = 50 %}
{% set high_humid = 75 %}
{% set cellar_temp = states('sensor.gw1000_temp2') | int(default=0) %}
{% set cellar_humid = states('sensor.gw1000_humidity2') | int(default=0) %}
{{ (cellar_temp != 0 and cellar_temp < low_temp) or
(cellar_temp !=0 and cellar_temp > high_temp) or
(cellar_humid !=0 and cellar_humid < low_humid) or
(cellar_humid !=0 and cellar_humid > high_humid) }}
- name: 'Upstairs HVAC Status'
unique_id: upstairs_hvac_status
state: >-
{%- set action = state_attr('climate.main_floor', 'hvac_action') %}
{{ action == "heating" or action == "cooling" }}
- name: 'Downstairs HVAC Status'
unique_id: downstairs_hvac_status
state: >-
{%- set action = state_attr('climate.downstairs', 'hvac_action') %}
{{ action == "heating" or action == "cooling" }}
- name: 'Chiller Status'
unique_id: chiller_status
state: >-
{% set low_power = 200 %}
{% set apparent_power = states('sensor.tasmota5_energy_apparentpower') | int(default=0) %}
{{ apparent_power > low_power }}
- name: 'Water Heater Status'
unique_id: water_heater_status
state: >-
{% set heating_rate_of_change = 1.0 %}
{% set water_heater_rate_of_change = states('sensor.pool_room_change_per_minute') | float(default=0) %}
{{ water_heater_rate_of_change > heating_rate_of_change }}
- name: 'Guest1 Bath Status'
unique_id: guest1_bath_status
state: "{{ states('climate.guest_1') != 'off' }}"
- name: 'Guest2 Bath Status'
unique_id: guest2_bath_status
state: "{{ states('climate.guest_2') != 'off' }}"
- name: 'Master Bath Status'
unique_id: master_bath_status
state: "{{ states('climate.master_bath') != 'off' }}"
- name: Main Garage Door
unique_id: main_garage_door
device_class: garage_door
state: "{{ states('binary_sensor.garage_tilt_94') }}"
- sensor:
- name: 'Grid Import Power'
unique_id: grid_import_power
icon: mdi:transmission-tower
unit_of_measurement: W
device_class: power
state: "{{ [0, states('sensor.envoy_current_power_consumption') | int(default=0) - states('sensor.envoy_current_power_production') | int(default=0) ] | max }}"
- name: 'Grid Export Power'
unique_id: grid_export_power
icon: mdi:transmission-tower
unit_of_measurement: W
device_class: power
state: "{{ [0, states('sensor.envoy_current_power_production') | int(default=0) - states('sensor.envoy_current_power_consumption') | int(default=0) ] | max }}"
- name: 'Eagle 200 Net Meter Energy Delivered Minus Received'
unique_id: eagle_200_net_meter_energy_delivered_minus_received
unit_of_measurement: kWh
device_class: energy
state: "{{ states('sensor.eagle_200_total_meter_energy_delivered') | float(default=0) - states('sensor.eagle_200_total_meter_energy_received') | float(default=0) }}"
- name: 'Envoy Net Meter Power Demand'
unique_id: envoy_net_meter_power_demand
unit_of_measurement: kW
device_class: power
state: "{{ (states('sensor.envoy_current_power_consumption') | float(default=0) - states('sensor.envoy_current_power_production') | float(default=0) ) / 1000.0 }}"
- name: 'Envoy Net Meter Energy Consumption Minus Production'
unique_id: envoy_net_meter_energy_consumption_minus_Production
unit_of_measurement: kWh
device_class: energy
state: "{{ (states('sensor.envoy_lifetime_energy_consumption') | float(default=0) - states('sensor.envoy_lifetime_energy_production') | float(default=0) ) / 1000.0 }}"
- name: "Current Energy Tariff"
unique_id: current_energy_tariff
icon: mdi:currency-usd
unit_of_measurement: "USD/kWh"
state: >-
{% set tariff = { "offpeak": 0.46052, "peak": 0.49913 } %}
{% set dow = now().strftime('%A') %}
{% if dow == "Saturday" or dow == "Sunday" %}
{{ tariff.offpeak }}
{% else %}
{% if (now().hour >= 17) and (now().hour <= 20) %}
{{ tariff.peak }}
{% else %}
{{ tariff.offpeak }}
{% endif %}
{% endif %}
- name: "South Roof Power"
unique_id: south_roof_power
unit_of_measurement: W
state: >-
{% set p_list = area_entities('South Roof') %}
{{ expand(p_list | select('has_value')) | map(attribute='state') | map('float') | sum }}
- name: "West Roof Power"
unique_id: west_roof_power
unit_of_measurement: W
state: >-
{% set p_list = area_entities('West Roof') %}
{{ expand(p_list | select('has_value')) | map(attribute='state') | map('float') | sum }}
- name: "East Roof Power"
unique_id: east_roof_power
unit_of_measurement: W
state: >-
{% set p_list = area_entities('East Roof') %}
{{ expand(p_list | select('has_value')) | map(attribute='state') | map('float') | sum }}
- name: Audi A6 Distance
unique_id: audi_a6_distance
state: "{{ state_attr('sensor.audi_a6_ibeacon_room_presence', 'distance') }}"
unit_of_measurement: 'm'
- name: Audi Q7 Distance
unique_id: audi_q7_distance
state: "{{ state_attr('sensor.audi_q7_ibeacon_room_presence', 'distance') }}"
unit_of_measurement: 'm'
- name: Toyota Rav4 Distance
unique_id: toyota_rav4_distance
state: "{{ state_attr('sensor.toyota_rav4_ibeacon_room_presence', 'distance') }}"
unit_of_measurement: 'm'
- name: "Pentair Pool Temperature"
unique_id: pentair_pool_temperature
state: "{{ state_attr('climate.pentair_0d_ce_47_pool_heat', 'current_temperature') }}"
unit_of_measurement: "°F"
- name: "Pentair Spa Temperature"
unique_id: pentair_spa_temperature
state: "{{ state_attr('climate.pentair_0d_ce_47_spa_heat', 'current_temperature') }}"
unit_of_measurement: "°F"
- name: "Pentair Heater Set Temperature"
unique_id: pentair_heater_set_temperature
state: "{{ state_attr('climate.pentair_0d_ce_47_pool_heat', 'temperature') }}"
unit_of_measurement: "°F"
- name: "Internet In Mbps"
unique_id: internet_in_mbps
unit_of_measurement: 'Mbps'
state: "{{ [((states('sensor.erx_wan_in_derivative') | float(default=0) * 8) / 1000000) | round(2), 0] | max }}"
icon: mdi:download-network
- name: "Internet Out Mbps"
unique_id: internet_out_mbps
unit_of_measurement: 'Mbps'
state: "{{ [((states('sensor.erx_wan_out_derivative') | float(default=0) * 8) / 1000000) | round(2), 0] | max }}"
icon: mdi:upload-network
- name: "Closet UPS Battery Minutes"
state: "{{ states('sensor.closet_ups_battery_runtime') | multiply(0.0167) | float(default=0) | round(0) }}"
unit_of_measurement: "min"
- name: "Closet UPS Current Power"
device_class: power
unit_of_measurement: "W"
state: "{{ (states('sensor.closet_ups_load') | float(default=0)) * (states('sensor.closet_ups_nominal_real_power') | float(default=0) ) / 100.0 }}"
- name: "Retreat UPS Battery Minutes"
state: "{{ states('sensor.retreat_ups_battery_runtime') | multiply(0.0167) | float(default=0) | round(0) }}"
unit_of_measurement: "min"
- name: "Retreat UPS Current Power"
device_class: power
unit_of_measurement: "W"
state: "{{ (states('sensor.retreat_ups_load') | float(default=0)) * (states('sensor.retreat_ups_nominal_real_power') | float(default=0) ) / 100.0 }}"
- name: Chiller Cycle Length
unique_id: chiller_cycle_length
unit_of_measurement: 'min'
state: "{{ ((states('sensor.chiller_time_on') | int(default=0) * 60) / (states('sensor.chiller_on_count') | int)) | round(0) }}"
# - name: "Chiller Runtime Yesterday"
# unique_id: chiller_runtime_yesterday
# unit_of_measurement: '%'
# state: "{{ ((states('sensor.tasmota5_energy_yesterday') | float) / (0.930 * 24) * 100.0) | round(2) }}"
# - name: 'Guest1 Bath Set Temperature'
# unique_id: guest1_bath_set_temperature
# state: "{{ state_attr('climate.guest_1', 'temperature') }}"
# unit_of_measurement: "°F"
# - name: 'Guest2 Bath Set Temperature'
# unique_id: guest2_bath_set_temperature
# state: "{{ state_attr('climate.guest_2', 'temperature') }}"
# unit_of_measurement: "°F"
# - name: 'Master Bath Set Temperature'
# unique_id: master_bath_set_temperature
# state: "{{ state_attr('climate.master_bath', 'temperature') }}"
# unit_of_measurement: "°F"
- name: 'Downstairs Temperature'
unique_id: downstairs_temperature
state: "{{ state_attr('climate.downstairs', 'current_temperature') }}"
unit_of_measurement: "°F"
- name: 'Upstairs Temperature'
unique_id: upstairs_temperature
state: "{{ state_attr('climate.main_floor', 'current_temperature') }}"
unit_of_measurement: "°F"
# - name: WeeWx Weather Update
# unique_id: weewx_weather_update
# state: "{{ states.sensor.weewx_weather.attributes['time'] }}"
# - name: WeeWx Outside Temperature
# unique_id: weewx_outside_temperature
# unit_of_measurement: '°F'
# state: "{{ states.sensor.weewx_weather.attributes.current['outTemp'] }}"
# - name: WeeWx Outside Dewpoint
# unique_id: weewx_outside_dewpoint
# unit_of_measurement: "°F"
# state: "{{ states.sensor.weewx_weather.attributes.current['dewpoint'] }}"
# - name: WeeWx Barometer
# unique_id: weewx_barometer
# unit_of_measurement: "in"
# state: "{{ states.sensor.weewx_weather.attributes.current['barometer'] }}"
# - name: WeeWx Outside Windchill
# unique_id: weewx_outside_windchill
# unit_of_measurement: "°F"
# state: "{{ states.sensor.weewx_weather.attributes.current['windchill'] }}"
# - name: WeeWx Outside Heat Index
# unique_id: weewx_outside_heat_index
# unit_of_measurement: "°F"
# state: "{{ states.sensor.weewx_weather.attributes.current['heatindex'] }}"
# - name: WeeWx Rain Rate
# unique_id: weewx_rain_rate
# unit_of_measurement: "in/h"
# state: "{{ states.sensor.weewx_weather.attributes.current['rainRate'] }}"
# - name: WeeWx Rain Day
# unique_id: weewx_rain_day
# state: "{{ states.sensor.weewx_weather.attributes.current['rainDaySum'] }}"
# unit_of_measurement: "in"
# - name: WeeWx Rain Year
# unique_id: weewx_rain_year
# unit_of_measurement: "in"
# state: "{{ states.sensor.weewx_weather.attributes.current['rainYearSum'] }}"
# - name: WeeWx Office Temperature
# unique_id: weewx_office_temperature
# unit_of_measurement: '°F'
# state: "{{ states.sensor.weewx_weather.attributes.current['inTemp'] }}"
# - name: 'WeeWx Garage Temperature'
# unique_id: weewx_garage_temperature
# state: "{{ states.sensor.weewx_weather.attributes.current['extraTemp1'] }}"
# unit_of_measurement: "°F"
# - name: 'WeeWx Cellar Temperature'
# unique_id: weewx_cellar_temperature
# state: "{{ states.sensor.weewx_weather.attributes.current['extraTemp2'] }}"
# unit_of_measurement: "°F"
# - name: 'WeeWx Master Temperature'
# unique_id: weewx_master_temperature
# state: "{{ states.sensor.weewx_weather.attributes.current['extraTemp3'] }}"
# unit_of_measurement: "°F"
# - name: 'WeeWx Guest Temperature'
# unique_id: weewx_guest_temperature
# state: "{{ states.sensor.weewx_weather.attributes.current['extraTemp4'] }}"
# unit_of_measurement: "°F"
# - name: 'WeeWx Soil Temperature'
# unique_id: weewx_soil_temperature
# state: "{{ states.sensor.weewx_weather.attributes.current['soilTemp1'] }}"
# unit_of_measurement: "°F"
# - name: 'WeeWx Outside Humidity'
# unique_id: weewx_outside_humidity
# icon: mdi:water-percent
# unit_of_measurement: '%'
# state: "{{ states.sensor.weewx_weather.attributes.current['outHumidity'] }}"
# - name: WeeWx Office Humidity
# unique_id: weewx_office_humidity
# icon: mdi:water-percent
# unit_of_measurement: '%'
# state: "{{ states.sensor.weewx_weather.attributes.current['inHumidity'] }}"
# - name: 'WeeWx Garage Humidity'
# unique_id: weewx_garage_humidity
# icon: mdi:water-percent
# unit_of_measurement: '%'
# state: "{{ states.sensor.weewx_weather.attributes.current['extraHumid1'] }}"
# - name: 'WeeWx Cellar Humidity'
# unique_id: weewx_cellar_humidity
# icon: mdi:water-percent
# unit_of_measurement: '%'
# state: "{{ states.sensor.weewx_weather.attributes.current['extraHumid2'] }}"
# - name: 'WeeWx Master Humidity'
# unique_id: weewx_master_humidity
# icon: mdi:water-percent
# unit_of_measurement: '%'
# state: "{{ states.sensor.weewx_weather.attributes.current['extraHumid3'] }}"
# - name: 'WeeWx Guest Humidity'
# unique_id: weewx_guest_humidity
# icon: mdi:water-percent
# unit_of_measurement: '%'
# state: "{{ states.sensor.weewx_weather.attributes.current['extraHumid4'] }}"
# - name: 'WeeWx Soil Moisture 1'
# unique_id: weewx_soil_moisture_1
# icon: mdi:water-percent
# unit_of_measurement: '%'
# state: "{{ states.sensor.weewx_weather.attributes.current['soilMoist1'] }}"
# - name: 'WeeWx Soil Moisture 2'
# unique_id: weewx_soil_moisture_2
# icon: mdi:water-percent
# unit_of_measurement: '%'
# state: "{{ states.sensor.weewx_weather.attributes.current['soilMoist2'] }}"
# - name: WeeWx Wind Speed
# unique_id: weewx_wind_speed
# icon: mdi:weather-windy
# unit_of_measurement: 'mph'
# state: "{{ states.sensor.weewx_weather.attributes.current['windSpeed'] }}"
# - name: WeeWx Wind Direction Ordinal
# unique_id: weewx_wind_direction_ordinal
# icon: mdi:weather-windy
# state: "{{ states.sensor.weewx_weather.attributes.current['windDirText'] }}"
# - name: WeeWx Cloudbase
# unique_id: weewx_cloudbase
# unit_of_measurement: "ft"
# state: "{{ states.sensor.weewx_weather.attributes.current['cloudbase'] }}"
# - name: WeeWx Solar Altitude
# unique_id: weewx_solar_altitude
# unit_of_measurement: '°'
# state: "{{ states.sensor.weewx_weather.attributes.almanac.sun['altitude'] }}"
# - name: WeeWx Solar Radiation
# unique_id: weewx_solar_radiation
# state: "{{ states.sensor.weewx_weather.attributes.current['solarRadiation'] }}"
# state_class: "measurement"
# unit_of_measurement: "Wpm2"
# - name: 'WeeWx UV Radiation'
# unique_id: weewx_uv_radiation
# state: "{{ states.sensor.weewx_weather.attributes.current['UV'] }}"
# state_class: "measurement"
# unit_of_measurement: "Wpm2"
# - name: 'WeeWx PM25'
# unique_id: weewx_pm25
# state: "{{ states.sensor.weewx_weather.attributes.current['pm2_5'] }}"
# state_class: "measurement"
# unit_of_measurement: "ug/m3"
- name: "Solar Azimuth"
state: "{{ state_attr('sun.sun', 'azimuth') }}"
unit_of_measurement: "°"
- name: "Solar Elevation"
state: "{{ state_attr('sun.sun', 'elevation') }}"
unit_of_measurement: "°"
- name: 'Xfinity WAN Usage GB'
unit_of_measurement: 'GiB'
state: "{{ ( states('sensor.xfinity_wan_usage') | float(default=0) / 1024) | round(2) }}"
- name: "Last Boot Date Time"
unique_id: last_boot_date_time
state: "{{ states.sensor.last_boot.state.split('T')[0] }}"
- name: "Current Date/Time"
unique_id: current_date_time
state: "{{ now().strftime('%a, %b %e') + now().strftime(' %-I:%M %p') }}"
- name: Kitchen Fridge Sensor Age
unique_id: kitchen_fridge_sensor_age
state: "{{ (states.sensor.time.last_changed - states.sensor.xi_kitchen_fridge_97ce_temperature.last_changed).total_seconds() | round(0) }}"
unit_of_measurement: "Seconds"
- name: Beverage Cooler Sensor Age
unique_id: beverage_cooler_sensor_age
state: "{{ (states.sensor.time.last_changed - states.sensor.xi_beverage_cooler_0444_temperature.last_changed).total_seconds() | round(0) }}"
unit_of_measurement: "Seconds"
- name: Downstairs Minifridge Sensor Age
unique_id: downstairs_minifridge_sensor_age
state: "{{ (states.sensor.time.last_changed - states.sensor.xi_downstairs_minifridge_1690_temperature.last_changed).total_seconds() | round(0) }}"
unit_of_measurement: "Seconds"
- name: 'Air Quality Index'
unit_of_measurement: "AQI"
state: >
{% macro calcAQI(Cp, Ih, Il, BPh, BPl) -%}
{{ (((Ih - Il)/(BPh - BPl)) * (Cp - BPl) + Il)|round }}
{%- endmacro %}
{% if (states.sensor.gw1000_pm25_ch1|float(default=0)) > 1000 %}
invalid
{% elif (states.sensor.gw1000_pm25_ch1|float(default=0)) > 350.5 %}
{{ calcAQI((states.sensor.gw1000_pm25_ch1|float(default=0)), 500.0, 401.0, 500.0, 350.5) }}
{% elif (states.sensor.gw1000_pm25_ch1|float(default=0)) > 250.5 %}
{{ calcAQI((sensor.gw1000_pm25_ch1|float(default=0)), 400.0, 301.0, 350.4, 250.5) }}
{% elif (states.sensor.gw1000_pm25_ch1|float(default=0)) > 150.5 %}
{{ calcAQI((states.sensor.gw1000_pm25_ch1|float(default=0)), 300.0, 201.0, 250.4, 150.5) }}
{% elif (states.sensor.gw1000_pm25_ch1|float(default=0)) > 55.5 %}
{{ calcAQI((states.sensor.gw1000_pm25_ch1|float(default=0)), 200.0, 151.0, 150.4, 55.5) }}
{% elif (states.sensor.gw1000_pm25_ch1|float(default=0)) > 35.5 %}
{{ calcAQI((states.sensor.gw1000_pm25_ch1|float(default=0)), 150.0, 101.0, 55.4, 35.5) }}
{% elif (states.sensor.gw1000_pm25_ch1|float(default=0)) > 12.1 %}
{{ calcAQI((states.sensor.gw1000_pm25_ch1|float(default=0)), 100.0, 51.0, 35.4, 12.1) }}
{% elif (states.sensor.gw1000_pm25_ch1|float(default=0)) >= 0.0 %}
{{ calcAQI((states.sensor.gw1000_pm25_ch1|float(default=0)), 50.0, 0.0, 12.0, 0.0) }}
{% else %}
invalid
{% endif %}
- name: "Washer Door Lock"
unique_id: washer_door_lock
state: "{{ state_attr('sensor.washer','door_lock') }}"
# mini_washer_door_lock:
# friendly_name: "Mini Washer Door Lock"
# value_template: "{{ state_attr('sensor.mini_washer','door_lock') }}"
# dishwasher_door_open:
# friendly_name: "Dish Washer Door Lock"
# value_template: "{{ state_attr('sensor.dishwasher','door_open') }}"
- name: "Washer Time Display"
unique_id: washer_time_display
state: >
{% if is_state('sensor.washer_run_state', '-') %}
{% elif is_state('sensor.washer_run_state', 'unavailable') %}
{% elif is_state('sensor.washer_run_state', 'Standby') %}
-:--
{% else %}
{{ state_attr("sensor.washer","remain_time").split(":")[:-1] | join(':') }}
{% endif %}
# mini_washer_time_display:
# friendly_name: "Mini Washer Time Display"
# value_template: >
# {% if is_state('sensor.mini_washer_run_state', '-') %}
# {% elif is_state('sensor.mini_washer_run_state', 'unavailable') %}
# {% elif is_state('sensor.mini_washer_run_state', 'Standby') %}
# -:--
# {% else %}
# {{ state_attr("sensor.mini_washer","remain_time").split(":")[:-1] | join(':') }}
# {% endif %}
- name: "Dryer Time Display"
unique_id: dryer_time_display
state: >
{% if is_state('sensor.dryer_run_state', '-') %}
{% elif is_state('sensor.dryer_run_state', 'unavailable') %}
{% elif is_state('sensor.dryer_run_state', 'Standby') %}
-:--
{% else %}
{{ state_attr("sensor.dryer","remain_time").split(":")[:-1] | join(':') }}
{% endif %}
# dishwasher_time_display:
# friendly_name: "Dish Washer Time Display"
# value_template: >
# {% if is_state('sensor.dishwasher_run_state', '-') %}
# {% elif is_state('sensor.dishwasher_run_state', 'unavailable') %}
# {% elif is_state('sensor.dishwasher_run_state', 'Standby') %}
# -:--
# {% else %}
# {{ state_attr("sensor.dishwasher","remain_time").split(":")[:-1] | join(':') }}
# {% endif %}
- name: "Blank Sensor"
unique_id: blank_sensor
state: ""
- trigger:
- platform: mqtt
topic: "birdnet/event"
- platform: time
at: "00:00:00"
id: reset
sensor:
- unique_id: c893533c-3c06-4ebe-a5bb-da833da0a947
name: BirdNET Intake
state: >
{% if trigger.id == 'reset' %}
{{ now() }}
{% else %}
{{ today_at(trigger.payload_json.Time) }}
{% endif %}
attributes:
bird_events: >
{% if trigger.id == 'reset' %}
{{ [] }}
{% else %}
{% set time = trigger.payload_json.Time %}
{% set name = trigger.payload_json.CommonName %}
{% set confidence = trigger.payload_json.Confidence|round(2) * 100 ~ '%' %}
{% set current = this.attributes.get('bird_events', []) %}
{% set new = dict(time=time, name=name, confidence=confidence) %}
{{ current + [new] }}
{% endif %}