How to get Ethernet working with ESPHome for Home Assistant?

My context

(though the question is of wider interest).

I have built an intruder alarm system on an Espressif ESP32 Devkit V4 board. The app uses 9 inputs and 3 outputs, so I do not have a lot of spare pins.

My requirement is to add Ethernet capability. I do not want to play with the Ethernet program myself; I just want Home Assistant to recognise the device over Ethernet as it would over WiFi.

However, I have failed to find a straightforward guide to doing this among the endless very technical forums and blogs! The ESPHome documentation is clear as far as it goes, but too limited on practical application.

Candidate connection modules include
Yheonver LAN8720, which is just £3.38 on Amazon UK
AZDelivery W5500 , which is £6.99 on Amazon UK
OFFILICIOUS USR-ES1 W5500, £9.58 on Amazon UK

Question 1: How many connections are really required?

The ESPHome documentation states that two pins are sufficient to connect the ESP32 to an RMII type of chip such as the LAN8720, and at least four are required to connect the ESP32 to SPI chips such as the W5500. However other blogs, such as Sautter’s say that 8 are required to connect an RMII chip.

Is that so for my use case? Why? And if yes, why does the ESPHome library not need to know about these pins?

Question 2: Is everything I need included automatically from the ESPHome libraries?

The ESPHome documentation seems to treat the LAN8720 and W5500 as interchangeable but I gather from the data sheets that the W5500 has much more built-in (PHY, TCP/IP etc.) than the LAN8720.

Does the ESPHome library automatically use the hardware where possible (W5500), and otherwise provide the code in software (LAN8720)? If so, what is the performance penalty?

I had no reply to my original posting, which I let intact above – but I did change the title from “Best way to add Ethernet to ESPHome for Home Assistant – LAN8720 or W5500?” and changed the category from Hardware to Configuration.

With the questions still open, I took a gamble and opted for a W5500 board because it seems to do more for the same money and use fewer pins. I wired it up with the default settings given in the ESPHome Ethernet document, including the ‘optional’ ones because it is not clear what not choosing the option does!

The config is thus

ethernet:
  type: W5500
  cs_pin: 18
  clk_pin: 19
  mosi_pin: 21
  reset_pin: 22
  miso_pin: 23
  interrupt_pin: 36

I did not connect NC.

My assumption that ESPHome sets up all the software needed to connect the device after flashing seems to be borne out by the log messages, but ultimately it is failing to connect to it. Why?

I can confirm:

  • I checked several times that the W5500 board is connect to the correct processor pins (if the above is correct)
  • The hardware and software worked OK with the WiFi option, before and after the addition of the Ethernet board
  • The config compiles without error and the program is loaded without error. The error apparently occurs at the point the system tries to connect to the device over Ethernet after flashing completes.
  • The LEDs on the Ethernet board are flashing encouragingly, but no connection …

Here’s the log. What should I do next??

