Skip to content

Commit

Permalink
Merge pull request #26 from markusressel/feature/avoid-unnecessary-up…
Browse files Browse the repository at this point in the history
…dates

Auto Tare "Deviance" Sensor
  • Loading branch information
markusressel authored May 17, 2024
2 parents 8c2a0d1 + a9e0ea6 commit 68c7b0e
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 68c7b0e

Please sign in to comment.