-
Notifications
You must be signed in to change notification settings - Fork 34
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
Add SWBuild read before starting update (Was:OTA events not firing at the correct time) #155
Comments
These events relate to the result of the ota_notify request itself, not the result of the OTA Update. ZHA-Toolkit sends an "invitation" to the device to indicate that it should try to get an update. The device can respond with "SUCCESS" which means that it received the request and that it can handle the request (it has an OTA cluster), or with an error (it does not support the OTA update for instance), or it does not reply. In case of success the device will start the OTA update process which starts by checking with the coordinator if there is actually an update available (if there is no newer version, there will not be a real update). As far as I remember there is no update confirmation, but ZHA/Zigbee sets report_configuration of the FW version on the device so that when it changes the new version is notified to the coordinator. So:
If you receive all 3 events for each ota_notify request, then this is a ZHA Toolkit bug, if you only receive 2 then this is normal. In order to know if the device was updated, the version before and after the update must be compared. IMHO it is possible to extend the ZHA Toolkit code to record the FW Version before sending the OTA Notify, and then check on a regular basis if that FW version changed. I am not sure that the device notifies that an update failed, if it doesn't (and for more robustness), a timeout could be added as an option at which time a fail event would be sent if the version did not change. I am open to a PR that implements monitoring the OTA Update until the long term timeout occurs. In case all three events regarding the ota_notify are all sent at the same time, I will look into that bug myself. |
Thank you so much for clarification. I have misunderstood how the events were supposed to work. I was under the impression that events would fire when the update was complete. I tested it now, and it only fires two events when initiating the update. "success" and "done" events. fail did not fire. To explain what I was trying to accomplish in the long run: |
@mathiasolofsson87 I understood your goal can be usefull - I had to update all of my Thermostatic Valves at some point. However the effort of coding a monitoring process, tracking the events and showing that in the HA UI outweighs simply starting the OTA update for all the relevant devices and then check after a few hours if the version changed to the one I expected. The SW build id can be viewed in a table using my fork of zha-network-card but that is a bit slowisch as reading the sw build id results in a zigbee request for each device (see my comment on HA's forum ). |
Forgive my ignorance, HA is very new to me and I am by no means a developer. But I keep learning and the community is great! How can I check what firmware version I should expect to see after the update is complete? For my case it is only my Hue Lights that I need to manually trigger OTA Firmware updates for currently. Is there a way to get a list of what Hue devices that have newer firmware available, so I know which ones need an update? Currently I've just been guessing by checking the zigbee device information in the HA GUI. |
Personnally I have the following methods: FYI, the manufacturer code is 4107.
As I was looking at the zha-toolkit code to see if it reports the file it uses, I notice that it enables reportint the "sw_build_id" on the device. every 30 minutes. Maybe I should add a read request of the sw_build_id and add it to the event data so that you know what version you started with. |
That would be an awesome addition! Thank you so much for your input and your work on ZHA Toolkit! |
I've setup the event_success, event_fail and event_done to use "ota_success" "ota_fail" and "ota_done" as event names and an automation that listens for the ota_done event to fire and send a notification to my phone when an update is done.
However all those three events seem to fire when initiating an update, so I get a notification as soon as I call the ota.notify service. but no event is fired when the update is actually finished.
All three events seem to fire when starting the update, not after its done.
The text was updated successfully, but these errors were encountered: