forked from aneisch/home-assistant-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sensors.yaml
301 lines (262 loc) · 9.34 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
- platform: moon
#- platform: arlo
- platform: aarlo
monitored_conditions:
- last_capture
- total_cameras
- battery_level
- captured_today
- signal_strength
#Tell me when to change a thing
- platform: date_reminder
name: AC Filter Change
start_date_input: input_datetime.ac_filter_change
days_in_future: 100
- platform: date_reminder
name: Brita Filter Change
start_date_input: input_datetime.brita_change
days_in_future: 90
- platform: date_reminder
name: Andrew Vehicle Registration
start_date_input: input_datetime.andrew_vehicle_registration
days_in_future: 360
- platform: darksky
scan_interval:
minutes: 30
api_key: !secret darksky_api_key
monitored_conditions:
- summary
- temperature
- apparent_temperature
- humidity
- pressure
- precip_probability
- precip_intensity
- wind_speed
- wind_bearing
- icon
- platform: systemmonitor
scan_interval:
seconds: 60
resources:
- type: disk_use_percent
arg: /home
- type: disk_use_percent
arg: /
- type: memory_use_percent
- type: network_in
arg: eno1
- type: network_out
arg: eno1
- type: last_boot
- type: processor_use
- type: load_1m
- type: load_5m
- type: load_15m
- platform: mqtt
state_topic: "owntracks/owntracks/andrewworkphone"
name: "Andrew Phone Battery"
unit_of_measurement: "%"
value_template: "{{ value_json.batt }}"
####################
# BEGIN SONOFF POW #
####################
- platform: mqtt
name: Sonoff Pow Yesterday Energy
unit_of_measurement: "kWh"
state_topic: "tele/sonoff_pow_1/ENERGY"
value_template: "{{ value_json.Yesterday }}"
- platform: mqtt
name: Sonoff Pow Today Energy
unit_of_measurement: "kWh"
state_topic: "tele/sonoff_pow_1/ENERGY"
value_template: "{{ value_json.Today }}"
- platform: mqtt
name: Sonoff Pow Current
unit_of_measurement: "Amps"
state_topic: "tele/sonoff_pow_1/ENERGY"
value_template: "{{ value_json.Current }}"
- platform: mqtt
name: Sonoff Pow Power
unit_of_measurement: "Watts"
state_topic: "tele/sonoff_pow_1/ENERGY"
value_template: "{{ value_json.Power }}"
###################
# MQTT THERMOSTAT #
###################
- platform: mqtt
state_topic: "sensor/thermostat"
name: "Thermostat Temperature"
unit_of_measurement: "°F"
value_template: "{{ value_json.temp }}"
- platform: mqtt
state_topic: "sensor/thermostat"
name: "Thermostat Operating Mode"
value_template: "{% if value_json.tmode == 0 %}Off{% elif value_json.tmode == 1 %}Heat{% elif value_json.tmode == 2 %}Cool{% elif value_json.tmode == 3 %}Auto{% endif %}"
- platform: mqtt
state_topic: "sensor/thermostat"
name: "Thermostat Fan Mode"
value_template: "{% if value_json.fmode == 0 %}Auto{% elif value_json.fmode == 1 %}Auto/Circulate{% elif value_json.fmode == 2 %}On{% endif %}"
- platform: mqtt
state_topic: "sensor/thermostat"
name: "Thermostat State"
value_template: "{% if value_json.tstate == 0 %}Idle{% elif value_json.tstate == 1 %}Heating{% elif value_json.tstate == 2 %}Cooling{% endif %}"
- platform: mqtt
state_topic: "sensor/thermostat"
unit_of_measurement: "°F"
name: "Thermostat Setpoint"
value_template: "{{ value_json.setpoint }}"
- platform: mqtt
state_topic: "sensor/thermostat"
name: "Thermostat Fan Status"
value_template: "{% if value_json.fstate == 0 %}Off{% elif value_json.fstate == 1 %}On{% endif %}"
- platform: mqtt
state_topic: "sensor/thermostat"
name: "Thermostat Hold"
value_template: "{% if value_json.hold == 1 %}True{% else %}False{% endif %}"
- platform: history_stats
name: ac_runtime_today_cool
entity_id: sensor.thermostat_state
state: 'Cooling'
type: time
start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
end: '{{ now() }}'
- platform: history_stats
name: ac_runtime_today_heat
entity_id: sensor.thermostat_state
state: 'Heating'
type: time
start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
end: '{{ now() }}'
- platform: history_stats
name: ac_runtime_yesterday_cool
entity_id: sensor.thermostat_state
state: 'Cooling'
type: time
end: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
duration:
hours: 24
- platform: history_stats
name: ac_runtime_yesterday_heat
entity_id: sensor.thermostat_state
state: 'Heating'
type: time
end: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
duration:
hours: 24
- platform: seventeentrack
username: !secret 17track_user
password: !secret 17track_pass
- platform: command_line
name: CPU Temperature
command: "echo $(($(cat /sys/class/thermal/thermal_zone0/temp)/1000))"
unit_of_measurement: "°F"
value_template: "{{ ((value | int) * 9 / 5) + 32 | round(1) }}"
#############
# TEMPLATES #
#############
- platform: template
sensors:
kitchen_timer_countdown:
value_template: ""
icon_template: "mdi-timer"
kitchen_all_timers:
friendly_name: "All Kitchen Timers"
value_template: "{{ state_attr('sensor.kitchen_next_timer','sorted_active') | from_json | length }}"
attribute_templates:
timers_ending: >-
{% set ns = namespace(timers=[]) %}
{% for i in (state_attr('sensor.kitchen_next_timer','sorted_active') | from_json) -%}
{% set last_update = as_timestamp(states.sensor.kitchen_next_timer.last_updated) -%}
{% set remain = i[1]['remainingTime']/1000 -%}
{% set end_epoch = remain + last_update -%}
{% set end_time = end_epoch | timestamp_custom('%Y-%m-%dT%H:%M:%S', True) -%}
{% set ns.timers = ns.timers + [end_time] %}
{% endfor %}
{{ ns.timers }}
solar_angle:
friendly_name: "Sun Angle"
unit_of_measurement: '°'
value_template: "{{ '%+.1f'|format(state_attr('sun.sun', 'elevation')) }}"
ac_runtime_today:
friendly_name: "AC Runtime Today"
unit_of_measurement: 'h'
value_template: "{{ (states.sensor.ac_runtime_today_cool.state | float + states.sensor.ac_runtime_today_heat.state | float) }}"
attribute_templates:
value: "{{ (60 * (states.sensor.ac_runtime_today_cool.state | float + states.sensor.ac_runtime_today_heat.state | float)) | int }}m"
ac_runtime_yesterday:
friendly_name: "AC Runtime Today"
unit_of_measurement: 'h'
value_template: "{{ (states.sensor.ac_runtime_yesterday_cool.state | float + states.sensor.ac_runtime_yesterday_heat.state | float) }}"
attribute_templates:
value: "{{ (60 * (states.sensor.ac_runtime_yesterday_cool.state | float + states.sensor.ac_runtime_yesterday_heat.state | float)) | int }}m"
netatmo_home_rain_sum_rain_today_inches:
friendly_name: Rainfall Today
unit_of_measurement: in
value_template: "{{ '%.2f'%((states.sensor.netatmo_home_home_rain_sum_rain_24.state | float) / 25.4) }}"
icon_template: >-
{% set amount = (states.sensor.netatmo_home_rain_sum_rain_today_inches.state | float) %}
{% if amount >= 0.50 %}
mdi:weather-pouring
{% elif amount > 0.00 and amount < 0.50 %}
mdi:weather-rainy
{% else %}
mdi:cloud-outline
{% endif %}
netatmo_home_rain_sum_rain_last_hour_inches:
friendly_name: Rainfall Last 1 Hour
unit_of_measurement: in
value_template: "{{ '%.2f'%((states.sensor.netatmo_home_home_rain_sum_rain_1.state | float) / 25.4) }}"
icon_template: >-
{% set amount = (states.sensor.netatmo_home_rain_sum_rain_last_hour_inches.state | float) %}
{% if amount >= 0.50 %}
mdi:weather-pouring
{% elif amount > 0.00 and amount < 0.50 %}
mdi:weather-rainy
{% else %}
mdi:cloud-outline
{% endif %}
sonoff_pow_today_cost:
friendly_name: Sonoff Pow Today Cost
unit_of_measurement: "$"
value_template: >-
{{ states.sensor.sonoff_pow_today_energy.state | multiply(0.1123) | round(2) }}
sonoff_pow_yesterday_cost:
friendly_name: Sonoff Pow Yesterday Cost
unit_of_measurement: "$"
value_template: >-
{{ states.sensor.sonoff_pow_yesterday_energy.state | multiply(0.1123) | round(2) }}
mail_deliveries_message:
friendly_name: "Deliveries Summary"
entity_id:
- sensor.mail_usps_mail
- sensor.packages_in_transit
value_template: >
{# Deliveries Sentence #}
{% macro deliveries_sentence() -%}
{%- if states("sensor.mail_usps_mail")|int == 0 -%}
No
{%- else -%}
{{states("sensor.mail_usps_mail")|int}}
{%- endif -%}
{{' '}}
{%- if states("sensor.mail_usps_mail")|int <= 1 -%}
mail
{%- else -%}
pieces of mail
{%- endif -%}
{{' '}}will be delivered.{{' '}}
{%- if states("sensor.mail_packages_in_transit")|int == 0 -%}
No
{%- else -%}
{{states("sensor.mail_packages_in_transit")|int}}
{%- endif -%}
{{' '}}
{%- if states("sensor.mail_packages_in_transit")|int == 1 -%}
package is
{%- else -%}
packages are
{%- endif -%}
{{' '}}in transit.{{' '}}
{%- endmacro %}
{{deliveries_sentence()}}