Custom component (A02YYUW) ESP Home

what is the Rx/Tx since the code is only mapping rx??

can you send me the entire code please?

im struggling here

tx is not used.

the entire code for the A02YYUW connected to a D1 mini for measuring distance in meters, would be something like this:

esphome:
  name: "water-level"
  friendly_name: water level
  platform: ESP8266
  board: d1_mini

logger:

api:

ota:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  ap:

web_server:

captive_portal:

uart:
    rx_pin: D4
    baud_rate: 9600

sensor:
  - platform: a02yyuw
    id: a02yyuw_sensor
    name: "Water level"
    unit_of_measurement: 'm'
    accuracy_decimals: 1
    filters:
      - multiply: 0.001
      - throttle: 5s
      - heartbeat: 5s
      - quantile:
         window_size: 7
         send_every: 4
         send_first_at: 3
         quantile: .9
      - debounce: 0.1s

switch:
  - platform: restart
    name: "Restart"

EDIT:
I just (re)installed the sensor and the D1 mini with the provided code and it works for me.


Do you know if this only works with D1 mini?

Im trying to do this with 8266 and already tried a lot of code but nothing seems to work.

another question.

your sensor model is PWM or UART?

this sensor works with any esp board, you just need to specify in your yaml file wich board and pin you’re using.
this code is for the UART version.

thanks, sadly my version is the PWM one, maybe this is the reason im struggling here hahaha

Hi there, I have used the code you supplied and i can see the sensor and get the initial distance value but it does not change the value.

any help would be greatly appreciated :slight_smile:

the measurement doesn’t update very fast (every 4-5 seconds or so), you need to wait a moment when pointing at something.
also you need to point at a larger object or wall for testing, a hand won’t be enough.
did you connect it properly?
what esp board are you using?

Thank you for your quick response. Using a Wemos D1
Connections are correct but they never seem to update.
Have been messing around with this for 3 days, looks like i will find alternative route to measuring the tank

If you have wired the sensor to the D1 mini like I did in the photo I’ve posted here, and you’re using my code, it should work.
Do you have the uart or the pwm version?
If you have the uart version, try another pin on the D1 maybe, or another esp board.