Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Update via Ethernet with OTA
#1
In the specification https://esphome.io/components/ota.html it is stated "In that mode, all components are disabled and only Serial Logging + Network(WiFi or Ethernet) + OTA are initialized, so that you can upload a new binary ."

I have an A16 integrated with HomeAssistant. In ESPHome  new version of YAML can be downloaded to the A16 without any problems via USB cable. Update via Ethernet cable (same network, WiFi not available) ends with an error.

Is it possible to install the update via Ethernet? Please could you send me the OTA code for the YAML file of the A16 device?


Attached Files Image(s)
       
Reply
#2
OTA means (Over The Air) . use by wifi.
here is details: https://esphome.io/components/ota.html
for example, if you create a new board "aaa" in ESPHome, that default enabled OTA:


esphome:
name: aaa
friendly_name: aaa

esp32:
board: esp32dev
framework:
type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
encryption:
key: "BuaN05EoLtK4ZR+FNhlQmAGVSk7omzGlcjEEtbgZst8="

ota:
password: "2be8fee6977896009887933fa3b89529"

wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password

# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Aaa Fallback Hotspot"
password: "yz1B8CHcDdWd"

captive_portal:
Reply
#3
Hi,

I bought an A16 to use as my security system (connected to Home Assistant), because it has Ethernet which is immune to Wi-Fi jamming.

I knew thanks to this thread that OTA only worked with WiFi, so my plan was to leave both interfaces up: Ethernet with IP address A for daily (alarm) use and Wi-Fi with IP address B when I need to send an update via OTA.

However, when I try to configure both in ESPHome, I am getting this error:

   

:-(


How can I update the A16 once installed and use it on Ethernet ? (the A16 will be enclosed in a ceiling, so USB will not be an option once installed)


Kind regards,


Vincent
Reply
#4
(06-12-2024, 07:14 AM)admin Wrote: OTA means (Over The Air) . use by wifi.
here is details: https://esphome.io/components/ota.html

Well, the page https://esphome.io/components/ota.html explicitly says:

"ESPHome’s Over-The-Air (OTA) platform allows you to remotely install modified/updated firmware binaries onto your ESPHome devices over their network (Wi-Fi or Ethernet) interface."

So does it work via Ethernet ?

Vincent
Reply
#5
(06-12-2024, 07:14 AM)admin Wrote: OTA means (Over The Air) . use by wifi.
here is details: https://esphome.io/components/ota.html

Err...
The link you posted says " ESPHome’s Over-The-Air (OTA) platform allows you to remotely install modified/updated firmware binaries onto your ESPHome devices over their network (Wi-Fi or Ethernet) interface." Huh

So I tried and... it works !

What I did:

1) Setup the board in HomeAssistant with WiFi, and checked that the integration (inputs/outputs) worked.

2) Connected an Ethernet cable (green led on Ethernet port was off)

3) Removed the WiFi section from my YAML file and put the following Ethernet section:
Code:
ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO17_OUT
  phy_addr: 0

4) Updated the device with that configuration via OTA (one last time "Wirelessly"):

   

5) Once Ethernet was active (green led on Ethernet port is flashing), checked the integration (inputs/outputs) again: works fine.

6) Tried again updating the device with that configuration via OTA (this time, it says "Via the network"):

   

!! It worked !! Smile

Here is the log:
Code:
INFO ESPHome 2024.12.4
INFO Reading configuration /config/esphome/esphome-web-a522e0.yaml...
INFO Generating C++ source...
INFO Updating https://github.com/espressif/esp-protocols.git@mdns-v1.3.2
INFO Compiling app...
Processing kc868-a16 (board: esp32dev; framework: espidf; platform: https://github.com/pioarduino/platform-espressif32.git#51.03.07)
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
- framework-espidf @ 3.50105.0 (5.1.5)
- tool-cmake @ 3.21.3
- tool-esptoolpy @ 4.8.1
- tool-mklittlefs @ 3.2.0
- tool-ninja @ 1.10.2
- tool-riscv32-esp-elf-gdb @ 12.1.0+20221002
- tool-xtensa-esp-elf-gdb @ 12.1.0+20221002
- toolchain-esp32ulp @ 2.35.0-20220830
- toolchain-xtensa-esp32 @ 12.2.0+20230208
Reading CMake configuration...
Dependency Graph
|-- noise-c @ 0.1.6
RAM:   [          ]   4.6% (used 15004 bytes from 327680 bytes)
Flash: [===       ]  29.9% (used 547805 bytes from 1835008 bytes)
========================= [SUCCESS] Took 18.00 seconds =========================
INFO Successfully compiled program.
INFO Connecting to 192.168.0.59 port 3232...                                                <<<<<<<<<<   Flashing through Ethernet 192.168.0.59
INFO Connected to 192.168.0.59
INFO Uploading /data/build/kc868-a16/.pioenvs/kc868-a16/firmware.bin (548176 bytes)
Uploading: [============================================================] 100% Done...
INFO Upload took 1.90 seconds, waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from 192.168.0.59 using esphome API
INFO Successfully connected to kc868-a16 @ 192.168.0.59 in 3.073s                           <<<<<<<<<<   Reconnected to get logs through Ethernet 192.168.0.59
INFO Successful handshake with kc868-a16 @ 192.168.0.59 in 0.113s
[12:24:45][I][app:100]: ESPHome version 2024.12.4 compiled on Jan 19 2025, 12:07:50
[12:24:45][C][logger:185]: Logger:
[12:24:45][C][logger:186]:   Level: DEBUG
[12:24:45][C][logger:188]:   Log Baud Rate: 115200
[12:24:45][C][logger:189]:   Hardware UART: UART0
[12:24:45][C][i2c.idf:075]: I2C Bus:
[12:24:45][C][i2c.idf:076]:   SDA Pin: GPIO4
[12:24:45][C][i2c.idf:077]:   SCL Pin: GPIO5
[12:24:45][C][i2c.idf:078]:   Frequency: 50000 Hz
[12:24:45][C][i2c.idf:084]:   Recovery: bus successfully recovered
[12:24:45][I][i2c.idf:094]: Results from i2c bus scan:
[12:24:45][I][i2c.idf:100]: Found i2c device at address 0x21
[12:24:45][I][i2c.idf:100]: Found i2c device at address 0x22
[12:24:45][I][i2c.idf:100]: Found i2c device at address 0x24
[12:24:45][I][i2c.idf:100]: Found i2c device at address 0x25
[12:24:45][C][uart.idf:159]: UART Bus 1:
[12:24:45][C][uart.idf:160]:   TX Pin: GPIO13
[12:24:45][C][uart.idf:161]:   RX Pin: GPIO16
[12:24:45][C][uart.idf:163]:   RX Buffer Size: 256
[12:24:45][C][uart.idf:165]:   Baud Rate: 9600 baud
[12:24:45][C][uart.idf:166]:   Data Bits: 8
[12:24:45][C][uart.idf:167]:   Parity: NONE
[12:24:45][C][uart.idf:168]:   Stop bits: 1
[12:24:45][C][pcf8574:021]: PCF8574:
[12:24:45][C][pcf8574:022]:   Address: 0x22
[12:24:45][C][pcf8574:023]:   Is PCF8575: NO
[12:24:45][C][pcf8574:021]: PCF8574:
[12:24:45][C][pcf8574:022]:   Address: 0x21
[12:24:45][C][pcf8574:023]:   Is PCF8575: NO
[12:24:45][C][pcf8574:021]: PCF8574:
[12:24:45][C][pcf8574:022]:   Address: 0x24
[12:24:45][C][pcf8574:023]:   Is PCF8575: NO
[12:24:45][C][pcf8574:021]: PCF8574:
[12:24:45][C][pcf8574:022]:   Address: 0x25
[12:24:45][C][pcf8574:023]:   Is PCF8575: NO
[12:24:45][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'KC868-A16-HT1'
[12:24:45][C][gpio.binary_sensor:016]:   Pin: GPIO32
[12:24:45][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'KC868-A16-HT2'
[12:24:45][C][gpio.binary_sensor:016]:   Pin: GPIO33
[12:24:45][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'KC868-A16-HT3'
[12:24:45][C][gpio.binary_sensor:016]:   Pin: GPIO14
[12:24:45][D][api:103]: Accepted 192.168.0.44
[12:24:45][W][component:237]: Component api took a long time for an operation (55 ms).
[12:24:45][W][component:238]: Components should block for at most 30 ms.
[12:24:45][D][api.connection:1446]: Home Assistant 2025.1.2 (192.168.0.44): Connected successfully
[12:24:45][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'KC868-A16-X01'
[12:24:45][C][gpio.binary_sensor:016]:   Pin: 0 via PCF8574
[12:24:45][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'KC868-A16-X02'
[12:24:45][C][gpio.binary_sensor:016]:   Pin: 1 via PCF8574
[...]
[12:24:46][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'KC868-A16-X15'
[12:24:46][C][gpio.binary_sensor:016]:   Pin: 6 via PCF8574
[12:24:46][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'KC868-A16-X16'
[12:24:46][C][gpio.binary_sensor:016]:   Pin: 7 via PCF8574
[12:24:46][C][switch.gpio:068]: GPIO Switch 'KC868-A16-Y01'
[12:24:46][C][switch.gpio:090]:   Restore Mode: always OFF
[12:24:46][C][switch.gpio:031]:   Pin: 0 via PCF8574
[12:24:46][C][switch.gpio:068]: GPIO Switch 'KC868-A16-Y02'
[12:24:46][C][switch.gpio:090]:   Restore Mode: always OFF
[12:24:46][C][switch.gpio:031]:   Pin: 1 via PCF8574
[...]
[12:24:46][C][switch.gpio:068]: GPIO Switch 'KC868-A16-Y15'
[12:24:46][C][switch.gpio:090]:   Restore Mode: always OFF
[12:24:46][C][switch.gpio:031]:   Pin: 6 via PCF8574
[12:24:46][C][switch.gpio:068]: GPIO Switch 'KC868-A16-Y16'
[12:24:46][C][switch.gpio:090]:   Restore Mode: always OFF
[12:24:46][C][switch.gpio:031]:   Pin: 7 via PCF8574
[12:24:46][C][remote_receiver.esp32:064]: Remote Receiver:
[12:24:46][C][remote_receiver.esp32:065]:   Pin: GPIO2
[12:24:46][C][remote_receiver.esp32:070]:   Channel: 0
[12:24:46][C][remote_receiver.esp32:071]:   RMT memory blocks: 3
[12:24:46][C][remote_receiver.esp32:072]:   Clock divider: 80
[12:24:46][C][remote_receiver.esp32:073]:   Tolerance: 25%
[12:24:46][C][remote_receiver.esp32:075]:   Filter out pulses shorter than: 50 us
[12:24:46][C][remote_receiver.esp32:076]:   Signal is done after 10000 us of no changes
[12:24:46][C][remote_transmitter:015]: Remote Transmitter...
[12:24:46][C][remote_transmitter:016]:   Channel: 3
[12:24:46][C][remote_transmitter:017]:   RMT memory blocks: 1
[12:24:46][C][remote_transmitter:018]:   Clock divider: 80
[12:24:46][C][remote_transmitter:019]:   Pin: GPIO15
[12:24:46][C][ethernet:326]: Ethernet:
[12:24:46][C][ethernet:515]:   IP Address: 192.168.0.59                                     <<<<<<<<<< 192.168.0.59 is indeed the Ethernet connexion
[12:24:46][C][ethernet:516]:   Hostname: 'kc868-a16'
[12:24:46][C][ethernet:517]:   Subnet: 255.255.252.0
[12:24:46][C][ethernet:518]:   Gateway: 192.168.0.1
[12:24:46][C][ethernet:523]:   DNS1: 212.224.129.90
[12:24:46][C][ethernet:524]:   DNS2: 212.224.129.94
[12:24:46][C][ethernet:536]:   MAC Address: 3C:8A:1F:A5:22:E0
[12:24:46][C][ethernet:537]:   Is Full Duplex: YES
[12:24:46][C][ethernet:538]:   Link Speed: 100
[12:24:46][C][ethernet:347]:   MDC Pin: 23
[12:24:46][C][ethernet:348]:   MDIO Pin: 18
[12:24:46][C][ethernet:349]:   PHY addr: 0
[12:24:46][C][ethernet:351]:   Type: LAN8720
[12:24:46][C][mdns:116]: mDNS:
[12:24:46][C][mdns:117]:   Hostname: kc868-a16
[12:24:46][C][esphome.ota:073]: Over-The-Air updates:
[12:24:46][C][esphome.ota:074]:   Address: kc868-a16.local:3232
[12:24:46][C][esphome.ota:075]:   Version: 2
[12:24:46][C][esphome.ota:078]:   Password configured
[12:24:46][C][safe_mode:018]: Safe Mode:
[12:24:46][C][safe_mode:019]:   Boot considered successful after 60 seconds
[12:24:46][C][safe_mode:021]:   Invoke after 10 boot attempts
[12:24:46][C][safe_mode:022]:   Remain in safe mode for 300 seconds
[12:24:46][C][api:140]: API Server:
[12:24:46][C][api:141]:   Address: kc868-a16.local:6053
[12:24:46][C][api:143]:   Using noise encryption: YES
[12:25:41][I][safe_mode:041]: Boot seems successful; resetting boot loop counter
[12:25:41][D][esp32.preferences:114]: Saving 1 preferences to flash...
[12:25:41][D][esp32.preferences:142]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed

So I m very happy about this excellent product Smile , but I don't understand why your first reply was"WiFi only" Huh ...

Kind regards,


Vincent
Reply
#6
wifi and ethernet can't work at the same time, NOT wifi only.
Reply
#7
Thanks for the reply.

(01-19-2025, 11:56 PM)admin Wrote: wifi and ethernet can't work at the same time.

Indeed.
And YAML with only ethernet declaration also works with "ota". 

That's great !

Vincent
Reply
#8
ok
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)