konnected-io / konnected-security

Konnected connects wired sensors and switches to SmartThings, Home Assistant, Hubitat and OpenHAB
https://konnected.io
Apache License 2.0
416 stars 322 forks source link

OTA update may fail while connected to AWS IoT #170

Closed sadahsan closed 1 year ago

sadahsan commented 1 year ago

OTA update failure on 3.1.1 Tried few times to update through the konnected App but no luck.

heythisisnate commented 1 year ago

what version are you updating from?

sadahsan commented 1 year ago

App v3.0.1 Fw v3.0.0

heythisisnate commented 1 year ago

I was able to reproduce this and determined that we run into a memory consumption issue when attempting to do an OTA (LFS) update while the device is connected to AWS IoT.

Potential solution: Shut down persistent AWS IoT websocket connection prior to beginning OTA download/update. @h2zero

Workaround: Reset the device first before performing the update to clear the AWS IoT connection. Hold down the RESET button for ~10 seconds when the device is idle until the blue light comes on solid, then release the button. The device will reboot. Perform the OTA update. Then go back to the Konnected App -> device -> Manage Zones -> Sync to Device to re-provision the device to connect to Konnected Cloud (AWS IoT).

h2zero commented 1 year ago

I'll make the same change for OTA as was done for the settings update.

sadahsan commented 1 year ago

Thanks for looking into it so quickly, when do you expect to release the updated firmware with this fix?

h2zero commented 1 year ago

I'll have a PR ready in the next few hours. It won't help you to update from your current version though, you'll likely need to follow the workaround method Nate described above.

sadahsan commented 1 year ago

Ok thanks, will give it a go.

On 23 Aug 2022, at 00:13, h2zero @.***> wrote:



I'll have a PR ready in the next few hours. It won't help you to update from your current version though, you'll likely need to follow the workaround method Nate described above.

— Reply to this email directly, view it on GitHubhttps://github.com/konnected-io/konnected-security/issues/170#issuecomment-1223304543, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKJGPJJS7URVN76CLVFJ3X3V2QCS3ANCNFSM57HN2LIQ. You are receiving this because you authored the thread.Message ID: @.***>

h2zero commented 1 year ago

This may take a bit longer than expected. Closing the mqtt connection and disabling the associated timers is still not enough. This will require a more creative solution.

heythisisnate commented 1 year ago

@h2zero An idea to solve this -- upon OTA update request, write a file/variable and reboot. Upon boot, check for OTA update file and execute the OTA before any other services start.

h2zero commented 1 year ago

That's what I was thinking as well. I tried everything else so far but didn't have time to try the file/reboot yet.