Any ideas on this one please, I just flashed a MJ 3way switch ST01. It works fine when it was flashed via serial, reboots just fine and connects every time. If I do any kind of OTA update it dies, the device stops functioning full stop, no connection to wifi. The local button does nothing, if I reflash again via serial it comes back to life and works as intended. Running the current ESP home version.
Debug from the OTA
INFO Reading configuration /config/esphome/outside-light-switch.yaml...
INFO Detected timezone 'America/New_York'
INFO Generating C++ source...
INFO Compiling app...
Processing outside-light-switch (board: esp01_1m; framework: arduino; platform: platformio/espressif8266 @ 3.2.0)
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
Dependency Graph
|-- <ESPAsyncTCP-esphome> 1.2.3
|-- <ESPAsyncWebServer-esphome> 2.1.0
| |-- <ESPAsyncTCP-esphome> 1.2.3
| |-- <Hash> 1.0
| |-- <ESP8266WiFi> 1.0
|-- <DNSServer> 1.1.1
|-- <ESP8266WiFi> 1.0
|-- <ESP8266mDNS> 1.2
|-- <ArduinoJson> 6.18.5
Compiling /data/outside-light-switch/.pioenvs/outside-light-switch/src/main.cpp.o
Linking /data/outside-light-switch/.pioenvs/outside-light-switch/firmware.elf
RAM: [==== ] 41.4% (used 33920 bytes from 81920 bytes)
Flash: [===== ] 45.1% (used 461665 bytes from 1023984 bytes)
Building /data/outside-light-switch/.pioenvs/outside-light-switch/firmware.bin
esp8266_copy_factory_bin(["/data/outside-light-switch/.pioenvs/outside-light-switch/firmware.bin"], ["/data/outside-light-switch/.pioenvs/outside-light-switch/firmware.elf"])
========================= [SUCCESS] Took 14.17 seconds =========================
INFO Successfully compiled program.
INFO Resolving IP address of outside-light-switch.local
INFO -> 192.168.30.16
INFO Uploading /data/outside-light-switch/.pioenvs/outside-light-switch/firmware.bin (465824 bytes)
INFO Compressed to 321301 bytes
Uploading: [============================================================] 100% Done...
INFO Waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from outside-light-switch.local using esphome API
WARNING Can't connect to ESPHome API for outside-light-switch.local: Error resolving IP address: [Errno -2] Name or service not known
INFO Trying to reconnect to outside-light-switch.local in the background
Debug from the ESP via serial until it dies
[11:30:55][D][ota:139]: Starting OTA Update from 192.168.1.10...
[11:30:55][D][ota:308]: OTA in progress: 0.3%
[11:30:56][D][ota:308]: OTA in progress: 38.4%
[11:30:57][D][ota:308]: OTA in progress: 77.9%
[11:30:58][I][ota:341]: OTA update finished!
[11:30:58][I][app:133]: Rebooting safely...
[11:30:58][W][wifi_esp8266:482]: Event: Disconnected ssid='NoT - WiFi' bssid=7A:45:58:27:6B:29 reason='Association Leave'
[11:30:58]
[11:30:58] ets Jan 8 2013,rst cause:1, boot mode:(3,0)
[11:30:58]
[11:30:58]load 0x4010f000, len 3460, room 16
[11:30:58]tail 4
[11:30:58]chksum 0xcc
[11:30:58]load 0x3fff20b8, len 40, room 4
[11:30:58]tail 4
[11:30:58]chksum 0xc9
[11:30:58]csum 0xc9
[11:30:58]v00071ba0
[11:31:06]@cp:0
[11:31:06]ld
[11:31:06]e:3
[11:31:06] ets Jan 8 2013,rst cause:3, boot mode:(3,0)
[11:31:06]
I always get that warning at the end of an OTA upload, then about 30-seconds later, it connects:
WARNING Can't connect to ESPHome API for thermometer.local: Error resolving IP address: [Errno -2] Name or service not known
INFO Trying to reconnect to thermometer.local in the background
30-seconds later…
INFO Successfully connected to thermometer.local
[18:49:52][I][app:102]: ESPHome version 2022.3.2 compiled on Apr 14 2022, 16:15:49
[18:49:52][C][wifi:491]: WiFi:
[18:49:52][C][wifi:353]: Local MAC: 58:BF:25:DA:F5:A2
[18:49:52][C][wifi:354]: SSID: [redacted]
[18:49:52][C][wifi:355]: IP Address: 192.168.1.157
[18:49:52][C][wifi:356]: BSSID: [redacted]
[18:49:52][C][wifi:358]: Hostname: 'thermometer'
[18:49:52][C][wifi:360]: Signal strength: -43 dB ▂▄▆█
OK. I had a similar experience when I started using ESPHome. I could use ESPhome Flasher but not OTA. People here laughed at my solution, but you may try it.
Based on my experience with OTA in the Arduino, if my program approaches 50% of the available memory on the board, OTA would not work. If the bin file plus the OTA overhead exceeds 50%, you may be overwriting the current code.
As I said, this is all conjecture and unproven. But, here’s how I fixed it…
I removed ap: and captive_portal: from my YAM, which reduced the ram used. Then I could OTA to that device.
That was about a year ago. I found this page in the docs. The docs point to this link for a list of ESP boards.
Thank you for the suggestions, not had much time to spend on this was hoping it would just work !
I should have mentioned the yaml wasn’t mine I copied it from another post. Also I could have done a better job of my comments, when I said reboot I was meaning a full power cycle.
@stevemann 1st I tried striking out the ap: and captive_portal: this reduced files size by a couple of k but made no difference to the behavior after a reflash. I also tried esp_wroom_02 this loaded once then I suffered from a continues “boot exception 0” errors and I though it was toast as even going back to my original file wouldn’t recover it. Even tried a new stripped out base config - still the same.
I have ordered a 2nd device as I do want more of these switches - wondering if I have a bad ESP chip or something.
Thanks for the suggestions - I’m going to put this one down to a poor power supply. I seem to have it running stable now all OTA flashes have been successful