Skip to content

Commit

Permalink
add Auto Tare Deviance sensor, avoid adjusting auto_tare_difference i…
Browse files Browse the repository at this point in the history
…f current deviance is small
  • Loading branch information
markusressel committed May 17, 2024
1 parent 8c2a0d1 commit a9e0ea6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion esphome_hx711_smart_scale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ sensor:
lambda: |-
return id(auto_tare_difference);
update_interval: 1s

- platform: template
id: smart_scale_auto_tare_deviance
entity_category: "diagnostic"
name: "Smart Scale Auto Tare Deviance"
lambda: |-
return (int((id(smart_scale_hx711_value_raw).state - (id(initial_zero) - id(auto_tare_difference)) ) / 100)) * 100;
update_interval: 1s

# sensors imported from home assistant
- platform: homeassistant
Expand Down Expand Up @@ -126,6 +134,8 @@ sensor:
- lambda: 'return id(auto_tare_enabled);'
# current smart scale value is below approx. 10KG (raw value -275743) aka nobody is standing on the scale
- lambda: 'return id(smart_scale_hx711_value).state < 10.0;'
# only update if the current deviance is not 0
- lambda: 'return id(smart_scale_auto_tare_deviance).state != 0.0;'
then:
- if:
condition:
Expand All @@ -140,7 +150,7 @@ sensor:
- lambda: |-
id(auto_tare_difference) -= 10;
# Mapped value to KG
- platform: template
id: smart_scale_hx711_value
Expand Down

0 comments on commit a9e0ea6

Please sign in to comment.