Skip to content

Instantly share code, notes, and snippets.

@aver-ua
Created December 7, 2024 09:58
Show Gist options
  • Select an option

  • Save aver-ua/c885f82b2666ad7f3e0ccae6ab1db01f to your computer and use it in GitHub Desktop.

Select an option

Save aver-ua/c885f82b2666ad7f3e0ccae6ab1db01f to your computer and use it in GitHub Desktop.
ESPHome config for ADC water pressure sensor YD6080
esphome:
name: adc-pressure-sensor
friendly_name: adc-pressure-sensor
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: !secret api_encryption_key
reboot_timeout: 0s
ota:
- platform: esphome
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Adc-Test Fallback Hotspot"
password: !secret ap_password
captive_portal:
sensor:
- platform: adc
name: "Pressure"
pin: GPIO35
id: pressure
update_interval: 10s
unit_of_measurement: "PSI"
accuracy_decimals: 2
attenuation: 12db
filters:
- calibrate_linear:
#method: exact #least_squares
datapoints:
- 0.1 -> 0.0
#- 1.0 -> 56.6
# - 0.85 -> 43.5
#- 1.7 -> 75
- 2.4 -> 150
on_raw_value:
- sensor.template.publish:
id: voltage
state: !lambda |-
return x;
- platform: template
name: "Voltage"
unit_of_measurement: "V"
id: voltage
accuracy_decimals: 2
- platform: copy
source_id: pressure
name: "Pressure BAR"
accuracy_decimals: 2
filters:
- lambda: return x*0.0689475729;
unit_of_measurement: "BAR"
# Enable Web server.
web_server:
port: 80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment