EspHome Anemometer reading from UART

I have an ESP-32 Wi-Fi Module - Lolin32 and a Benetech GM8904 UART Anemometer
Full version of the instructions for the anemometer here.
I connect 4 wires from the anemometer to the controller.


I connect black wire to GND, green RX to GPIO3, white TX to GPIO1, red power to 5V

изображение изображение изображение

изображение изображение

Code Yaml in EspHome

  name: anemometr
  platform: ESP32
  board: lolin32
    - windsonic.h


  ssid: ****
  password: *********

    ssid: "${device_name}"
    password: "*******"


  baud_rate: 0
  # hardware_uart: UART1
  password: !secret wifi_api
  reboot_timeout: 0s
  password: !secret wifi_ota  

  id: wind
  tx_pin: GPIO1
  rx_pin: GPIO3
  baud_rate: 19200


  - platform: custom 
    lambda: |-
      auto my_windsonic = new Windsonic(id(wind));
      return {my_windsonic->winddirection_sensor, my_windsonic->windspeed_sensor};

    - name: "Wind direction"
      unit_of_measurement: "gr"
      # accuracy_decimals: 3
      icon: mdi:compass-rose
    - name: "Wind speed"
      unit_of_measurement: "ms"
      accuracy_decimals: 3
      icon: mdi:weather-windy

Code in file windsonic.h (in directory \config\esphome)

#include "esphome.h"
#include "sensor.h"

class Windsonic : public PollingComponent, public UARTDevice {
  Windsonic(UARTComponent *parent) : PollingComponent(1000), UARTDevice(parent) {}
  Sensor *winddirection_sensor = new Sensor();
  Sensor *windspeed_sensor = new Sensor();
  void setup() override {
    // nothing to do here
  void update() override {
    // Use Arduino API to read data, for example  
  String line = readStringUntil('\n');
  String r = line.substring(7, 10);
  String s = line.substring(13, 19);
  float winddirection = r.toFloat();
  float windspeed = s.toFloat();
  winddirection = 0;
  windspeed = 0;
  r = "";
  s = "";

My logs:

INFO Reading configuration /config/esphome/Anemometr.yaml...
INFO Starting log output from anemometr.local using esphome API
INFO Connecting to anemometr.local:6053 (
INFO Successfully connected to anemometr.local
[11:21:38][I][app:105]: ESPHome version 1.16.2 compiled on Apr 29 2021, 10:56:18
[11:21:38][C][wifi:443]: WiFi:
[11:21:38][C][wifi:303]:   SSID: 

[11:21:38][C][wifi:304]:   IP Address:
[11:21:38][C][wifi:306]:   BSSID: 

[11:21:38][C][wifi:307]:   Hostname: 'anemometr'
[11:21:38][C][wifi:311]:   Signal strength: -63 dB ▂▄▆█
[11:21:38][C][wifi:315]:   Channel: 11
[11:21:38][C][wifi:316]:   Subnet:
[11:21:38][C][wifi:317]:   Gateway:
[11:21:38][C][wifi:318]:   DNS1:
[11:21:38][C][wifi:319]:   DNS2:
[11:21:39][E][uart_esp32:147]: Reading from UART timed out at byte 0!
[11:21:39][D][sensor:092]: 'Wind direction': Sending state 0.00000 gr with 0 decimals of accuracy
[11:21:39][D][sensor:092]: 'Wind speed': Sending state 0.00000 ms with 3 decimals of accuracy
[11:21:39][C][uart_esp32:088]: UART Bus:
[11:21:39][C][uart_esp32:090]:   TX Pin: GPIO1
[11:21:39][C][uart_esp32:093]:   RX Pin: GPIO3
[11:21:39][C][uart_esp32:094]:   RX Buffer Size: 256
[11:21:39][C][uart_esp32:096]:   Baud Rate: 19200 baud
[11:21:39][C][uart_esp32:097]:   Data Bits: 8
[11:21:39][C][uart_esp32:098]:   Parity: NONE
[11:21:39][C][uart_esp32:099]:   Stop bits: 1

What’s wrong?
Why isn’t data coming from the UART?

A very similar situation was described in this post. And the solution at the end was to use UART1.
I’ve read all about it, tried everything.
Added uart1 to the yaml logger code
Changed GPIO 1.3 to 16.17 …
I found information that for UART1 you need to use GPIO10 and GPIO11, but I could not find where they are on the ESP board.
Maybe you need to use a resistor?

I am still too inexperienced in this, please help.

You have got rx and tx back to front. One device’s receiver is the other device’s transmitter.