I seem to be striking out on this one…I have others that appear to be working but this one after the update REFUSES to detect the temperature sensor since updating
Its on a propane scale that I only pull out in winter running the fireplace and uses deep_sleep so its hard to update regularly. Just updated it putting it out this year for dallas_hub changing to one_wire and no temp sensor detected.
ESP8266, Dallas temp sensor powered by the ESP output in order to reduce sleep power consumption. Schematic: ESPHome-Mod-Flame-King-Propane-Scale/Modification Pics/wiring.pptx at 3f123818eb363903e45bf8a8dbd4cad80882dc48 · mmiller7/ESPHome-Mod-Flame-King-Propane-Scale · GitHub
Updated code:
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(3000);
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
bssid: !secret bssid_garage-EWS377AP-local
priority: 2
- ssid: !secret ssid
password: !secret password
priority: 1
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:
- platform: esphome
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
one_wire:
- platform: gpio
pin: D7
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_temp
id: fireplace_propane_temperature
name: "fireplace_propane Temperature"
#internal: true
update_interval: 15s
# 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
# Colderer 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:59:30"
ESP Log:
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from 192.168.3.101 using esphome API
INFO Successfully connected to fireplace_propane @ 192.168.3.101 in 19.376s
INFO Successful handshake with fireplace_propane @ 192.168.3.101 in 0.037s
[20:31:36][I][app:100]: ESPHome version 2024.11.2 compiled on Dec 1 2024, 20:31:03
[20:31:36][C][status_led:019]: Status LED:
[20:31:36][C][status_led:020]: Pin: GPIO14
[20:31:36][C][wifi:600]: WiFi:
[20:31:36][C][wifi:428]: Local MAC: 44:17:93:1E:E9:59
[20:31:36][C][wifi:433]: SSID: [redacted]
[20:31:36][C][wifi:436]: IP Address: 192.168.3.101
[20:31:36][C][wifi:439]: BSSID: [redacted]
[20:31:36][C][wifi:441]: Hostname: 'fireplace_propane'
[20:31:36][C][wifi:443]: Signal strength: -66 dB ▂▄▆█
[20:31:36][C][wifi:447]: Channel: 11
[20:31:36][C][wifi:448]: Subnet: 255.255.255.0
[20:31:36][C][wifi:449]: Gateway: 192.168.3.1
[20:31:36][C][wifi:450]: DNS1: 192.168.3.1
[20:31:36][C][wifi:451]: DNS2: 0.0.0.0
[20:31:36][C][logger:185]: Logger:
[20:31:36][C][logger:186]: Level: DEBUG
[20:31:36][C][logger:188]: Log Baud Rate: 0
[20:31:36][C][logger:189]: Hardware UART: UART0
[20:31:36][C][gpio.one_wire:020]: GPIO 1-wire bus:
[20:31:36][C][gpio.one_wire:021]: Pin: GPIO13
[20:31:36][W][gpio.one_wire:078]: Found no devices!
[20:31:36][C][switch.gpio:068]: GPIO Switch 'Sensor Power'
[20:31:36][C][switch.gpio:090]: Restore Mode: always OFF
[20:31:36][C][switch.gpio:031]: Pin: GPIO12
[20:31:36][C][template.sensor:022]: Template Sensor 'fireplace_propane Weight'
[20:31:36][C][template.sensor:022]: Device Class: 'weight'
[20:31:36][C][template.sensor:022]: State Class: 'measurement'
[20:31:36][C][template.sensor:022]: Unit of Measurement: 'lb'
[20:31:36][C][template.sensor:022]: Accuracy Decimals: 1
[20:31:36][C][template.sensor:022]: Icon: 'mdi:scale'
[20:31:36][C][template.sensor:023]: Update Interval: never
[20:31:36][C][template.switch:068]: Template Switch 'fireplace_propane Deep Sleep Now'
[20:31:36][C][template.switch:070]: Icon: 'mdi:sleep'
[20:31:36][C][template.switch:090]: Restore Mode: always OFF
[20:31:36][C][template.switch:057]: Optimistic: NO
[20:31:36][C][restart:068]: Restart Switch 'fireplace_propane Restart'
[20:31:36][C][restart:070]: Icon: 'mdi:restart'
[20:31:36][C][restart:090]: Restore Mode: always OFF
[20:31:36][C][adc:097]: ADC Sensor 'fireplace_propane Weight Raw'
[20:31:36][C][adc:097]: Device Class: 'weight'
[20:31:36][C][adc:097]: State Class: 'measurement'
[20:31:36][C][adc:097]: Unit of Measurement: 'lb'
[20:31:36][C][adc:097]: Accuracy Decimals: 1
[20:31:36][C][adc:097]: Icon: 'mdi:scale'
[20:31:36][C][adc:102]: Pin: GPIO17
[20:31:36][C][adc:141]: Samples: 1
[20:31:36][C][adc:142]: Update Interval: 15.0s
[20:31:36][C][dallas.temp.sensor:029]: Dallas Temperature Sensor:
[20:31:36][W][dallas.temp.sensor:031]: Unable to select an address
[20:31:36][C][copy.sensor:015]: Copy Sensor 'fireplace_propane Temperature Weight Correction'
[20:31:36][C][copy.sensor:015]: Device Class: 'temperature'
[20:31:36][C][copy.sensor:015]: State Class: 'measurement'
[20:31:36][C][copy.sensor:015]: Unit of Measurement: 'lb'
[20:31:36][C][copy.sensor:015]: Accuracy Decimals: 1
[20:31:36][C][captive_portal:089]: Captive Portal:
[20:31:36][C][mdns:116]: mDNS:
[20:31:36][C][mdns:117]: Hostname: fireplace_propane
[20:31:36][C][esphome.ota:073]: Over-The-Air updates:
[20:31:36][C][esphome.ota:074]: Address: fireplace_propane.apt:8266
[20:31:36][C][esphome.ota:075]: Version: 2
[20:31:36][C][safe_mode:018]: Safe Mode:
[20:31:36][C][safe_mode:019]: Boot considered successful after 60 seconds
[20:31:36][C][safe_mode:021]: Invoke after 10 boot attempts
[20:31:36][C][safe_mode:022]: Remain in safe mode for 300 seconds
[20:31:36][C][api:140]: API Server:
[20:31:36][C][api:141]: Address: fireplace_propane.apt:6053
[20:31:36][C][api:145]: Using noise encryption: NO
[20:31:36][C][deep_sleep:026]: Setting up Deep Sleep...
[20:31:36][C][deep_sleep:029]: Sleep Duration: 3570000 ms
[20:31:36][C][deep_sleep:032]: Run Duration: 300000 ms
[20:31:42][D][sensor:093]: 'fireplace_propane Weight Raw': Sending state 54.88281 lb with 1 decimals of accuracy
[20:31:42][D][sensor:093]: 'fireplace_propane Weight': Sending state nan lb with 1 decimals of accuracy
[20:31:42][D][main:035]: *CALIBRATE Weight ADC: adc_raw=0.802734 / output=54.88 lb
[20:31:43][D][api:103]: Accepted 192.168.3.221
[20:31:43][D][api.connection:1446]: Home Assistant 2024.11.3 (192.168.3.221): Connected successfully
[20:31:57][D][sensor:093]: 'fireplace_propane Weight Raw': Sending state 54.47925 lb with 1 decimals of accuracy
[20:31:57][D][sensor:093]: 'fireplace_propane Weight': Sending state nan lb with 1 decimals of accuracy
[20:31:57][D][main:035]: *CALIBRATE Weight ADC: adc_raw=0.801758 / output=54.48 lb
[20:32:12][D][sensor:093]: 'fireplace_propane Weight Raw': Sending state 54.47925 lb with 1 decimals of accuracy
[20:32:12][D][sensor:093]: 'fireplace_propane Weight': Sending state nan lb with 1 decimals of accuracy
[20:32:12][D][main:035]: *CALIBRATE Weight ADC: adc_raw=0.801758 / output=54.48 lb
[20:32:23][I][safe_mode:041]: Boot seems successful; resetting boot loop counter