Personal log of yet another digital native.
sensor:
# actual input HX711
- platform: hx711
internal: true
id: weight
name: "${friendly_name} Weight"
dout_pin: D3 # DT
clk_pin: D4 # SCK
gain: 128
update_interval: 1s
unit_of_measurement: kg
# raw value of -29528 means sensors are effectively disconnected from hx711
filters:
#- calibrate_linear:
# - 230405 -> 0 # unladen with only 3d printed toppers
# - 132925 -> 4.726 # greys anatomy weight
#
- calibrate_linear:
- 201800 -> 0 # mattress, sheets and summer blanket
- 89100 -> 76.7 # point in time human male
# 95000 = 95kg
# 77500 = 90kg
# 89100 = 85kg
# 91300
- sliding_window_moving_average:
window_size: 10
send_every: 10
#send_first_at: 5
# https://esphome.io/components/sensor/index.html#on-value
on_value:
- if:
condition:
sensor.in_range:
id: weight
above: 10
then:
# https://esphome.io/components/sensor/index.html#lambda-calls
lambda: 'id(occupied).publish_state(true);'
- if:
condition:
sensor.in_range:
id: weight
below: 10
then:
lambda: 'id(occupied).publish_state(false);'
# binary sensor to be modified by hx711
binary_sensor:
- platform: template
id: occupied
name: "Master Bed Occupied"
#device_class: presence