ESPHome water level sensor

Hello to all
I try to do the same but i receive always ov on the esp, i have make this


and i use the code in this post to make this one

esphome:
  name: water-level
  platform: ESP32
  board: esp-wrover-kit

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "3819628eb5eee80ad86c901f2838e6ec"



ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO0_IN
  phy_addr: 1
  power_pin: GPIO16

  # Optional manual IP
  manual_ip:
    static_ip: 10.0.0.235
    gateway: 10.0.0.1
    subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails

dallas:
  - pin: GPIO14

sensor:
  - platform: adc
    pin: GPIO39
    name: "water level voltage"
    id: watertank_voltage    
    accuracy_decimals: 3
    update_interval: 1s #the delta filter will ensure it only sends values when something changes. 
    filters:
      - sliding_window_moving_average:
          window_size: 10 #creates a moving average of the last 10 values
          send_every: 1 #sends the moving average at every measurement (but only if it passes the delta filter below)) 
          send_first_at: 1 #after startup immediately start sending the result rather than wait for the first 10 measurements
      - delta : 0.0015 #only send the result if the voltage difference with the last sent result is higher than this
        ## Exposed Voltage Reading
  - platform: template
    name: "Water Level Sensor usable CM" #first X cm are below pump inlet and thus unuseable.
    id: watertank_cm
    icon: 'mdi:water-well'
    unit_of_measurement: 'cm'
    lambda: |-
        return id(watertank_voltage).state;
    update_interval: 1s #the delta filter will ensure it only sends values when something changes. 
    filters:
      - calibrate_linear:
          # Measured value of X volt maps to y cm
          - 0.0 -> 0
          - 2.5 -> 100.0
      - delta : 0.001 #only send the result if the difference with the last sent result is higher than this
  - platform: template
    name: "Water Level Sensor usable %"
    id: watertank_percent
    icon: 'mdi:water-well'
    unit_of_measurement: '%'
    lambda: |-
        return id(watertank_cm).state / 165.0 * 100; 
      #divide by max water level height to get a percentage
    update_interval: 1s #the delta filter will ensure it only sends values when something changes. 
    filters:
      - delta : 0.001 #only send the result if the difference with the last sent result is higher than this
  - platform: template
    name: "Water Level Sensor usable liters"
    id: watertank_liter
    icon: 'mdi:water-well'
    unit_of_measurement: 'l'
    lambda: |-
        return id(watertank_cm).state / 100 * 1 * 1 * 3 * 1000.0;
      #height (meters) times Largeur times Lenght times nombers of tanks times 1000 gives liters.
    update_interval: 1s #the delta filter will ensure it only sends values when something changes. 
    filters:
      - delta : 0.001 #only send the result if the difference with the last sent result is higher than this

  - platform: dht
    pin: GPIO4
    temperature:
      name: "Cabane Temperature"
    humidity:
      name: "Cabane Humidity"
    update_interval: 60s      

  - platform: dallas
    address: 0x843C01B556471B28
    name: "watertank Temperature"

Have you an idea ???
Thanks a lot

1 Like