-
Notifications
You must be signed in to change notification settings - Fork 0
/
example ESPHome - fireplace_propane.yaml
166 lines (138 loc) · 4.53 KB
/
example ESPHome - fireplace_propane.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
esphome:
name: fireplace_propane
platform: ESP8266
board: d1_mini
on_boot:
# priorities: https://esphome.io/api/namespaceesphome_1_1setup__priority.html#ae948d01216eb5ed6e959b44982109f5d
- priority: 700
then:
# Turn on the pin which powers the sensors
- switch.turn_on: sensor_power
# Wait for the power bus to stabilize
# NOTE: This is especially critical for
# the Dallas Hub to properly detect sensors.
# 50mS - too short - not detecting
# 60mS - seems stable in some tests
# 120mS - allows extra buffer to stabilize
- lambda: |-
delay(150);
on_shutdown:
- priority: 700
then:
# Turn off the pin which powers the sensors
- switch.turn_off: sensor_power
wifi:
networks:
- ssid: !secret ssid
password: !secret password
domain: !secret dns_suffix
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "fireplace_propane setup"
captive_portal:
# Enable logging
logger:
baud_rate: 0
# Enable Home Assistant API
api:
ota:
switch:
# Power switch to load cell and temperature sensor circuitry
- platform: gpio
pin: D6
id: sensor_power
name: "Sensor Power"
internal: true
# Allow forced-reboot from HomeAssistant
- platform: restart
name: "fireplace_propane Restart"
# Allow immediate-sleep from HomeAssistant
# This will allow for more complex decisions
# and longer delay to ensure sensor updates
- platform: template
name: "fireplace_propane Deep Sleep Now"
icon: "mdi:sleep"
turn_on_action:
- deep_sleep.enter: do_sleep
# To use your dallas sensor, first define a dallas “hub” with a pin
# This is where the data-pin of the DS18B20 temp-sensor is connected
dallas:
- pin: D7
update_interval: 15s
sensor:
# Load cell amp analog signal in scale
- platform: adc
pin: A0
name: "fireplace_propane Weight Raw"
id: fireplace_propane_weight_raw
unit_of_measurement: "lb"
icon: "mdi:scale"
device_class: "weight"
state_class: "measurement"
accuracy_decimals: 1
update_interval: 15s
force_update: true
#internal: true
filters:
- calibrate_linear:
# Calibration done at 70-71F
# Zero-Weight Calibration:
- 0.669922 -> 0.0
# Large-Weight Calibration:
- 0.834961 -> 68.2
on_value:
# Update the component that computes the temperature-compensated weight every time we get a new weight
- component.update: fireplace_propane_weight
- logger.log:
format: "*CALIBRATE Weight ADC: adc_raw=%.6f / output=%.2f lb"
args: [ 'id(fireplace_propane_weight_raw).raw_state', 'id(fireplace_propane_weight_raw).state' ]
# Temperature sensor
- platform: dallas
index: 0
id: fireplace_propane_temperature
name: "fireplace_propane Temperature"
#internal: true
# Adjustment to compute weight correction based on current temperature
- platform: copy
source_id: fireplace_propane_temperature
name: "fireplace_propane Temperature Weight Correction"
id: fireplace_propane_temperature_weight_correction
unit_of_measurement: "lb"
internal: true
filters:
- calibrate_linear:
# Temp -> Error correction weight delta
# Weight Calibration Temp -> 0
- 21.9 -> 0.0
# Colder/Hotter Temp -> +/- correction computed using known weight
#- -1.61 -> 6.7
- 3.3 -> 7.7
on_value:
- logger.log:
format: "*CALIBRATE Temp LB-Correction: temp_raw=%.2f / output=%.2f lb"
args: [ 'id(fireplace_propane_temperature_weight_correction).raw_state', 'id(fireplace_propane_temperature_weight_correction).state' ]
# Final output sensor to return the temperature-compensated weight
- platform: template
name: "fireplace_propane Weight"
id: fireplace_propane_weight
unit_of_measurement: "lb"
icon: "mdi:scale"
device_class: "weight"
state_class: "measurement"
accuracy_decimals: 1
# This is manually updated by the adc sensor on value change
update_interval: never
force_update: true
lambda: |-
return id(fireplace_propane_weight_raw).state + id(fireplace_propane_temperature_weight_correction).state;
status_led:
pin:
number: D5
inverted: true
# Deep sleep to save battery power
# Default to longer wake interval in case of
# connection issues and easier OTA update
deep_sleep:
id: do_sleep
run_duration: "00:05:00"
sleep_duration: "00:30:00"