KaufHA/PLF10

ESPHome updates failing with older plugs; gzip and OTA update OK

Closed this issue · 3 comments

Current: Home Assistant 2022.12.7 Supervisor 2022.11.2 Frontend 20221213.1 - latest
ESPHome versions 12.1, 12.2. 12.3 (and earlier versions of HA to match ESPHome)
Firmware version 2.02(y) made using ESPHome version 2022.12.3 (last test)

Updates used to 'just work'. It seems that with the ESPHome 12.x versions, wireless update of two older PLF10 plugs bought Sep 2021 and Nov 2021 hangs and fails. Example:

========================= [SUCCESS] Took 44.50 seconds =========================
INFO Successfully compiled program.
INFO Connecting to w.x.y.z
INFO Uploading /data/nitelite-plug/.pioenvs/nitelite-plug/firmware.bin (551632 bytes)
INFO Compressed to 375434 bytes
Uploading: [===============================================             ] 79% 
ERROR Error sending data: timed out

When I save the firmware.bin file locally, gzip it, and visit the device webpage, upload the firmware.bin.gz file, the update is successful. File sizes of uncompressed and compressed files report the same using either method. It seems the timeout might be because the older PLF10s can't fit the new version, even if compressed, using the ESPHome interface (wild guess).

I cleaned the installation directory; same result.

This does add an extra layer of 'work' having to compile, compress, and OTA upload the compressed firmware manually for those two plugs, instead of just update all when a new version of ESPHome comes up. Not a big deal, functionally there is no issue.

Wireless update of recent (Jun 2022) PLF10 updates just fine from ESPHome HA page.

Any thoughts on why the ESPHome update method might be giving me grief? Does the age of the PLF10s have anything to do with this?

I don't think the age of the hardware would matter at all. It's something to do with the current firmware existing on the plug I would think. I'll have to think about it. Does it work through the dashboard now that you've manually flashed a gzip?

All three PFL10 are upated to Firmware version 2.02(y) made using ESPHome version 2022.12.3

If I go in the ESPHome dashboard and try to install wirelessly, I get (similar on the older plugs, new one updates from the dashboard):

========================= [SUCCESS] Took 44.33 seconds =========================
INFO Successfully compiled program.
INFO Connecting to w.x.y.z
INFO Uploading /data/nitelite-plug/.pioenvs/nitelite-plug/firmware.bin (551632 bytes)
INFO Compressed to 375435 bytes
Uploading: [============================================================] 100% Done...
INFO Waiting for result...
ERROR Error receiving acknowledge receive OK: timed out

Looking at the plug log has the following (heap decreasing):

Could not allocate memory for JSON document! Requested 328 bytes, largest free heap block: 328 

After a unplugging the PLF10s, then plugging back in, the update from the ESPHome dashboard succeeds without issue.

So, it appears it's beneficial to actually power off these guys every once in a while.

Problem solved - apologies for the noise.

AhrBee commented

Thought I would add what appears to have been the root cause all along with the PLF10 updates, having had the numerous ESPHOME updates 'fail' (upload of .gz compiled binary to PLF10 webpage worked every time). It seems the built-in 10 second timeout allowed for the update is insufficient for ESPHOME/HA to do the update. Increasing the timeout to 20 seconds avoids the timeout, and the updates done via ESPHOME now work every time. Interesting that my KAUF RGBWW Smart Bulbs have never showed this behavior (timeout -> update fail).