Any idea why the TX20 anemometer isn't working in ESPHome?

Hi, I migrated my old, working project—which connected a TX-20 anemometer using Tasmota—to ESPHome, but I’m unable to get any results.

esphome:
  name: weatherstation-esp01
  friendly_name: WeatherStation

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: ChTaTi9KzZrQGnLI1nCffW0Ck0AZqrzYgarNgXbSFZo=
ota:
 - platform: esphome
   password: decade-belfry-dace-handbag

wifi:
  ssid: xxx
  password: xxx
  manual_ip:
    static_ip: 192.168.2.217
    gateway: 192.168.2.1
    subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: ‘Weather-Esp01 Fallback Hotspot’
    password: ‘Uo3QlTc3NK9C’
captive_portal:

sensor:
  - platform: tx20
    wind_speed:
      name: Wind speed
    wind_direction_degrees:
      name: Wind direction degrees
    pin:
      number: GPIO2
      mode:
        input: true

The hardware setup is fine, as it worked in Tasmota; the data line is connected to GPIO2, and an oscilloscope confirmed that the expected signal is present. The module is visible on the network, but the measured data is detected as “Unknown”.

Do you have any ideas about what I might have forgotten?

What you get on esphome logs?

INFO ESPHome 2026.7.3
INFO Loaded validated config cache for esp01.yaml, skipping validation.
INFO Starting log output from 192.168.2.217 using esphome API
INFO Successfully resolved weatherstation-esp01 @ 192.168.2.217 in 0.000s
INFO Successfully connected to weatherstation-esp01 @ 192.168.2.217 in 0.075s
INFO Successful handshake with weatherstation-esp01 @ 192.168.2.217 in 2.766s
[13:56:23.171][I][app:151]: ESPHome version 2026.7.3 compiled on 2026-08-21 12:37:30 +0200
[13:56:23.172][C][logger:223]: Logger:
[13:56:23.172][C][logger:223]:   Max Level: DEBUG
[13:56:23.172][C][logger:223]:   Initial Level: DEBUG
[13:56:23.172][C][logger:230]:   Log Baud Rate: 115200
[13:56:23.172][C][logger:230]:   Hardware UART: UART0
[13:56:23.282][C][tx20:026]: Tx20:
[13:56:23.283][C][tx20:017]:   Wind speed: 'Wind speed'
[13:56:23.283][C][tx20:017]:     State Class: 'measurement'
[13:56:23.283][C][tx20:017]:     Unit of Measurement: 'km/h'
[13:56:23.283][C][tx20:017]:     Accuracy Decimals: 1
[13:56:23.283][C][tx20:225]:     Device Class: 'wind_speed'
[13:56:23.283][C][tx20:216]:     Icon: 'mdi:weather-windy'
[13:56:23.283][C][tx20:017]:   Wind direction degrees: 'Wind direction degrees'
[13:56:23.283][C][tx20:017]:     State Class: 'measurement'
[13:56:23.283][C][tx20:017]:     Unit of Measurement: '°'
[13:56:23.283][C][tx20:017]:     Accuracy Decimals: 1
[13:56:23.284][C][tx20:216]:     Icon: 'mdi:sign-direction'
[13:56:23.284][C][tx20:131]:   Pin: GPIO2
[13:56:23.284][C][captive_portal:141]: Captive Portal:
[13:56:23.284][C][wifi:1556]: WiFi:
[13:56:23.284][C][wifi:1556]:   Local MAC: BC:DD:C2:26:14:79
[13:56:23.284][C][wifi:1556]:   Connected: YES
[13:56:23.284][C][wifi:1259]:   IP Address: 192.168.2.217
[13:56:23.284][C][wifi:1270]:   SSID: 'TP-LINK'
[13:56:23.284][C][wifi:1270]:   BSSID: 5C:E9:31:DC:1C:96
[13:56:23.284][C][wifi:1270]:   Hostname: 'weatherstation-esp01'
[13:56:23.284][C][wifi:1270]:   Signal strength: -80 dB ▂▄▆█
[13:56:23.284][C][wifi:1270]:   Channel: 1
[13:56:23.284][C][wifi:1270]:   Subnet: 255.255.255.0
[13:56:23.284][C][wifi:1270]:   Gateway: 192.168.2.1
[13:56:23.284][C][wifi:1270]:   DNS1: 0.0.0.0
[13:56:23.284][C][wifi:1270]:   DNS2: 0.0.0.0
[13:56:23.285][C][esphome.ota:098]: Over-The-Air updates:
[13:56:23.285][C][esphome.ota:098]:   Address: 192.168.2.217:8266
[13:56:23.285][C][esphome.ota:098]:   Version: 2
[13:56:23.335][C][esphome.ota:105]:   Password configured
[13:56:23.335][C][safe_mode:058]: Safe Mode:
[13:56:23.335][C][safe_mode:058]:   Successful after: 60s
[13:56:23.335][C][safe_mode:058]:   Invoke after: 10 attempts
[13:56:23.335][C][safe_mode:058]:   Duration: 300s
[13:56:23.335][C][web_server.ota:256]: Web Server OTA
[13:56:23.335][C][api:269]: Server:
[13:56:23.335][C][api:269]:   Address: 192.168.2.217:6053
[13:56:23.335][C][api:269]:   Listen backlog: 1
[13:56:23.335][C][api:269]:   Max connections: 4
[13:56:23.336][C][api:276]:   Noise encryption: YES
[13:56:23.336][C][mdns:259]: mDNS:
[13:56:23.336][C][mdns:259]:   Hostname: weatherstation-esp01

