Created
August 8, 2022 13:31
-
-
Save peyanski/902953d31a1419dc3579671396c20a57 to your computer and use it in GitHub Desktop.
This file contains hidden or 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: phsensor | |
platform: ESP8266 | |
board: d1_mini | |
wifi: | |
ssid: "YOUR_WIFI_NAME" | |
password: "YOUR_WIFI_PASS" | |
# Enable fallback hotspot (captive portal) in case wifi connection fails | |
ap: | |
ssid: "xxx" | |
password: "xxxxxxxxx" | |
captive_portal: | |
# Enable logging | |
logger: | |
# Enable Home Assistant API | |
api: | |
# Example configuration entry | |
web_server: | |
port: 80 | |
ota: | |
sensor: | |
# https://esphome.io/components/sensor/adc.html | |
- platform: adc | |
pin: A0 | |
id: ph | |
name: "pH Sensor" | |
update_interval: 1s | |
unit_of_measurement: pH | |
# https://esphome.io/components/sensor/index.html#sensor-filters | |
filters: | |
- median: | |
window_size: 7 | |
send_every: 4 | |
send_first_at: 3 | |
# Measured voltage -> Actual pH (buffer solution) | |
- calibrate_linear: | |
- 0.59 -> 7.0 | |
- 0.71 -> 4.0 | |
i2c: | |
sda: D2 | |
scl: D1 | |
scan: true | |
display: | |
- platform: lcd_pcf8574 | |
dimensions: 16x2 | |
address: 0x27 | |
lambda: |- | |
it.printf(0, 0, "pH: %.2f", id(ph).state); | |
if (id(ph).state < 4) { | |
it.print(0, 1, "Very acidic"); | |
} | |
else if (id(ph).state >= 4 && id(ph).state < 5) { | |
it.print(0, 1, "Acidic"); | |
} | |
else if (id(ph).state >= 5 && id(ph).state < 7) { | |
it.print(0, 1, "Acidic-ish"); | |
} | |
else if (id(ph).state >= 7 && id(ph).state < 8) { | |
it.print(0, 1, "Neutral"); | |
} | |
else if (id(ph).state >= 8 && id(ph).state < 10) { | |
it.print(0, 1, "Alkaline-ish"); | |
} | |
else if (id(ph).state >= 10 && id(ph).state < 11) { | |
it.print(0, 1, "Alkaline"); | |
} | |
else if (id(ph).state >= 11) { | |
it.print(0, 1, "Very alkaline"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you