INFO ESPHome 2024.4.1
INFO Reading configuration /config/hardwired-alarm-control.yaml...
WARNING GPIO15 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
WARNING GPIO5 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
INFO Generating C++ source...
INFO Compiling app...
Processing hardwired-alarm-control (board: esp32dev; framework: arduino; platform: platformio/[email protected])
--------------------------------------------------------------------------------
Removing unused dependencies...
Library Manager: Removing AsyncTCP-esphome @ 2.1.3
INFO Removing AsyncTCP-esphome @ 2.1.3
Library Manager: [email protected] has been removed!
INFO [email protected] has been removed!
Library Manager: Removing ESPAsyncWebServer-esphome @ 3.1.0
INFO Removing ESPAsyncWebServer-esphome @ 3.1.0
Library Manager: Removing dependencies...
INFO Removing dependencies...
Library Manager: [email protected] has been removed!
INFO [email protected] has been removed!
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
Dependency Graph
|-- WiFi @ 2.0.0
|-- ESPmDNS @ 2.0.0
|-- Update @ 2.0.0
|-- noise-c @ 0.1.4
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/api/api_connection.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/api/api_frame_helper.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/api/api_pb2.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/api/api_pb2_service.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/api/api_server.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/api/list_entities.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/api/proto.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/api/subscribe_state.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/api/user_services.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/binary_sensor/automation.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/binary_sensor/binary_sensor.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/binary_sensor/filter.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/esp32/core.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/esp32/gpio.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/esp32/preferences.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/ethernet/esp_eth_phy_jl1101.c.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/ethernet/ethernet_component.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/gpio/binary_sensor/gpio_binary_sensor.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/gpio/switch/gpio_switch.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/logger/logger.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/logger/logger_esp32.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/logger/logger_esp8266.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/logger/logger_host.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/logger/logger_libretiny.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/logger/logger_rp2040.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/md5/md5.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/mdns/mdns_component.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/mdns/mdns_esp32.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/mdns/mdns_esp8266.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/mdns/mdns_host.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/mdns/mdns_libretiny.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/mdns/mdns_rp2040.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/network/util.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/ota/ota_backend_arduino_esp32.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/ota/ota_backend_arduino_esp8266.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/ota/ota_backend_arduino_libretiny.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/ota/ota_backend_arduino_rp2040.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/ota/ota_backend_esp_idf.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/ota/ota_component.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/socket/bsd_sockets_impl.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/socket/lwip_raw_tcp_impl.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/socket/lwip_sockets_impl.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/socket/socket.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/switch/automation.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/components/switch/switch.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/core/application.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/core/color.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/core/component.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/core/component_iterator.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/core/controller.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/core/entity_base.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/core/helpers.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/core/log.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/core/ring_buffer.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/core/scheduler.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/core/string_ref.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/core/time.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/esphome/core/util.cpp.o
Compiling .pioenvs/hardwired-alarm-control/src/main.cpp.o
Building .pioenvs/hardwired-alarm-control/bootloader.bin
Generating partitions .pioenvs/hardwired-alarm-control/partitions.bin
Creating esp32 image...
Successfully created esp32 image.
Compiling .pioenvs/hardwired-alarm-control/lib18f/WiFi/WiFi.cpp.o
Compiling .pioenvs/hardwired-alarm-control/lib18f/WiFi/WiFiAP.cpp.o
Compiling .pioenvs/hardwired-alarm-control/lib18f/WiFi/WiFiClient.cpp.o
Compiling .pioenvs/hardwired-alarm-control/lib18f/WiFi/WiFiGeneric.cpp.o
Compiling .pioenvs/hardwired-alarm-control/lib18f/WiFi/WiFiMulti.cpp.o
Compiling .pioenvs/hardwired-alarm-control/lib18f/WiFi/WiFiSTA.cpp.o
Compiling .pioenvs/hardwired-alarm-control/lib18f/WiFi/WiFiScan.cpp.o
Compiling .pioenvs/hardwired-alarm-control/lib18f/WiFi/WiFiServer.cpp.o
Compiling .pioenvs/hardwired-alarm-control/lib18f/WiFi/WiFiUdp.cpp.o
Compiling .pioenvs/hardwired-alarm-control/lib3c3/ESPmDNS/ESPmDNS.cpp.o
Compiling .pioenvs/hardwired-alarm-control/libb83/Update/HttpsOTAUpdate.cpp.o
Compiling .pioenvs/hardwired-alarm-control/libb83/Update/Updater.cpp.o
Compiling .pioenvs/hardwired-alarm-control/libcd4/libsodium/crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c.o
Compiling .pioenvs/hardwired-alarm-control/libcd4/libsodium/crypto_core/ed25519/core_ed25519.c.o
Compiling .pioenvs/hardwired-alarm-control/libcd4/libsodium/crypto_core/ed25519/core_ristretto255.c.o
Compiling .pioenvs/hardwired-alarm-control/libcd4/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c.o
Compiling .pioenvs/hardwired-alarm-control/libcd4/libsodium/crypto_hash/crypto_hash.c.o
Compiling .pioenvs/hardwired-alarm-control/libcd4/libsodium/crypto_hash/sha256/cp/hash_sha256_cp.c.o
Compiling .pioenvs/hardwired-alarm-control/libcd4/libsodium/crypto_hash/sha256/hash_sha256.c.o
Archiving .pioenvs/hardwired-alarm-control/lib18f/libWiFi.a
Compiling .pioenvs/hardwired-alarm-control/libcd4/libsodium/crypto_onetimeauth/crypto_onetimeauth.c.o
Compiling .pioenvs/hardwired-alarm-control/libcd4/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.c.o
Compiling .pioenvs/hardwired-alarm-control/libcd4/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c.o
Compiling .pioenvs/hardwired-alarm-control/libcd4/libsodium/crypto_scalarmult/crypto_scalarmult.c.o
Compiling .pioenvs/hardwired-alarm-control/libcd4/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.c.o
Archiving .pioenvs/hardwired-alarm-control/lib3c3/libESPmDNS.a
Compiling .pioenvs/hardwired-alarm-control/libcd4/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.c.o
Compiling .pioenvs/hardwired-alarm-control/libcd4/libsodium/crypto_stream/chacha20/ref/chacha20_ref.c.o
Compiling .pioenvs/hardwired-alarm-control/libcd4/libsodium/crypto_stream/chacha20/stream_chacha20.c.o
Compiling .pioenvs/hardwired-alarm-control/libcd4/libsodium/crypto_stream/crypto_stream.c.o
Compiling .pioenvs/hardwired-alarm-control/libcd4/libsodium/crypto_verify/sodium/verify.c.o
Compiling .pioenvs/hardwired-alarm-control/libcd4/libsodium/sodium/codecs.c.o
Compiling .pioenvs/hardwired-alarm-control/libcd4/libsodium/sodium/core.c.o
Compiling .pioenvs/hardwired-alarm-control/libcd4/libsodium/sodium/runtime.c.o
Compiling .pioenvs/hardwired-alarm-control/libcd4/libsodium/sodium/utils.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/backend/openssl/cipher-aesgcm.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/backend/ref/cipher-aesgcm.c.o
Archiving .pioenvs/hardwired-alarm-control/libb83/libUpdate.a
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/backend/ref/cipher-chachapoly.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/backend/ref/dh-curve25519.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/backend/ref/hash-blake2b.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/backend/ref/hash-blake2s.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/backend/ref/hash-sha256.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/backend/sodium/cipher-aesgcm.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/backend/sodium/cipher-chachapoly.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/backend/sodium/dh-curve25519.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/backend/sodium/hash-blake2b.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/backend/sodium/hash-sha256.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/crypto/aes/rijndael-alg-fst.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/crypto/blake2/blake2b.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/crypto/blake2/blake2s.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/crypto/chacha/chacha.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/crypto/donna/curve25519-donna-c64.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/crypto/donna/curve25519-donna.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/crypto/donna/poly1305-donna.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/crypto/sha2/sha256.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/crypto/sha2/sha512.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/crypto/x25519/x25519.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/protocol/cipherstate.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/protocol/dhstate.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/protocol/errors.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/protocol/handshakestate.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/protocol/hashstate.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/protocol/internal.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/protocol/names.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/protocol/patterns.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/protocol/rand_os.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/protocol/rand_sodium.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/protocol/randstate.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/protocol/signstate.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/protocol/symmetricstate.c.o
Compiling .pioenvs/hardwired-alarm-control/libef2/noise-c/protocol/util.c.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/Esp.cpp.o
Archiving .pioenvs/hardwired-alarm-control/libef2/libnoise-c.a
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/FirmwareMSC.cpp.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/FunctionalInterrupt.cpp.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/HWCDC.cpp.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/HardwareSerial.cpp.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/IPAddress.cpp.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/IPv6Address.cpp.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/MD5Builder.cpp.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/Print.cpp.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/Stream.cpp.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/StreamString.cpp.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/Tone.cpp.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/USB.cpp.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/USBCDC.cpp.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/USBMSC.cpp.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/WMath.cpp.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/WString.cpp.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/base64.cpp.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/cbuf.cpp.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/esp32-hal-adc.c.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/esp32-hal-bt.c.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/esp32-hal-cpu.c.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/esp32-hal-dac.c.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/esp32-hal-gpio.c.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/esp32-hal-i2c-slave.c.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/esp32-hal-i2c.c.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/esp32-hal-ledc.c.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/esp32-hal-matrix.c.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/esp32-hal-misc.c.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/esp32-hal-psram.c.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/esp32-hal-rgb-led.c.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/esp32-hal-rmt.c.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/esp32-hal-sigmadelta.c.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/esp32-hal-spi.c.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/esp32-hal-time.c.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/esp32-hal-timer.c.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/esp32-hal-tinyusb.c.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/esp32-hal-touch.c.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/esp32-hal-uart.c.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/firmware_msc_fat.c.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/libb64/cdecode.c.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/libb64/cencode.c.o
Archiving .pioenvs/hardwired-alarm-control/libcd4/libsodium.a
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/main.cpp.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/stdlib_noniso.c.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/wiring_pulse.c.o
Compiling .pioenvs/hardwired-alarm-control/FrameworkArduino/wiring_shift.c.o
Archiving .pioenvs/hardwired-alarm-control/libFrameworkArduino.a
Linking .pioenvs/hardwired-alarm-control/firmware.elf
RAM:   [=         ]  10.7% (used 34996 bytes from 327680 bytes)
Flash: [====      ]  36.0% (used 659697 bytes from 1835008 bytes)
Building .pioenvs/hardwired-alarm-control/firmware.bin
Creating esp32 image...
Successfully created esp32 image.
esp32_create_combined_bin([".pioenvs/hardwired-alarm-control/firmware.bin"], [".pioenvs/hardwired-alarm-control/firmware.elf"])
Wrote 0xb1620 bytes to file /config/.esphome/build/hardwired-alarm-control/.pioenvs/hardwired-alarm-control/firmware-factory.bin, ready to flash to offset 0x0
========================= [SUCCESS] Took 11.32 seconds =========================
INFO Successfully compiled program.
INFO Connecting to 192.168.0.22
INFO Uploading /config/.esphome/build/hardwired-alarm-control/.pioenvs/hardwired-alarm-control/firmware.bin (661024 bytes)
Uploading: [============================================================] 100% Done...

INFO Upload took 7.25 seconds, waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from 192.168.0.22 using esphome API
WARNING Can't connect to ESPHome API for hardwired-alarm-control @ 192.168.0.22: Timeout while connecting to [AddrInfo(family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>, proto=6, sockaddr=IPv4Sockaddr(address='192.168.0.22', port=6053))] (TimeoutAPIError)
INFO Trying to connect to hardwired-alarm-control @ 192.168.0.22 in the background

Am I the first person to use Ethernet with ESPHome? Surely not! :crazy_face:

I continue shooting in the dark with uneducated guesswork.

  1. As the ‘cannot connect’ problem seemed to be a DNS issue, I tried specifying a static IP address. That got me apparently a step closer as the log file initially says it is connected. But then it goes on to timeout in communicating with the device.

  2. Since the W5500 datasheet says it works at a clock speed of 80MHz and the ESPHome documentation says it defaults to 26.67MHz, I tried specifying 80MHz. This gives me logging errors saying it cannot work that fast in duplex mode, but also saying that the system will find the best speed for the device – which is not what the documentation says. This is not the main issue for me at the moment so I just reverted to the default.

  3. I was curious what happens if the ‘optional’ Reset (RST) and Interrupt (INT) pins are not specified. The result was a series of ‘GPIO number’ errors. So apparently these pins are used and are therefore not optional. I put them back in the config.

  4. After reverting to config 1, I tried access the API from a browser at 192.168.0.42:6053. This said ‘unreachable’. I also tried the OTA port 192.168.0.42:3232. This one timed out.

  5. Curious to know if software can (in principle) be loaded via the Ethernet, I tried doing that. It tried, from which I infer that the feature exists and ‘OTA’ means not only over the air but also over Ethernet.

