I’m looking to get a sensor that displays the weight on a platfom only if it remains the same for a period of time. This is the current code that Igot from esphome smart scale:
- platform: template
id: smart_scale_hx711_value
name: "Smart Scale HX711 Value"
internal: False
filters:
# apply auto_tare difference
- lambda: 'return x + id(auto_tare_difference);'
# apply rough calibration
- calibrate_linear:
# retrieve these values by evaluating the raw values with loads of known mass.
# note that a bigger difference between measurements usually results in higher resolution,
# so measure 0 Kg and the highest known mass you have (like f.ex. your own weight, measured by a normal scale with good accuracy)
- 13120 -> 0
- 31100 -> 8
# map values below 0.1 to 0 (to decrease value changes due to random fluctuation)
- lambda: |-
if (x <= 0.1) {
return 0.0;
} else {
return x;
}
unit_of_measurement: kg
accuracy_decimals: 2
# the sensor will automatically update through the 'sensor.template.publish' call
update_interval: never
I would like to have a separate sensor that only displays the value of “Smart Scale HX711 Value” if it has a stable weight that remains unchanged for 3 seconds. I have tried quite a few different ways and haven’t had any success.