Skip to content

Commit

Permalink
Merge pull request #27 from markusressel/feature/publish-initial-raw-…
Browse files Browse the repository at this point in the history
…value

Added raw value diagnostic sensor
  • Loading branch information
markusressel authored May 17, 2024
2 parents 68c7b0e + 1fef485 commit 79bfc5b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions esphome_hx711_smart_scale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ button:
on_press:
- lambda: |-
id(auto_tare_difference) = id(initial_zero) - id(smart_scale_hx711_value_raw).state;
- sensor.template.publish:
id: smart_scale_hx711_value_raw_diagnostic
state: !lambda 'return id(smart_scale_hx711_value_raw).state;'

switch:
## Switch to enable/disable the auto tare feature
Expand Down Expand Up @@ -128,6 +131,16 @@ sensor:
- sensor.template.publish:
id: smart_scale_hx711_value
state: !lambda 'return id(smart_scale_hx711_value_raw).state;'
- if:
condition:
- lambda: |-
auto n = id(smart_scale_hx711_value_raw_diagnostic).state;
auto n_str = to_string(n);
return str_equals_case_insensitive(n_str, "NaN");
then:
- sensor.template.publish:
id: smart_scale_hx711_value_raw_diagnostic
state: !lambda 'return id(smart_scale_hx711_value_raw).state;'
- if:
condition:
and:
Expand All @@ -150,6 +163,10 @@ sensor:
- lambda: |-
id(auto_tare_difference) -= 10;
- platform: template
id: smart_scale_hx711_value_raw_diagnostic
name: "Smart Scale Initial HX711 Raw Value"
entity_category: "diagnostic"

# Mapped value to KG
- platform: template
Expand Down

0 comments on commit 79bfc5b

Please sign in to comment.