So what should I try next?
Please help if you know anything about Ethernet in ESPHome :pray:

Below are the config for situation 1 above (RST and INT specified, default clock, static IP), and the log files from the installation and the attempt to load the program OTA, at point 5 above.

Configuration file:

esphome:
  name: hardwired-alarm-control
  friendly_name: Hardwired alarm control 

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "BKVgvPgWeTB9FUDehvoT8JWCH/iEcpIDnG4hGd6OACY="

ota:
  password: "1e78adf2c5aa91872a69e7594a033450"

### WIFI OPTION 

#wifi:
#  networks:
#  - ssid: !secret wifi1_ssid
#    password: !secret wifi1_password
#  - ssid: !secret wifi2_ssid
#    password: !secret wifi2_password

# Enable fallback hotspot (captive portal) in case wifi connection fails
#  ap:
#    ssid: "Hardwired-Alarm-Control"
#    password: "WTBhxg7Am4rh"

#captive_portal:


### ETHERNET OPTION 
ethernet:
  type: W5500
  cs_pin: 18
  clk_pin: 19
  mosi_pin: 21
  miso_pin: 23
  reset_pin: 22
  interrupt_pin: 36
# clock_speed: 80MHz

  # Manual IP
  manual_ip:
    static_ip: 192.168.0.42
    gateway: 192.168.0.1
    subnet: 255.255.255.0

### 

# (goes on to specify I/O, not relevant here)

Installation log:

[10:11:46]ets Jul 29 2019 12:21:46
[10:11:46]
[10:11:46]rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[10:11:46]configsip: 0, SPIWP:0xee
[10:11:46]clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[10:11:46]mode:DIO, clock div:2
[10:11:46]load:0x3fff0030,len:1184
[10:11:46]load:0x40078000,len:13132
[10:11:46]load:0x40080400,len:3036
[10:11:46]entry 0x400805e4
[10:11:46][I][logger:158]: Log initialized
[10:11:46][C][ota:483]: There have been 0 suspected unsuccessful boot attempts.
[10:11:46][D][esp32.preferences:114]: Saving 1 preferences to flash...
[10:11:46][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[10:11:46][I][app:029]: Running through setup()...
[10:11:46][D][binary_sensor:034]: 'Hardwired Alarm Control CCL1': Sending initial state ON
[10:11:46][D][binary_sensor:034]: 'Hardwired Alarm Control CCL2': Sending initial state ON
[10:11:46][D][binary_sensor:034]: 'Hardwired Alarm Control CCL3': Sending initial state ON
[10:11:46][D][binary_sensor:034]: 'Hardwired Alarm Control CCL4': Sending initial state ON
[10:11:46][D][binary_sensor:034]: 'Hardwired Alarm Control CCL5': Sending initial state ON
[10:11:46][D][binary_sensor:034]: 'Hardwired Alarm Control CCL6': Sending initial state ON
[10:11:46][D][binary_sensor:034]: 'Hardwired Alarm Control CCL7': Sending initial state ON
[10:11:46][D][binary_sensor:034]: 'Hardwired Alarm Control CCL8': Sending initial state ON
[10:11:46][D][binary_sensor:034]: 'Hardwired Alarm Control Global AT': Sending initial state ON
[10:11:46][D][binary_sensor:034]: 'Hardwired Alarm Control Sounder TA': Sending initial state ON
[10:11:46][C][switch.gpio:011]: Setting up GPIO Switch 'Hardwired Alarm Control Output 1'...
[10:11:46][D][switch:016]: 'Hardwired Alarm Control Output 1' Turning OFF.
[10:11:46][D][switch:055]: 'Hardwired Alarm Control Output 1': Sending state OFF
[10:11:46][D][switch:016]: 'Hardwired Alarm Control Output 1' Turning OFF.
[10:11:46][C][switch.gpio:011]: Setting up GPIO Switch 'Hardwired Alarm Control Output 2'...
[10:11:46][D][switch:016]: 'Hardwired Alarm Control Output 2' Turning OFF.
[10:11:46][D][switch:055]: 'Hardwired Alarm Control Output 2': Sending state OFF
[10:11:46][D][switch:016]: 'Hardwired Alarm Control Output 2' Turning OFF.
[10:11:46][C][ethernet:034]: Setting up Ethernet...
[10:11:46][I][ethernet:220]: Starting ethernet connection
[10:11:46][W][component:157]: Component ethernet set Warning flag: unspecified
[10:11:46][D][esp-idf:000]: E (1591) w5500.mac: w5500_send_command(123): send command timeout

[10:11:46][D][esp-idf:000]: E (1591) w5500.mac: emac_w5500_transmit(534): issue SEND command failed

[10:11:46][D][esp-idf:000]: E (1704) w5500.mac: w5500_send_command(123): send command timeout

[10:11:46][D][esp-idf:000]: E (1704) w5500.mac: emac_w5500_transmit(534): issue SEND command failed

[10:11:46][I][ethernet:231]: Connected via Ethernet!
[10:11:46][C][ethernet:467]:   IP Address: 192.168.0.42
[10:11:46][C][ethernet:468]:   Hostname: 'hardwired-alarm-control'
[10:11:46][C][ethernet:469]:   Subnet: 255.255.255.0
[10:11:46][C][ethernet:470]:   Gateway: 192.168.0.1
[10:11:46][C][ethernet:475]:   DNS1: 0.0.0.0
[10:11:46][C][ethernet:476]:   DNS2: 0.0.0.0
[10:11:46][C][ethernet:493]:   MAC Address: E0:5A:1B:76:61:A3
[10:11:46][C][ethernet:498]:   Is Full Duplex: YES
[10:11:46][C][ethernet:503]:   Link Speed: 10
[10:11:46][W][component:170]: Component ethernet cleared Warning flag
[10:11:46][C][ota:096]: Over-The-Air Updates:
[10:11:46][C][ota:097]:   Address: 192.168.0.42:3232
[10:11:46][C][ota:100]:   Using Password.
[10:11:46][C][ota:103]:   OTA version: 2.
[10:11:46][C][api:025]: Setting up Home Assistant API server...
[10:11:46][I][app:062]: setup() finished successfully!
[10:11:46][W][component:157]: Component api set Warning flag: unspecified
[10:11:46][I][app:100]: ESPHome version 2024.4.1 compiled on May  6 2024, 10:08:20
[10:11:46][C][logger:166]: Logger:
[10:11:46][C][logger:167]:   Level: DEBUG
[10:11:46][C][logger:169]:   Log Baud Rate: 115200
[10:11:46][C][logger:170]:   Hardware UART: UART0
[10:11:46][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Hardwired Alarm Control CCL1'
[10:11:46][C][gpio.binary_sensor:016]:   Pin: GPIO32
[10:11:46][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Hardwired Alarm Control CCL2'
[10:11:46][C][gpio.binary_sensor:016]:   Pin: GPIO33
[10:11:46][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Hardwired Alarm Control CCL3'
[10:11:46][C][gpio.binary_sensor:016]:   Pin: GPIO25
[10:11:46][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Hardwired Alarm Control CCL4'
[10:11:46][C][gpio.binary_sensor:016]:   Pin: GPIO26
[10:11:46][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Hardwired Alarm Control CCL5'
[10:11:46][C][gpio.binary_sensor:016]:   Pin: GPIO27
[10:11:46][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Hardwired Alarm Control CCL6'
[10:11:46][C][gpio.binary_sensor:016]:   Pin: GPIO14
[10:11:46][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Hardwired Alarm Control CCL7'
[10:11:46][C][gpio.binary_sensor:016]:   Pin: GPIO13
[10:11:46][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Hardwired Alarm Control CCL8'
[10:11:46][C][gpio.binary_sensor:016]:   Pin: GPIO15
[10:11:46][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Hardwired Alarm Control Global AT'
[10:11:46][C][gpio.binary_sensor:016]:   Pin: GPIO4
[10:11:46][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Hardwired Alarm Control Sounder TA'
[10:11:46][C][gpio.binary_sensor:016]:   Pin: GPIO5
[10:11:46][C][switch.gpio:068]: GPIO Switch 'Hardwired Alarm Control Output 1'
[10:11:46][C][switch.gpio:091]:   Restore Mode: always OFF
[10:11:46][C][switch.gpio:031]:   Pin: GPIO17
[10:11:46][C][switch.gpio:068]: GPIO Switch 'Hardwired Alarm Control Output 2'
[10:11:46][C][switch.gpio:091]:   Restore Mode: always OFF
[10:11:46][C][switch.gpio:031]:   Pin: GPIO16
[10:11:46][C][ethernet:294]: Ethernet:
[10:11:46][C][ethernet:467]:   IP Address: 192.168.0.42
[10:11:46][C][ethernet:468]:   Hostname: 'hardwired-alarm-control'
[10:11:46][C][ethernet:469]:   Subnet: 255.255.255.0
[10:11:46][C][ethernet:470]:   Gateway: 192.168.0.1
[10:11:46][C][ethernet:475]:   DNS1: 0.0.0.0
[10:11:46][C][ethernet:476]:   DNS2: 0.0.0.0
[10:11:46][C][ethernet:493]:   MAC Address: E0:5A:1B:76:61:A3
[10:11:46][C][ethernet:498]:   Is Full Duplex: YES
[10:11:46][C][ethernet:503]:   Link Speed: 10
[10:11:46][C][ethernet:297]:   CLK Pin: 19
[10:11:46][C][ethernet:298]:   MISO Pin: 23
[10:11:46][C][ethernet:299]:   MOSI Pin: 21
[10:11:46][C][ethernet:300]:   CS Pin: 18
[10:11:46][C][ethernet:301]:   IRQ Pin: 36
[10:11:46][C][ethernet:302]:   Reset Pin: 22
[10:11:46][C][ethernet:303]:   Clock Speed: 26 MHz
[10:11:46][C][ethernet:312]:   Type: W5500
[10:11:46][C][mdns:115]: mDNS:
[10:11:46][C][mdns:116]:   Hostname: hardwired-alarm-control
[10:11:46][C][ota:096]: Over-The-Air Updates:
[10:11:46][C][ota:097]:   Address: 192.168.0.42:3232
[10:11:46][C][ota:100]:   Using Password.
[10:11:46][C][ota:103]:   OTA version: 2.
[10:11:46][C][api:139]: API Server:
[10:11:46][C][api:140]:   Address: 192.168.0.42:6053
[10:11:46][C][api:142]:   Using noise encryption: YES
[10:11:46][D][esp-idf:000]: E (3070) w5500.mac: w5500_send_command(123): send command timeout

[10:11:46][D][esp-idf:000]: E (3070) w5500.mac: emac_w5500_transmit(534): issue SEND command failed

[10:11:46][D][esp-idf:000]: E (4271) w5500.mac: w5500_send_command(123): send command timeout

[10:11:46][D][esp-idf:000]: E (4271) w5500.mac: emac_w5500_transmit(534): issue SEND command failed

[10:11:52][D][esp-idf:000]: E (22658) w5500.mac: w5500_send_command(123): send command timeout

[10:11:52][D][esp-idf:000]: E (22658) w5500.mac: emac_w5500_receive(578): issue RECV command failed

[10:12:31][D][esp-idf:000]: E (61484) w5500.mac: w5500_send_command(123): send command timeout

[10:12:31][D][esp-idf:000]: E (61484) w5500.mac: emac_w5500_transmit(534): issue SEND command failed


Log from attempt to load firmware over the network:

INFO ESPHome 2024.4.1
INFO Reading configuration /config/hardwired-alarm-control.yaml...
WARNING GPIO15 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
WARNING GPIO5 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
INFO Generating C++ source...
INFO Compiling app...
Processing hardwired-alarm-control (board: esp32dev; framework: arduino; platform: platformio/[email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
Dependency Graph
|-- WiFi @ 2.0.0
|-- ESPmDNS @ 2.0.0
|-- Update @ 2.0.0
|-- noise-c @ 0.1.4
RAM:   [=         ]  10.7% (used 34996 bytes from 327680 bytes)
Flash: [====      ]  36.0% (used 659833 bytes from 1835008 bytes)
========================= [SUCCESS] Took 2.07 seconds =========================
INFO Successfully compiled program.
INFO Connecting to 192.168.0.42
ERROR Connecting to 192.168.0.42:3232 failed: [Errno 113] No route to host

I have this Olimex ESP32-POE: ESP32-POE - Open Source Hardware Board
There is a schematic in the link if you want to see how it’s hooked up.

I use this in ESPHome as a BLE Tracker, here is the relevant part:

ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO17_OUT
  phy_addr: 0
  power_pin: GPIO12


  # Optional manual IP
  manual_ip:
    static_ip: AA.BB.128.206
    gateway: AA.BB.128.1
    subnet: 255.255.254.0

It works fine for me:

[19:56:55][C][ethernet:294]: Ethernet:
[19:56:55][C][ethernet:467]:   IP Address: AA.BB.128.206
[19:56:55][C][ethernet:468]:   Hostname: 'bletracker1'
[19:56:55][C][ethernet:469]:   Subnet: 255.255.254.0
[19:56:55][C][ethernet:470]:   Gateway: AA.BB.128.1
[19:56:55][C][ethernet:475]:   DNS1: 0.0.0.0
[19:56:55][C][ethernet:476]:   DNS2: 0.0.0.0
[19:56:55][C][ethernet:493]:   MAC Address: (REDACTED)
[19:56:55][C][ethernet:498]:   Is Full Duplex: YES
[19:56:55][C][ethernet:503]:   Link Speed: 100
[19:56:55][C][ethernet:306]:   Power Pin: 12
[19:56:55][C][ethernet:308]:   MDC Pin: 23
[19:56:55][C][ethernet:309]:   MDIO Pin: 18
[19:56:55][C][ethernet:310]:   PHY addr: 0
[19:56:55][C][ethernet:312]:   Type: LAN8720
[19:56:55][C][mdns:115]: mDNS:
[19:56:55][C][mdns:116]:   Hostname: bletracker1
[19:56:55][C][ota:096]: Over-The-Air Updates:
[19:56:55][C][ota:097]:   Address: AA.BB.128.206:3232
[19:56:55][C][ota:100]:   Using Password.
[19:56:55][C][ota:103]:   OTA version: 2.
[19:56:55][C][api:139]: API Server:
[19:56:55][C][api:140]:   Address: AA.BB.128.206:6053
[19:56:55][C][api:142]:   Using noise encryption: YES

(have replaced bits of my IP range and the MAC to obscure a bit about my network).

If you want to specify DNS in there, you can do this under manual_ip.

Hopefully this helps you achieve Ethernet with your W5500

Thanks very much for responding :slightly_smiling_face:

I am very glad your setup works. It looks very similar to mine, except I have the w5500 chip.

Could you explain what you mean by specifying the DNS in the manual_ip section?

I am not sure that that is the problem though. The log file says it is connecting initially, but then times out subsequent requests.

I have a 38 pin esp32 with esphome firmware and a w5500 ethernet module but I can’t get it for work :confused:. I connected the pins togetherb but the editing the settings don’t work. Can you help me?

Looks like you have a more fundamental config problem. You need to hover on the red underlined text to see what the problem is.

Please let me know if it then works for you, or you get further in the process. I got through config, compile and load OK – my problem is that The LAN interface does not respond after it is set up.

Try posting the log file for the experts to look at, and perhaps we can see if our problems are similar.

Crossing my fingers for both of us :crossed_fingers: :laughing: