ESP32 node is online, but won't communicate

First time poster, so let me know if I’m missing any information here.

I’m using ESPHome to connect to some flashed MI Thermometers (from this project GitHub - atc1441/ATC_MiThermometer: Custom firmware for the Xiaomi Thermometer LYWSD03MMC and Telink Flash)

Everything was working great for a few weeks, but then the ESP nodes stopped sending information. I did some troubleshooting and I’m confused because some tests work great and others fail. This is what I found:

  1. If I reflash an ESP node via cable and view the logs as its happening, I can see the node successfully communicate with the thermometers and also successfully connect to my Wifi network.
  2. The ESP nodes appear on my router dashboard, and the dashboard shows them sending/receiving data.
  3. I have set the IP address within the YAML and also set the same static IP within my router.
  4. Within ESPHome dashboard, all 3 of my nodes say “online” with the green icon.
  5. Within the ESPHome dashboard, if I try to install or view logs wirelessly it says “ERROR connecting to [ip address] failed: timed out”.
  6. If I try to ping a node from my computer, I get “Request timed out”.

Below I’ll paste the YAML code I’m using, and some logs. Would love any advice because I’m stumped at the moment! Thanks,

YAML code for one of my nodes

esphome:
  name: node3-esp32
  platform: ESP32
  board: esp32dev

# Enable logging
logger:

# Enable Home Assistant API
api:
  port: '6053'

ota:
  password: "redacted"

wifi:
  ssid: "MySSID"
  password: "redacted"
  manual_ip:
    # Set this to the IP of the ESP
    static_ip: 10.0.20.73
    # Set this to the IP address of the router. Often ends with .1
    gateway: 10.0.0.1
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Node3-Esp32 Fallback Hotspot"
    password: "redacted"

captive_portal:

esp32_ble_tracker:

sensor:
  - platform: atc_mithermometer
    mac_address: "A4:C1:38:EA:DB:88"
    temperature:
      name: "Sensor 5 - Temperature"
    humidity:
      name: "Sensor 5 - Humidity"
    battery_level:
      name: "Sensor 5 - Battery-Level"

Here are the logs from when I flash this node via cable. Everything looks good to me, unless I’m missing something?

