Hey everyone,
So 2 months ago, I bought this waveshare 6 channel relay and was using it along with a w5500 ethernet module over ethernet and mqtt. I had this setup running for about a week (worked flawlessly) before turning it off. Fast forward 2 months - yesterday when I turned it on again, it wouldn’t show up online on my HA. I flashed the code again, restarted the thing, I even bought another waveshare 6 channel relay board+w5500 ethernet module - still nothing.
Here’s my esphome yaml:
esphome:
name: waveshare-6ch-relay
esp32:
board: esp32-s3-devkitc-1
flash_size: 8MB
framework:
type: arduino
# Enable logging
logger:
level: DEBUG
ota:
- platform: esphome
ethernet:
type: W5500
clk_pin: GPIO5
mosi_pin: GPIO4
miso_pin: GPIO40
cs_pin: GPIO39
interrupt_pin: GPIO11
reset_pin: GPIO12
preferences:
flash_write_interval: 20s
mqtt:
broker: 192.168.29.117
username: abc
password: 123
binary_sensor:
- platform: status
name: "Status"
- platform: gpio
name: "Boot Button"
pin:
number: 0
ignore_strapping_warning: true
mode:
input: true
inverted: true
disabled_by_default: true
on_press:
then:
- button.press: restart_button
switch:
- platform: gpio
pin: GPIO1
id: relay1
name: Relay 1
restore_mode: RESTORE_DEFAULT_ON
- platform: gpio
pin: GPIO2
id: relay2
name: Relay 2
restore_mode: RESTORE_DEFAULT_ON
- platform: gpio
pin: GPIO41
id: relay3
name: Relay 3
restore_mode: RESTORE_DEFAULT_ON
- platform: gpio
pin: GPIO42
id: relay4
name: Relay 4
restore_mode: RESTORE_DEFAULT_ON
- platform: gpio
pin:
number: GPIO45
ignore_strapping_warning: true
id: relay5
name: Relay 5
restore_mode: RESTORE_DEFAULT_ON
- platform: gpio
pin:
number: GPIO46
ignore_strapping_warning: true
id: relay6
name: Relay 6
restore_mode: RESTORE_DEFAULT_ON
uart:
- id: modbus_uart
tx_pin: GPIO17
rx_pin: GPIO18
baud_rate: 9600
# buzzer
output:
- platform: ledc
pin: GPIO21
id: buzzer
rtttl:
output: buzzer
id: rtttl_buzzer
gain: 30%
light:
- platform: neopixelbus
type: RGB
variant: 800KBPS
pin: GPIO38
num_leds: 1
name: "RGB LED"
id: rgb_led
button:
- platform: restart
name: "Restart"
id: restart_button
entity_category: config
- platform: factory_reset
name: "Factory Reset"
id: reset
entity_category: config
- platform: safe_mode
name: "Safe Mode"
internal: false
entity_category: config
Any idea why this might be happening? I don’t have access to my router’s admin page and so I have no clue if the device is actually connecting to my network.
Could it be updates related? My HA is updated to April 2025 (and so are all integrations, add-ons, etc.). Really seems bizarre. Thanks a lot for your help.
vincen
(Vincèn)
May 31, 2025, 5:48pm
2
Hi
What are saying logs if you stay connected in USB to the ESP after flashing ?
Vincèn
Thanks for the reply Vincen. I’m uploading the code through web.esphome.io . I pressed the reset button a few times. Here are the logs:
[23:32:06][I][logger:171]: Log initialized
[23:32:06][C][safe_mode:079]: There have been 0 suspected unsuccessful boot attempts
[23:32:06][D][esp32.preferences:114]: Saving 1 preferences to flash...
[23:32:06][D][esp32.preferences:143]: Saving 1 prefereESP-ROM:esp32s3-20210327
[23:32:06]Build:Mar 27 2021
[23:32:06]rst:0x15 (USB_UART_CHIP_RESET),boot:0x8 (SPI_FAST_FLASH_BOOT)
[23:32:06]Saved PC:0x4208c1fa
[23:32:06]SPIWP:0xee
[23:32:06]mode:DIO, clock div:1
[23:32:06]load:0x3fce3808,len:0x43c
[23:32:06]load:0x403c9700,len:0xbec
[23:32:06]load:0x403cc700,len:0x2a3c
[23:32:06]entry 0x403c98d8
[23:32:06][I][logger:171]: Log initialized
[23:32:06][C][safe_mode:079]: There have been 1 suspected unsuccessful boot attempts
[23:32:06][D][esp32.preferences:114]: Saving 1 preferences to flash...
[23:32:06][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[23:32:06][I][app:029]: Running through setup()...
[23:32:06][C][uart.arduino_esp32:077]: Setting up UART...
[23:32:06][C][switch.gpio:011]: Setting up GPIO Switch 'Relay 1'...
[23:32:06][D][switch:012]: 'Relay 1' Turning ON.
[23:32:06][D][switch:055]: 'Relay 1': Sending state ON
[23:32:06][D][esp32:117]: rtc: 1
[23:32:06][D][switch:012]: 'Relay 1' Turning ON.
[23:32:06][C][switch.gpio:011]: Setting up GPIO Switch 'Relay 2'...
[23:32:06][D][switch:012]: 'Relay 2' Turning ON.
[23:32:06][D][switch:055]: 'Relay 2': Sending state ON
[23:32:06][D][esp32:117]: rtc: 1
[23:32:06][D][switch:012]: 'Relay 2' Turning ON.
[23:32:06][C][switch.gpio:011]: Setting up GPIO Switch 'Relay 3'...
[23:32:06][D][switch:012]: 'Relay 3' Turning ON.
[23:32:06][D][switch:055]: 'Relay 3': Sending state ON
[23:32:06][D][esp32:117]: rtc: 1
[23:32:06][D][switch:012]: 'Relay 3' Turning ON.
[23:32:06][C][switch.gpio:011]: Setting up GPIO Switch 'Relay 4'...
[23:32:06][D][switch:012]: 'Relay 4' Turning ON.
[23:32:06][D][switch:055]: 'Relay 4': Sending state ON
[23:32:06][D][esp32:117]: rtc: 1
[23:32:06][D][switch:012]: 'Relay 4' Turning ON.
[23:32:06][C][switch.gpio:011]: Setting up GPIO Switch 'Relay 5'...
[23:32:06][D][switch:012]: 'Relay 5' Turning ON.
[23:32:06][D][switch:055]: 'Relay 5': Sending state ON
[23:32:06][D][esp32:117]: rtc: 1
[23:32:06][D][switch:012]: 'Relay 5' Turning ON.
[23:32:06][C][switch.gpio:011]: Setting up GPIO Switch 'Relay 6'...
[23:32:06][D][switch:012]: 'Relay 6' Turning ON.
[23:32:06][D][switch:055]: 'Relay 6': Sending state ON
[23:32:06][D][esp32:117]: rtc: 1
[23:32:06][D][switch:012]: 'Relay 6' Turning ON.
[23:32:06][D][esp32:117]: rtc: 1
[23:32:06][D][binary_sensor:034]: 'Boot Button': Sending initial state OFF
[23:32:06][C][light:021]: Setting up light 'RGB LED'...
[23:32:06][D][light:036]: 'RGB LED' Setting:
[23:32:06][D][light:041]: Color mode: RGB
[23:32:06][D][light:085]: Transition length: 1.0s
[23:32:06][D][binary_sensor:034]: 'Status': Sending initial state OFF
[23:32:06][C][ethernet:041]: Setting up Ethernet...
[23:32:06][I][ethernet:248]: Starting ethernet connection
[23:32:06][W][component:167]: Component ethernet set Warning flag: waiting for IP configuration
[23:32:10][D][esp32.preferences:114]: Saving 6 preferences to flash...
[23:32:10][D][esp32.preferences:143]: Saving 6 preferences to flash: 6 cached, 0 written, 0 failed
[23:32:21][W][ethernet:265]: Connecting via ethernet failed! Re-connecting...
[23:32:35]ESP-ROM:esp32s3-20210327
[23:32:35]Build:Mar 27 2021
[23:32:35]rst:0x15 (USB_UART_CHIP_RESET),boot:0x8 (SPI_FAST_FLASH_BOOT)
[23:32:35]Saved PC:0x4208c1fa
[23:32:35]SPIWP:0xee
[23:32:35]mode:DIO, clock div:1
[23:32:35]load:0x3fce3808,len:0x43c
[23:32:35]load:0x403c9700,len:0xbec
[23:32:35]load:0x403cc700,len:0x2a3c
[23:32:35]entry 0x403c98d8
[23:32:36][I][logger:171]: Log initialized
[23:32:36][C][safe_mode:079]: There have been 2 suspected unsuccessful boot attempts
[23:32:36][D][esp32.preferences:114]: Saving 1 preferences to flash...
[23:32:36][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[23:32:36][I][app:029]: Running through setup()...
[23:32:36][C][uart.arduino_esp32:077]: Setting up UART...
[23:32:36][C][switch.gpio:011]: Setting up GPIO Switch 'Relay 1'...
[23:32:36][D][switch:012]: 'Relay 1' Turning ON.
[23:32:36][D][switch:055]: 'Relay 1': Sending state ON
[23:32:36][D][esp32:117]: rtc: 1
[23:32:36][D][switch:012]: 'Relay 1' Turning ON.
[23:32:36][C][switch.gpio:011]: Setting up GPIO Switch 'Relay 2'...
[23:32:36][D][switch:012]: 'Relay 2' Turning ON.
[23:32:36][D][switch:055]: 'Relay 2': Sending state ON
[23:32:36][D][esp32:117]: rtc: 1
[23:32:36][D][switch:012]: 'Relay 2' Turning ON.
[23:32:36][C][switch.gpio:011]: Setting up GPIO Switch 'Relay 3'...
[23:32:36][D][switch:012]: 'Relay 3' Turning ON.
[23:32:36][D][switch:055]: 'Relay 3': Sending state ON
[23:32:36][D][esp32:117]: rtc: 1
[23:32:36][D][switch:012]: 'Relay 3' Turning ON.
[23:32:36][C][switch.gpio:011]: Setting up GPIO Switch 'Relay 4'...
[23:32:36][D][switch:012]: 'Relay 4' Turning ON.
[23:32:36][D][switch:055]: 'Relay 4': Sending state ON
[23:32:36][D][esp32:117]: rtc: 1
[23:32:36][D][switch:012]: 'Relay 4' Turning ON.
[23:32:36][C][switch.gpio:011]: Setting up GPIO Switch 'Relay 5'...
[23:32:36][D][switch:012]: 'Relay 5' Turning ON.
[23:32:36][D][switch:055]: 'Relay 5': Sending state ON
[23:32:36][D][esp32:117]: rtc: 1
[23:32:36][D][switch:012]: 'Relay 5' Turning ON.
[23:32:36][C][switch.gpio:011]: Setting up GPIO Switch 'Relay 6'...
[23:32:36][D][switch:012]: 'Relay 6' Turning ON.
[23:32:36][D][switch:055]: 'Relay 6': Sending state ON
[23:32:36][D][esp32:117]: rtc: 1
[23:32:36][D][switch:012]: 'Relay 6' Turning ON.
[23:32:36][D][esp32:117]: rtc: 1
[23:32:36][D][binary_sensor:034]: 'Boot Button': Sending initial state OFF
[23:32:36][C][light:021]: Setting up light 'RGB LED'...
[23:32:36][D][light:036]: 'RGB LED' Setting:
[23:32:36][D][light:041]: Color mode: RGB
[23:32:36][D][light:085]: Transition length: 1.0s
[23:32:36][D][binary_sensor:034]: 'Status': Sending initial state OFF
[23:32:36][C][ethernet:041]: Setting up Ethernet...
[23:32:36][I][ethernet:248]: Starting ethernet connection
[23:32:36][W][component:167]: Component ethernet set Warning flag: waiting for IP configuration
[23:32:37][D][esp32.preferences:114]: Saving 6 preferences to flash...
[23:32:37][D][esp32.preferences:143]: Saving 6 preferences to flash: 6 cached, 0 written, 0 failed
vincen
(Vincèn)
May 31, 2025, 6:40pm
4
Thanks for the log that confirms something I didn’t notice at first in your sketch ! It’s missing the network configuration itself:
manual_ip:
static_ip: 10.0.0.42
gateway: 10.0.0.1
subnet: 255.255.255.0
and second if you use an external network module it’s known to fail quite a lot ! The Ethernet mode works only with boards that have Ethernet on it aside the ESP (I use it with some Kincony boxes and it works since years without problems).
I thought the manual_ip config. was optional? I did not have to set ip manually the last time. Anyways, the logs I shared was when I connected the board (with the ethernet module attached) to the my pc via usb without the ethernet cable attached. I’ll check logs again with the ethernet cable connected this time - I’ll posts results soon. Thanks a lot for your help.
Yeah ideally I’d love to use those esp boards with ethernet inbuilt. Costs are what’s keeping me from using them (those boards are expensive here).
try a few different clock speeds
ethernet:
type: W5500
clk_pin: GPIO22 #GPIO18
mosi_pin: GPIO02 #GPIO23
miso_pin: GPIO23 #GPIO19
cs_pin: GPIO21 #GPIO5
interrupt_pin: GPIO03 #GPIO22
reset_pin: GPIO19 #GPIO16
clock_speed: 30Mhz ##<<<<<<<<<<
the defaults did not work for me on esp32c6
And short cables, or even better solder it to a PCB, i made a bt proxy with c6 and w5500 after i soldered it all together its super stable not a single fail in 60+days now
Here are logs after having connected ethernet cable :
[01:23:11][I][logger:171]: Log initialized
[01:23:11][C][safe_mode:079]: There have been 0 suspected unsuccessful boot attempts
[01:23:11][D][esp32.preferences:114]: Saving 1 preferences to flash...
[01:23:11][D][esp32.preferences:143]: Saving 1 prefere[I][ethernet:248]: Starting ethernet connection
[01:23:11]SP-ROM:esp32s3-20210327
[01:23:11]Build:Mar 27 2021
[01:23:11]rst:0x15 (USB_UART_CHIP_RESET),boot:0x8 (SPI_FAST_FLASH_BOOT)
[01:23:11]Saved PC:0x4208439e
[01:23:11]SPIWP:0xee
[01:23:11]mode:DIO, clock div:1
[01:23:11]load:0x3fce3808,len:0x43c
[01:23:11]load:0x403c9700,len:0xbec
[01:23:11]load:0x403cc700,len:0x2a3c
[01:23:11]entry 0x403c98d8
[01:23:11][I][logger:171]: Log initialized
[01:23:11][C][safe_mode:079]: There have been 1 suspected unsuccessful boot attempts
[01:23:11][D][esp32.preferences:114]: Saving 1 preferences to flash...
[01:23:11][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[01:23:11][I][app:029]: Running through setup()...
[01:23:11][C][uart.arduino_esp32:077]: Setting up UART...
[01:23:11][C][switch.gpio:011]: Setting up GPIO Switch 'Relay 1'...
[01:23:11][D][switch:012]: 'Relay 1' Turning ON.
[01:23:11][D][switch:055]: 'Relay 1': Sending state ON
[01:23:11][D][esp32:117]: rtc: 1
[01:23:11][D][switch:012]: 'Relay 1' Turning ON.
[01:23:11][C][switch.gpio:011]: Setting up GPIO Switch 'Relay 2'...
[01:23:11][D][switch:012]: 'Relay 2' Turning ON.
[01:23:11][D][switch:055]: 'Relay 2': Sending state ON
[01:23:11][D][esp32:117]: rtc: 1
[01:23:11][D][switch:012]: 'Relay 2' Turning ON.
[01:23:11][C][switch.gpio:011]: Setting up GPIO Switch 'Relay 3'...
[01:23:11][D][switch:012]: 'Relay 3' Turning ON.
[01:23:11][D][switch:055]: 'Relay 3': Sending state ON
[01:23:11][D][esp32:117]: rtc: 1
[01:23:11][D][switch:012]: 'Relay 3' Turning ON.
[01:23:11][C][switch.gpio:011]: Setting up GPIO Switch 'Relay 4'...
[01:23:11][D][switch:012]: 'Relay 4' Turning ON.
[01:23:11][D][switch:055]: 'Relay 4': Sending state ON
[01:23:11][D][esp32:117]: rtc: 1
[01:23:11][D][switch:012]: 'Relay 4' Turning ON.
[01:23:11][C][switch.gpio:011]: Setting up GPIO Switch 'Relay 5'...
[01:23:11][D][switch:012]: 'Relay 5' Turning ON.
[01:23:11][D][switch:055]: 'Relay 5': Sending state ON
[01:23:11][D][esp32:117]: rtc: 1
[01:23:11][D][switch:012]: 'Relay 5' Turning ON.
[01:23:11][C][switch.gpio:011]: Setting up GPIO Switch 'Relay 6'...
[01:23:11][D][switch:012]: 'Relay 6' Turning ON.
[01:23:11][D][switch:055]: 'Relay 6': Sending state ON
[01:23:11][D][esp32:117]: rtc: 1
[01:23:11][D][switch:012]: 'Relay 6' Turning ON.
[01:23:11][D][esp32:117]: rtc: 1
[01:23:11][D][binary_sensor:034]: 'Boot Button': Sending initial state OFF
[01:23:11][C][light:021]: Setting up light 'RGB LED'...
[01:23:11][D][light:036]: 'RGB LED' Setting:
[01:23:11][D][light:041]: Color mode: RGB
[01:23:11][D][light:085]: Transition length: 1.0s
[01:23:11][D][binary_sensor:034]: 'Status': Sending initial state OFF
[01:23:11][C][ethernet:041]: Setting up Ethernet...
[01:23:11][I][ethernet:248]: Starting ethernet connection
[01:23:11][W][component:167]: Component ethernet set Warning flag: waiting for IP configuration
[01:23:13][I][ethernet:259]: Connected via Ethernet!
[01:23:13][C][ethernet:515]: IP Address: 192.168.29.18
[01:23:13][C][ethernet:516]: Hostname: 'waveshare-6ch-relay'
[01:23:13][C][ethernet:517]: Subnet: 255.255.255.0
[01:23:13][C][ethernet:518]: Gateway: 192.168.29.1
[01:23:13][C][ethernet:523]: DNS1: 0.0.0.0
[01:23:13][C][ethernet:524]: DNS2: 0.0.0.0
[01:23:13][C][ethernet:536]: MAC Address: F2:9E:9E:55:2B:5D
[01:23:13][C][ethernet:537]: Is Full Duplex: YES
[01:23:13][C][ethernet:538]: Link Speed: 100
[01:23:13][W][component:182]: Component ethernet cleared Warning flag
[01:23:13][C][mqtt:037]: Setting up MQTT...
[01:23:13][D][mqtt:518]: Enabling MQTT...
[01:23:13][W][component:167]: Component mqtt set Warning flag: unspecified
[01:23:13][I][mqtt:254]: Connecting to MQTT...
[01:23:13][D][esp32.preferences:114]: Saving 6 preferences to flash...
[01:23:13][D][esp32.preferences:143]: Saving 6 preferences to flash: 6 cached, 0 written, 0 failed
[01:23:23][E][mqtt.idf:162]: MQTT_EVENT_ERROR
[01:23:23][E][mqtt.idf:164]: Last error code reported from esp-tls: 0x8006
[01:23:23][E][mqtt.idf:165]: Last tls stack error number: 0x0
[01:23:23][E][mqtt.idf:167]: Last captured errno : 0 (Success)
[01:23:23][W][mqtt:344]: MQTT Disconnected: TCP disconnected.
[01:23:23][I][mqtt:254]: Connecting to MQTT...
[01:23:48][E][mqtt.idf:162]: MQTT_EVENT_ERROR
[01:23:48][E][mqtt.idf:164]: Last error code reported from esp-tls: 0x8006
[01:23:48][E][mqtt.idf:165]: Last tls stack error number: 0x0
[01:23:48][E][mqtt.idf:167]: Last captured errno : 0 (Success)
[01:23:48][W][mqtt:344]: MQTT Disconnected: TCP disconnected.
[01:23:48][I][mqtt:254]: Connecting to MQTT...
[01:24:11][I][safe_mode:041]: Boot seems successful; resetting boot loop counter
[01:24:11][D][esp32.preferences:114]: Saving 1 preferences to flash...
[01:24:11][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[01:24:13][D][esp-idf:000][mqtt_task]: E (75003) TRANSPORT_BASE: Failed to open a new connection: 32774
[01:24:13][D][esp-idf:000][mqtt_task]: E (75004) MQTT_CLIENT: Error transport connect
[01:24:13][E][mqtt.idf:162]: MQTT_EVENT_ERROR
[01:24:13][E][mqtt.idf:164]: Last error code reported from esp-tls: 0x8006
[01:24:13][E][mqtt.idf:165]: Last tls stack error number: 0x0
[01:24:13][E][mqtt.idf:167]: Last captured errno : 0 (Success)
[01:24:13][W][mqtt:344]: MQTT Disconnected: TCP disconnected.
[01:24:13][I][mqtt:254]: Connecting to MQTT...
[01:24:38][D][esp-idf:000][mqtt_task]: E (100006) esp-tls: [sock=49] select() timeout
[01:24:38][D][esp-idf:000][mqtt_task]: E (100006) TRANSPORT_BASE: Failed to open a new connection: 32774
[01:24:38][D][esp-idf:000][mqtt_task]: E (100007) MQTT_CLIENT: Error transport connect
[01:24:38][E][mqtt.idf:162]: MQTT_EVENT_ERROR
[01:24:38][E][mqtt.idf:164]: Last error code reported from esp-tls: 0x8006
[01:24:38][E][mqtt.idf:165]: Last tls stack error number: 0x0
[01:24:38][E][mqtt.idf:167]: Last captured errno : 0 (Success)
[01:24:38][W][mqtt:344]: MQTT Disconnected: TCP disconnected.
[01:24:38][I][mqtt:254]: Connecting to MQTT...
From logs I just posted above it looks like it’s able to connect to internet but not to my mqtt broker on HA
vincen
(Vincèn)
June 1, 2025, 7:48am
9
Yep your MQTT server uses TLS no ? It’s not supported so far on ESP32 with Arduino environment → MQTT Client Component — ESPHome
You need to either deactivate TLS on your MQTT server or tries to use the esp-idf instead of Arduino !
Why do you use MQTT instead of the native API to connect at HA ? It’s a lot easier and works like a charm