Last active
August 24, 2024 20:43
-
-
Save markusressel/e888544d4404fbed4c841ec83df638bb to your computer and use it in GitHub Desktop.
ESPHome sample configuration for an HX711 powered Smart Scale including Auto-Tare functionality.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Moved to https://github.com/markusressel/ESPHome-Smart-Scale |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm wondering if anyone can help.
I have used this with an ESP8266 board in an outside hedgehog box. It weighs the hogs as they are feeding. Everything works, however the zero reading drifts massively being outside. I have tried a previous auto tare which keeps the reading at 0g throughout the day, but the weight is quite a distance out once the temperatures drop on the night.
Can anyone include some code so that I can use a spare GPIO pin on the board so as the hog enters the box, the scales zero themselves before it reaches the main compartment ?
Current code is:
globals:
type: float
`captive_portal:
sensor:
platform: hx711
id: weight
name: "HX711 Value2"
dout_pin: GPIO14
clk_pin: GPIO12
gain: 128
update_interval: 5s
unit_of_measurement: g
filters:
calibrate_linear:
- 68604 -> 0
- 626959 -> 2030
on_value:
- if:
condition:
- lambda: |-
static float last = 0.0;
float diff = x - last;
last = x;
return x < 50.0 && diff < 1.0 && diff > - 1.0;
then:
- lambda: 'id(constant_weight) = x;'
platform: template
name: Hog Weight2
icon: mdi:scalee
unit_of_measurement: g
accuracy_decimals: 0
lambda: 'return id(weight).state;'
filters:
- lambda: 'return x - id(constant_weight);'
- lambda: 'return x >= 10.0 ? x : 0;'
- delta: 0.5`