Created
April 29, 2019 15:19
-
-
Save vigonotion/36f39fc916f8c21817e19ce115c459b2 to your computer and use it in GitHub Desktop.
link to original file: https://github.com/vigonotion/smarthome/blob/master/esphome/water_bottles.yaml
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
esphome: | |
name: water_bottles | |
platform: ESP8266 | |
board: d1_mini | |
wifi: | |
ssid: !secret wifi_ssid | |
password: !secret wifi_password | |
api: | |
ota: | |
logger: | |
sensor: | |
- platform: hx711 | |
name: "water_bottles_weight" | |
id: water_bottles_weight | |
dout_pin: D2 | |
clk_pin: D1 | |
gain: 128 | |
update_interval: 60s | |
filters: | |
- lambda: |- | |
auto first_mass = 0.0; // first known mass was 0kg | |
auto first_value = 25136; // value for the first known mass was | |
auto second_mass = 12840; // second mass was | |
auto second_value = 24568; // second value was | |
auto r = map(x/1000, first_value, second_value, first_mass, second_mass); | |
if (r > 0) return r; | |
return 0; | |
unit_of_measurement: g | |
- platform: template | |
name: "water_bottles_count" | |
lambda: |- | |
return floor(id(water_bottles_weight).state / 1000); | |
update_interval: 60s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment