Files
projects/ESPhome/bed-scale/bed_scale.yaml
T

82 lines
1.6 KiB
YAML

esphome:
name: bedscale
esp8266:
board: d1_mini
# Enable logging
logger:
level: DEBUG
# Enable Home Assistant API
api:
password: ""
ota:
password: ""
platform: esphome
wifi:
ssid: "ItHurtsWhenIP"
password: "BKl@3660"
manual_ip:
# Set this to the IP of the ESP
static_ip: 10.1.0.24
# Set this to the IP address of the router. Often ends with .1
gateway: 10.1.0.1
# The subnet of the network. 255.255.255.0 works for most home networks.
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Bed-Scale Fallback Hotspot"
password: "bINLLate9rIA"
captive_portal:
# sensor:
# - platform: hx711
# name: "HX711 Value"
# dout_pin: D4
# clk_pin: D3
# gain: 128
# update_interval: 3s
globals:
- id: constant_weight
type: float
sensor:
- platform: hx711
id: bed
internal: true
dout_pin: D4
clk_pin: D3
update_interval: 3s
gain: 128
filters:
- calibrate_linear:
- 2290200 -> 0
- 2856500 -> 50
on_value:
- if:
condition:
- lambda: |-
static float last = 0.0;
float diff = x - last;
last = x;
return x < 10.0 && diff < 1.0 && diff > - 1.0;
then:
- lambda: "id(constant_weight) = x;"
- platform: template
name: Bedscale
icon: mdi:weight-kilogram
update_interval: 3s
unit_of_measurement: kg
lambda: "return id(bed).state;"
filters:
- lambda: "return x - id(constant_weight);"
- lambda: "return x >= 10.0 ? x : 0;"
- delta: 0.5