-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat: Allow scheduling OTA on device request #26823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Allow scheduling OTA on device request #26823
Conversation
Hi, just gave it a try and I'm happy to report that it works! I sent a message to I just had to add a coalescing operator on line 118 of |
Any chance you can test this with a couple of different "store-bought" end device & router too to check their behaviors? I don't have anything in need of update at the moment.
Can you provide some About the tsn, I believe it should be valid there (have to match the request |
58daa93
to
b653e5f
Compare
@sarthurdev if you have some time, do you think you could see about adding support for this in frontend? 😉 This shouldn't change existing features, just add an extra one (at the same level as |
Hi, I did a test where I disconnected the device by pulling the plug, here is the log: zigbee2mqtt_interrupt_update.zip The disconnect happens around line 20688. When I plugged it back in, zigbee2mqtt seems to ignore the OTA requests. If I restart zigbee2mqtt and then resend the schedule command, it starts the update again. Unfortunately, I'm just dipping my toe into Zigbee and don't have any store-bought devices to test with yet. |
I believe this should fix that. If you get a chance to retry (make sure to leave enough time for the device to try again after booting up - you shutdown Z2M just a couple of seconds after the request came in in that last log 😬). |
@Nerivec drafted a PR with frontend for this: nurikk/zigbee2mqtt-frontend#2449 I wonder if there should be an explicit endpoint to cancel, or if re-sending |
Thanks! I've added an |
Hi, I tried it again with the latest HEAD of the schedule-ota branch. If I remove the check for |
It should ignore until it's cleaned up (officially timed out) at line 168. And then the next request should take. You may not have waited enough time for the next request (the first one maybe two are likely ignored because Z2M has a rather long wait time before it times out on OTA, so it's still marked "in progress"). |
169e1bc
to
c0f9dba
Compare
0b16b42
into
Koenkk:deps/zigbee-herdsman-converters
Co-authored-by: Koen Kanters <[email protected]>
I figured allowing to schedule update on next device OTA request could help with some tricky end devices... (instead of forcing the update, it waits until the device expects the
queryNextImageResponse
, which I believe should fit better with indirect transmission devices).Using the MQTT endpoint
bridge/request/device/ota_update/schedule
you can register a device for update, so that if Z2M receives an OTA request from a device, instead of just checking for update, it will start the update process (which should match with the ZigBee spec).bridge/request/device/ota_update/unschedule
serves to cancel a scheduled update.bridge/request/device/ota_update/schedule/downgrade
is also supported.TODO: