Can't get readings from Capacitive Soil Moisture Sensor

I finally had the time to finish some tests, and here are some answers and updates.

Since I’m close to zero knowledge in Yaml and ESPHome, I looked in the HAcommunity forum - here - and tried to follow the steps there, including copy/pasting whatever codes I found. So, I have no idea why this other component was there. But I took out this part of the code, and took in some other bits I’ve found here.

sensor:
  - platform: adc
    pin: A0
    name: "Soil Moisture Wemos"
    id: moisture1
    accuracy_decimals: 4
    update_interval: 1s
    unit_of_measurement: "%"
    device_class: humidity
    icon: "mdi:water-percent"
    filters:
      - lambda: |-
          float moisture_dry_soil_value= 0.61328;
          float moisture_wet_soil_value =  0.25488;
          if (x >  moisture_dry_soil_value ) {
            return 0;
          } else if (x < moisture_wet_soil_value) {
            return 100;
          } else {
            return (moisture_dry_soil_value - x) / (moisture_dry_soil_value - moisture_wet_soil_value ) * 100.0;
          }

Did some more tests and I’m now getting readings, as a percentage as I wanted!

The only little thing I’m missing is that I loose a socket per minute or so. Not something too problematic…But with the genuine Wemos D1 Mini I just dont loose any socket. Perhaps something about the fact the EzDelivery D1 Mini clones are just lower quality.

Thanks for looking into this!