And after that nothing on logs?

Did you do full power cycle after “migration” ?

Logs after sending firmware to ESP01 via OTA:

INFO ESPHome 2026.7.3
INFO Loaded validated config cache for esp01.yaml, skipping validation.
INFO Starting log output from 192.168.2.217 using esphome API
INFO Successfully resolved weatherstation-esp01 @ 192.168.2.217 in 0.000s

WARNING Can't connect to ESPHome API for weatherstation-esp01 @ 192.168.2.217: Error connecting to [AddrInfo(family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>, proto=6, sockaddr=IPv4Sockaddr(address='192.168.2.217', port=6053))]: [WinError 121] Časový limit semaforu vypršel (SocketAPIError)

INFO Trying to connect to weatherstation-esp01 @ 192.168.2.217 in the background
INFO Successfully connected to weatherstation-esp01 @ 192.168.2.217 in 1.148s
INFO Successful handshake with weatherstation-esp01 @ 192.168.2.217 in 2.638s
[11:00:19.240][I][app:151]: ESPHome version 2026.7.3 compiled on 2026-08-21 12:37:30 +0200
[11:00:19.240][C][logger:223]: Logger:
[11:00:19.240][C][logger:223]:   Max Level: DEBUG
[11:00:19.240][C][logger:223]:   Initial Level: DEBUG
[11:00:19.241][C][logger:230]:   Log Baud Rate: 115200
[11:00:19.241][C][logger:230]:   Hardware UART: UART0
[11:00:19.442][C][tx20:026]: Tx20:
[11:00:19.442][C][tx20:017]:   Wind speed: 'Wind speed'
[11:00:19.442][C][tx20:017]:     State Class: 'measurement'
[11:00:19.442][C][tx20:017]:     Unit of Measurement: 'km/h'
[11:00:19.442][C][tx20:017]:     Accuracy Decimals: 1
[11:00:19.442][C][tx20:225]:     Device Class: 'wind_speed'
[11:00:19.442][C][tx20:216]:     Icon: 'mdi:weather-windy'
[11:00:19.442][C][tx20:017]:   Wind direction degrees: 'Wind direction degrees'
[11:00:19.442][C][tx20:017]:     State Class: 'measurement'
[11:00:19.442][C][tx20:017]:     Unit of Measurement: '°'
[11:00:19.442][C][tx20:017]:     Accuracy Decimals: 1
[11:00:19.443][C][tx20:216]:     Icon: 'mdi:sign-direction'
[11:00:19.443][C][tx20:131]:   Pin: GPIO2
[11:00:19.443][C][captive_portal:141]: Captive Portal:
[11:00:19.443][C][wifi:1556]: WiFi:
[11:00:19.443][C][wifi:1556]:   Local MAC: BC:DD:C2:26:14:79
[11:00:19.443][C][wifi:1556]:   Connected: YES
[11:00:19.444][C][wifi:1259]:   IP Address: 192.168.2.217
[11:00:19.506][C][wifi:1270]:   SSID: 'TP-LINK'
[11:00:19.506][C][wifi:1270]:   BSSID: 5C:E9:31:DC:1C:96
[11:00:19.506][C][wifi:1270]:   Hostname: 'weatherstation-esp01'
[11:00:19.506][C][wifi:1270]:   Signal strength: -79 dB ▂▄▆█
[11:00:19.506][C][wifi:1270]:   Channel: 1
[11:00:19.506][C][wifi:1270]:   Subnet: 255.255.255.0
[11:00:19.506][C][wifi:1270]:   Gateway: 192.168.2.1
[11:00:19.506][C][wifi:1270]:   DNS1: 0.0.0.0
[11:00:19.506][C][wifi:1270]:   DNS2: 0.0.0.0
[11:00:19.506][C][esphome.ota:098]: Over-The-Air updates:
[11:00:19.506][C][esphome.ota:098]:   Address: 192.168.2.217:8266
[11:00:19.506][C][esphome.ota:098]:   Version: 2
[11:00:19.506][C][esphome.ota:105]:   Password configured
[11:00:19.507][C][safe_mode:058]: Safe Mode:
[11:00:19.507][C][safe_mode:058]:   Successful after: 60s
[11:00:19.507][C][safe_mode:058]:   Invoke after: 10 attempts
[11:00:19.507][C][safe_mode:058]:   Duration: 300s
[11:00:19.507][C][web_server.ota:256]: Web Server OTA
[11:00:19.507][C][api:269]: Server:
[11:00:19.507][C][api:269]:   Address: 192.168.2.217:6053
[11:00:19.507][C][api:269]:   Listen backlog: 1
[11:00:19.507][C][api:269]:   Max connections: 4
[11:00:19.507][C][api:276]:   Noise encryption: YES
[11:00:19.507][C][mdns:259]: mDNS:
[11:00:19.507][C][mdns:259]:   Hostname: weatherstation-esp01
[11:01:05.927][I][safe_mode:142]: Boot seems successful; resetting boot loop counter
[11:05:13.498][D][wifi:2480]: Roam scan (-81 dBm, attempt 1/3)
[11:10:13.091][D][wifi:2480]: Roam scan (-81 dBm, attempt 2/3)
[11:15:13.511][D][wifi:2480]: Roam scan (-79 dBm, attempt 3/3)

So at least it’s alive.

?

Are you sure sensor is connected to gpio2 (D4)?

Other observations:
Use some clean pind like gpio4 or 5.
If you have 4MB board, use d1_mini instead of esp01_1m
Set wifi post_connect_roaming: false if you don’t need it