INFO Reading configuration /config/esphome/node3-esp32.yaml...
INFO Generating C++ source...
INFO Compiling app...
INFO Running:  platformio run -d /config/esphome/node3-esp32
Processing node3-esp32 (board: esp32dev; framework: arduino; platform: platformio/[email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
PACKAGES: 
 - framework-arduinoespressif32 3.10006.210326 (1.0.6) 
 - tool-esptoolpy 1.30000.201119 (3.0.0) 
 - toolchain-xtensa32 2.50200.97 (5.2.0)
Library Manager: Installing Hash
Library Manager: Already installed, built-in library
Dependency Graph
|-- <AsyncTCP-esphome> 1.2.2
|-- <FS> 1.0
|-- <ESPAsyncWebServer-esphome> 1.2.7
|   |-- <AsyncTCP-esphome> 1.2.2
|   |-- <FS> 1.0
|   |-- <WiFi> 1.0
|-- <ESPmDNS> 1.0
|   |-- <WiFi> 1.0
|-- <DNSServer> 1.1.0
|   |-- <WiFi> 1.0
|-- <Update> 1.0
|-- <WiFi> 1.0
Retrieving maximum program size /data/node3-esp32/.pioenvs/node3-esp32/firmware.elf
Checking size /data/node3-esp32/.pioenvs/node3-esp32/firmware.elf
RAM:   [==        ]  16.4% (used 53892 bytes from 327680 bytes)
Flash: [========  ]  83.2% (used 1526918 bytes from 1835008 bytes)
========================= [SUCCESS] Took 21.60 seconds =========================
INFO Successfully compiled program.
INFO Running:  platformio run -d /config/esphome/node3-esp32 -t upload --upload-port /dev/ttyUSB0
Processing node3-esp32 (board: esp32dev; framework: arduino; platform: platformio/[email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
PACKAGES: 
 - framework-arduinoespressif32 3.10006.210326 (1.0.6) 
 - tool-esptoolpy 1.30000.201119 (3.0.0) 
 - tool-mkspiffs 2.230.0 (2.30) 
 - toolchain-xtensa32 2.50200.97 (5.2.0)
Library Manager: Installing Hash
Library Manager: Already installed, built-in library
Dependency Graph
|-- <AsyncTCP-esphome> 1.2.2
|-- <FS> 1.0
|-- <ESPAsyncWebServer-esphome> 1.2.7
|   |-- <AsyncTCP-esphome> 1.2.2
|   |-- <FS> 1.0
|   |-- <WiFi> 1.0
|-- <ESPmDNS> 1.0
|   |-- <WiFi> 1.0
|-- <DNSServer> 1.1.0
|   |-- <WiFi> 1.0
|-- <Update> 1.0
|-- <WiFi> 1.0
Retrieving maximum program size /data/node3-esp32/.pioenvs/node3-esp32/firmware.elf
Checking size /data/node3-esp32/.pioenvs/node3-esp32/firmware.elf
RAM:   [==        ]  16.4% (used 53892 bytes from 327680 bytes)
Flash: [========  ]  83.2% (used 1526918 bytes from 1835008 bytes)
Configuring upload protocol...
AVAILABLE: esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esptool
Looking for upload port...
Use manually specified: /dev/ttyUSB0
Uploading /data/node3-esp32/.pioenvs/node3-esp32/firmware.bin
Serial port /dev/ttyUSB0
Connecting....
Chip is ESP32-D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 84:cc:a8:7e:bf:48
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 17104 bytes to 11191...
Writing at 0x00001000... (100 %)
Wrote 17104 bytes (11191 compressed) at 0x00001000 in 1.0 seconds (effective 135.7 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 144...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (144 compressed) at 0x00008000 in 0.0 seconds (effective 1236.3 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 5732.1 kbit/s)...
Hash of data verified.
Compressed 1527040 bytes to 913149...
Writing at 0x00010000... (1 %)
Writing at 0x00014000... (3 %)
Writing at 0x00018000... (5 %)
Writing at 0x0001c000... (7 %)
Writing at 0x00020000... (8 %)
Writing at 0x00024000... (10 %)
Writing at 0x00028000... (12 %)
Writing at 0x0002c000... (14 %)
Writing at 0x00030000... (16 %)
Writing at 0x00034000... (17 %)
Writing at 0x00038000... (19 %)
Writing at 0x0003c000... (21 %)
Writing at 0x00040000... (23 %)
Writing at 0x00044000... (25 %)
Writing at 0x00048000... (26 %)
Writing at 0x0004c000... (28 %)
Writing at 0x00050000... (30 %)
Writing at 0x00054000... (32 %)
Writing at 0x00058000... (33 %)
Writing at 0x0005c000... (35 %)
Writing at 0x00060000... (37 %)
Writing at 0x00064000... (39 %)
Writing at 0x00068000... (41 %)
Writing at 0x0006c000... (42 %)
Writing at 0x00070000... (44 %)
Writing at 0x00074000... (46 %)
Writing at 0x00078000... (48 %)
Writing at 0x0007c000... (50 %)
Writing at 0x00080000... (51 %)
Writing at 0x00084000... (53 %)
Writing at 0x00088000... (55 %)
Writing at 0x0008c000... (57 %)
Writing at 0x00090000... (58 %)
Writing at 0x00094000... (60 %)
Writing at 0x00098000... (62 %)
Writing at 0x0009c000... (64 %)
Writing at 0x000a0000... (66 %)
Writing at 0x000a4000... (67 %)
Writing at 0x000a8000... (69 %)
Writing at 0x000ac000... (71 %)
Writing at 0x000b0000... (73 %)
Writing at 0x000b4000... (75 %)
Writing at 0x000b8000... (76 %)
Writing at 0x000bc000... (78 %)
Writing at 0x000c0000... (80 %)
Writing at 0x000c4000... (82 %)
Writing at 0x000c8000... (83 %)
Writing at 0x000cc000... (85 %)
Writing at 0x000d0000... (87 %)
Writing at 0x000d4000... (89 %)
Writing at 0x000d8000... (91 %)
Writing at 0x000dc000... (92 %)
Writing at 0x000e0000... (94 %)
Writing at 0x000e4000... (96 %)
Writing at 0x000e8000... (98 %)
Writing at 0x000ec000... (100 %)
Wrote 1527040 bytes (913149 compressed) at 0x00010000 in 82.1 seconds (effective 148.8 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
======================== [SUCCESS] Took 115.00 seconds ========================
INFO Successfully uploaded program.
INFO Starting log output from /dev/ttyUSB0 with baud rate 115200
[14:20:00][D][esp32_ble_tracker:180]: Starting scan...
[14:20:00][C][wifi:037]: Setting up WiFi...
[14:20:00][D][wifi:380]: Starting scan...
[14:20:00][D][esp32_ble_tracker:620]: Found device 1B:2D:32:D3:AD:32 RSSI=-75
[14:20:00][D][esp32_ble_tracker:641]:   Address Type: RANDOM
[14:20:00][D][esp32_ble_tracker:620]: Found device 68:D7:9A:31:AE:B4 RSSI=-41
[14:20:00][D][esp32_ble_tracker:641]:   Address Type: PUBLIC
[14:20:01][D][esp32_ble_tracker:620]: Found device F4:F9:51:B7:99:54 RSSI=-63
[14:20:01][D][esp32_ble_tracker:641]:   Address Type: PUBLIC
[14:20:02][D][esp32_ble_tracker:620]: Found device F8:F0:05:E0:2A:E5 RSSI=-71
[14:20:02][D][esp32_ble_tracker:641]:   Address Type: PUBLIC
[14:20:02][D][esp32_ble_tracker:643]:   Name: '17160A00213245AAD'
[14:20:03][D][esp32_ble_tracker:620]: Found device 49:B1:4E:F1:0C:78 RSSI=-63
[14:20:03][D][esp32_ble_tracker:641]:   Address Type: RANDOM
[14:20:03][D][wifi:395]: Found networks:
[14:20:03][I][wifi:441]: - 'MySSID' [redacted]▂▄▆█
[14:20:03][D][wifi:442]:     Channel: 6
[14:20:03][D][wifi:443]:     RSSI: -45 dB
[14:20:03][I][wifi:441]: - 'MySSID' [redacted]▂▄▆█
[14:20:03][D][wifi:442]:     Channel: 1
[14:20:03][D][wifi:443]:     RSSI: -56 dB
[14:20:03][I][wifi:441]: - 'MySSID' [redacted]▂▄▆█
[14:20:03][D][wifi:442]:     Channel: 11
[14:20:03][D][wifi:443]:     RSSI: -65 dB
[14:20:03][D][wifi:445]: - [redacted] [redacted]▂▄▆█
[14:20:03][D][wifi:445]: - [redacted] [redacted]▂▄▆█
[14:20:03][I][wifi:250]: WiFi Connecting to 'MySSID'...
[14:20:04][D][esp32_ble_tracker:620]: Found device 0C:50:5D:2A:53:F6 RSSI=-70
[14:20:04][D][esp32_ble_tracker:641]:   Address Type: RANDOM
[14:20:04][D][esp32_ble_tracker:620]: Disconnected ssid='MySSID' bssid=[redacted][W][wifi_esp32:409]: Event: Disconnected ssid='MySSID' bssid=[redacted] reason='Association Failed'
[14:20:04][D][esp32_ble_tracker:641]:   Address Type: RANDOM
[14:20:04]
[14:20:04][D][esp32_ble_tracker:645]:   TX Power: 2
[14:20:04][W][wifi:547]: Error while connecting to network.
[14:20:04][W][wifi:585]: Restarting WiFi adapter...
[14:20:04][I][wifi:250]: WiFi Connecting to 'MySSID'...
[14:20:04][I][wifi:513]: WiFi Connected!
[14:20:04][C][wifi:359]:   SSID: [redacted]
[14:20:04][C][wifi:360]:   IP Address: 10.0.20.73
[14:20:04][C][wifi:362]:   BSSID: [redacted]
[14:20:04][C][wifi:363]:   Hostname: 'node3-esp32'
[14:20:04][C][wifi:367]:   Signal strength: -43 dB ▂▄▆█
[14:20:04][C][wifi:371]:   Channel: 6
[14:20:04][C][wifi:372]:   Subnet: 255.255.255.0
[14:20:04][C][wifi:373]:   Gateway: 10.0.0.1
[14:20:04][C][wifi:374]:   DNS1: 0.0.0.0
[14:20:04][C][wifi:375]:   DNS2: 0.0.0.0
[14:20:04][D][wifi:522]: Disabling AP...
[14:20:04][C][ota:029]: Over-The-Air Updates:
[14:20:04][C][ota:030]:   Address: 10.0.20.73:3232
[14:20:04][C][ota:032]:   Using Password.
[14:20:04][C][api:022]: Setting up Home Assistant API server...
[14:20:04][I][app:059]: setup() finished successfully!
[14:20:04][I][app:105]: ESPHome version 1.20.4 compiled on Aug 15 2021, 13:53:13
[14:20:04][C][wifi:499]: WiFi:
[14:20:04][C][wifi:359]:   SSID: [redacted]
[14:20:04][C][wifi:360]:   IP Address: 10.0.20.73
[14:20:04][C][wifi:362]:   BSSID: [redacted]
[14:20:04][C][wifi:363]:   Hostname: 'node3-esp32'
[14:20:04][C][wifi:367]:   Signal strength: -44 dB ▂▄▆█
[14:20:04][C][wifi:371]:   Channel: 6
[14:20:04][C][wifi:372]:   Subnet: 255.255.255.0
[14:20:04][C][wifi:373]:   Gateway: 10.0.0.1
[14:20:04][C][wifi:374]:   DNS1: 0.0.0.0
[14:20:04][C][wifi:375]:   DNS2: 0.0.0.0
[14:20:04][C][logger:189]: Logger:
[14:20:04][C][logger:190]:   Level: DEBUG
[14:20:04][C][logger:191]:   Log Baud Rate: 115200
[14:20:04][C][logger:192]:   Hardware UART: UART0
[14:20:05][C][esp32_ble_tracker:606]: BLE Tracker:
[14:20:05][C][esp32_ble_tracker:607]:   Scan Duration: 300 s
[14:20:05][C][esp32_ble_tracker:608]:   Scan Interval: 320.0 ms
[14:20:05][C][esp32_ble_tracker:609]:   Scan Window: 30.0 ms
[14:20:05][C][esp32_ble_tracker:610]:   Scan Type: ACTIVE
[14:20:05][C][atc_mithermometer:012]: ATC MiThermometer
[14:20:05][C][atc_mithermometer:013]:   Temperature 'Sensor 5 - Temperature'
[14:20:05][C][atc_mithermometer:013]:     Device Class: 'temperature'
[14:20:05][C][atc_mithermometer:013]:     State Class: 'measurement'
[14:20:05][C][atc_mithermometer:013]:     Unit of Measurement: '°C'
[14:20:05][C][atc_mithermometer:013]:     Accuracy Decimals: 1
[14:20:05][C][atc_mithermometer:014]:   Humidity 'Sensor 5 - Humidity'
[14:20:05][C][atc_mithermometer:014]:     Device Class: 'humidity'
[14:20:05][C][atc_mithermometer:014]:     State Class: 'measurement'
[14:20:05][C][atc_mithermometer:014]:     Unit of Measurement: '%'
[14:20:05][C][atc_mithermometer:014]:     Accuracy Decimals: 0
[14:20:05][C][atc_mithermometer:015]:   Battery Level 'Sensor 5 - Battery-Level'
[14:20:05][C][atc_mithermometer:015]:     Device Class: 'battery'
[14:20:05][C][atc_mithermometer:015]:     State Class: 'measurement'
[14:20:05][C][atc_mithermometer:015]:     Unit of Measurement: '%'
[14:20:05][C][atc_mithermometer:015]:     Accuracy Decimals: 0
[14:20:05][C][captive_portal:148]: Captive Portal:
[14:20:05][C][ota:029]: Over-The-Air Updates:
[14:20:06][C][ota:030]:   Address: 10.0.20.73:3232
[14:20:06][C][ota:032]:   Using Password.
[14:20:06][C][api:095]: API Server:
[14:20:06][C][api:096]:   Address: 10.0.20.73:6053
[14:20:09][D][atc_mithermometer:116]: Got ATC MiThermometer (A4:C1:38:37:03:52):
[14:20:09][D][atc_mithermometer:119]:   Temperature: 21.0 °C
[14:20:09][D][atc_mithermometer:122]:   Humidity: 61 %
[14:20:09][D][atc_mithermometer:125]:   Battery Level: 100 %
[14:20:09][D][atc_mithermometer:128]:   Battery Voltage: 3.196 V
[14:20:09][D][sensor:127]: 'Sensor 8 - Temperature': Sending state 21.00000 °C with 1 decimals of accuracy
[14:20:09][D][sensor:127]: 'Sensor 8 - Humidity': Sending state 61.00000 % with 0 decimals of accuracy
[14:20:09][D][sensor:127]: 'Sensor 8 - Battery-Level': Sending state 100.00000 % with 0 decimals of accuracy
[14:20:14][D][atc_mithermometer:116]: Got ATC MiThermometer (A4:C1:38:A6:DF:67):
[14:20:14][D][atc_mithermometer:119]:   Temperature: 21.1 °C
[14:20:14][D][atc_mithermometer:122]:   Humidity: 60 %
[14:20:14][D][atc_mithermometer:125]:   Battery Level: 100 %
[14:20:14][D][atc_mithermometer:128]:   Battery Voltage: 3.219 V
[14:20:14][D][sensor:127]: 'Sensor 10 - Temperature': Sending state 21.10000 °C with 1 decimals of accuracy
[14:20:14][D][sensor:127]: 'Sensor 10 - Humidity': Sending state 60.00000 % with 0 decimals of accuracy
[14:20:14][D][sensor:127]: 'Sensor 10 - Battery-Level': Sending state 100.00000 % with 0 decimals of accuracy
[14:20:23][D][esp32_ble_tracker:620]: Found device A4:C1:38:8E:81:77 RSSI=-79
[14:20:23][D][esp32_ble_tracker:641]:   Address Type: PUBLIC
[14:20:23][D][esp32_ble_tracker:643]:   Name: 'ATC_8E8177'
[14:20:24][D][atc_mithermometer:116]: Got ATC MiThermometer (A4:C1:38:DA:91:1A):
[14:20:24][D][atc_mithermometer:119]:   Temperature: 21.0 °C
[14:20:24][D][atc_mithermometer:122]:   Humidity: 60 %
[14:20:24][D][atc_mithermometer:125]:   Battery Level: 100 %
[14:20:24][D][atc_mithermometer:128]:   Battery Voltage: 3.199 V
[14:20:24][D][sensor:127]: 'Sensor 7 - Temperature': Sending state 21.00000 °C with 1 decimals of accuracy
[14:20:24][D][sensor:127]: 'Sensor 7 - Humidity': Sending state 60.00000 % with 0 decimals of accuracy
[14:20:24][D][sensor:127]: 'Sensor 7 - Battery-Level': Sending state 100.00000 % with 0 decimals of accuracy
[14:20:32][D][atc_mithermometer:116]: Got ATC MiThermometer (A4:C1:38:EA:DB:88):
[14:20:32][D][atc_mithermometer:119]:   Temperature: 21.0 °C
[14:20:32][D][atc_mithermometer:122]:   Humidity: 61 %
[14:20:32][D][atc_mithermometer:125]:   Battery Level: 100 %
[14:20:32][D][atc_mithermometer:128]:   Battery Voltage: 3.154 V
[14:20:32][D][sensor:127]: 'Sensor 5 - Temperature': Sending state 21.00000 °C with 1 decimals of accuracy
[14:20:32][D][sensor:127]: 'Sensor 5 - Humidity': Sending state 61.00000 % with 0 decimals of accuracy
[14:20:32][D][sensor:127]: 'Sensor 5 - Battery-Level': Sending state 100.00000 % with 0 decimals of accuracy

Hi.

The only strange thing I see is that the gateway is not matching the ip number.
Usually they match the three first numbers when you have the subnet 255.255.255.0

static_ip: 10.0.20.73
gateway: 10.0.0.1

So could it be that the gateway should be:

10.0.20.1 

/Mattias

2 Likes

Just tried changing gateway to 10.0.20.1 as you suggested and boom, SOLVED. I never would have thought of that, thank you!

2 Likes

Great that it solved it. Sometimes connection issues could be a pain to figure out.

/Mattias

1 Like