Skip to content

Commit

Permalink
Improved cailbration method
Browse files Browse the repository at this point in the history
Improved reporting of sensors
  • Loading branch information
mmiller7 committed Dec 6, 2022
1 parent 893f731 commit 629681a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
17 changes: 9 additions & 8 deletions example ESPHome - fireplace_propane.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ esphome:
# 60mS - seems stable in some tests
# 120mS - allows extra buffer to stabilize
- lambda: |-
delay(120);
delay(150);
on_shutdown:
- priority: 700
Expand Down Expand Up @@ -100,8 +100,8 @@ sensor:
- calibrate_linear:
# Calibration done at 70-71F
# Zero-Weight Calibration:
- 0.671875 -> 0.0
# Large-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
Expand All @@ -126,11 +126,12 @@ sensor:
internal: true
filters:
- calibrate_linear:
# Temp -> Error correction weight delta
# Weight Calibration Temp -> 0
- 22.31 -> 0.0
# Colder/Hotter Temp -> +/- correction
- 1.67 -> 6.5
# 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"
Expand Down
16 changes: 8 additions & 8 deletions example HomeAssistant package - propane_scale_fireplace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ template:
state: >
{% set short_rate = -1 * (states('sensor.fireplace_propane_fuel_burn_rate_change_short_seconds') | float(default="unknown") * 3600) %}
{% set long_rate = -1 * (states('sensor.fireplace_propane_fuel_burn_rate_change_long_seconds') | float(default="unknown") * 3600) %}
{% set worst_rate = [long_rate] | max | round(2,default="unknown") %}
{% set worst_rate = [short_rate,long_rate] | max | round(2,default="unknown") %}
{% if worst_rate < 0 %}{# Burn rate can not be increasing #}
{{ states("sensor.fireplace_propane_fuel_consumption_hourly") }}
{% else %}
Expand All @@ -116,7 +116,7 @@ template:
state: >
{% set short_rate = -1 * (states('sensor.fireplace_propane_fuel_burn_rate_change_short_seconds') | float(default="unknown") * 3600 * 24) %}
{% set long_rate = -1 * (states('sensor.fireplace_propane_fuel_burn_rate_change_long_seconds') | float(default="unknown") * 3600 * 24) %}
{% set worst_rate = [long_rate] | max | round(2,default="unknown") %}
{% set worst_rate = [short_rate,long_rate] | max | round(2,default="unknown") %}
{% if worst_rate < 0 %}{# Burn rate can not be increasing #}
{{ states("sensor.fireplace_propane_fuel_consumption_daily") }}
{% else %}
Expand Down Expand Up @@ -157,7 +157,7 @@ sensor:
precision: 20
sampling_size: 25
max_age:
hours: 6
hours: 3



Expand All @@ -175,8 +175,9 @@ automation:
entity_id: sensor.fireplace_propane_weight
above: 10
action:
service: switch.turn_on
entity_id: switch.fireplace_propane_deep_sleep_now
- delay: "00:00:01"
- service: switch.turn_on
entity_id: switch.fireplace_propane_deep_sleep_now

# Automation to auto-zero scale input_number when empty
- alias: "Auto Zero fireplace_propane empty-scale offset"
Expand Down Expand Up @@ -214,10 +215,9 @@ automation:
above: 10
action:
service: input_select.select_option
target:
entity_id: input_select.fireplace_propane_tank_size
data:
value: >-
entity_id: input_select.fireplace_propane_tank_size
option: >-
{% set weight = states('sensor.fireplace_propane_weight_corrected') | float(default="unknown") %}
{% if weight > 40 %} {# If too high, must be bigger tank #}
40lb Tank
Expand Down

0 comments on commit 629681a

Please sign in to comment.