[BETA] Updated binary firmware updater

I've made some updates to the original community firmware update driver written by @bcopeland to fix some bugs and add some functionality.

https://raw.githubusercontent.com/mbbush/hubitat/master/Drivers/Z-Wave-Firmware-Updater/zwaveBinaryUpdater.groovy

The bug fixed results in failed updates when firmware size is an exact multiple of 40 bytes, plus one byte. See https://github.com/djdizzyd/hubitat/pull/18 and Unable to update Black Switch firmware using Hubitat - #3 by mbbush - Firmware Discussion - Inovelli Community for more details.

The new functionality is allowing you to save the value of configuration parameters before you start the update, then do the update, then restore them back to their original values. I implemented this because many of my Inovelli LZW31-SN dimmers were setting some of their parameters to weird values when I updated the firmware, which caused unwanted behavior.

Basic instructions for how to use:

  1. Use the "get parameters" command with the range of config parameters you want to save. For my LZW31-SN I use "1-22,50-52". Setting an interval of around 400-500 ms is a good idea for reliability.
  2. Wait until you see the stored parameters show up in the "current states" section on the right. This will take several seconds, and will happen once the hub has stopped getting more parameter reports. You can view the logs if you want more detailed progress information. If you don't see all the parameters you requested, then either the device doesn't support them, or your interval was too fast. You can try get parameters again as many times as you want until you see all the values you expect in "current states".
  3. Update the firmware, just like you did before. You can optionally include an md5 checksum that will be checked against the file before flashing to ensure your download was correct. I haven't tested this yet with very many different firmware types, and it's totally optional.
  4. Use the "Restore Parameters" command with a range that includes the stored parameters you want to restore. The driver will send a set parameter command for each parameter in the range you specified that was already stored, so it won't unset something that it doesn't already have a value for.

I have not yet implemented code to save and restore the protection state (which disables local/remote control). I think I saw that get changed once by a firmware update, but I'm not sure.

The code still references @bcopeland as the author, uses his original namespace, and the import URL points to his repository. Brian wrote the vast majority of the code, and I don't want to take away from his work, but he also seems to have abandoned it. I'd be happy to move it to my namespace and take care of things like publishing to HPM, having proper versions, and merging fixes from contributers, but I also don't feel the need for any personal recognition for this. I might even unify it with the non-legacy one if I can find the time to wrap my head around this code more.

Brian, do you have a preference?

11 Likes

I am not sure it could be truly called abandoned when they built it into the Hubitat itself now that he joined them.

1 Like

But the built-in app doesn’t work on a C-5 or prior. This is a great contribution/update.

4 Likes

If you don't merge it with the legacy version, I would suggest changing the name in the definition to be distinct from the original legacy version. This is confusing if you install both, as they both have the same name. I renamed mine manually, not sure if everyone else is comfortable doing that. Also keeping the same name and namespace might cause HPM to match this up to Bryans repo (I think its still in HPM) and then "update" it from there. So might want to change the namespace as well, just give proper credit in the code to the original author. I have done this on a few ports from ST, per the license agreement they used, and no one has raised any concerns.

Otherwise, from what I understand Bryan has dropped all his public projects when he became staff, so it is basically abandoned and unsupported as you said. He has expressed that anyone willing to pick up any of the code could fork it and continue on his work. I wanted to fork these updater drivers but have not gotten around to it, so thanks for picking it up.

5 Likes

Had not realized Bryan completely dropped them all...

Either way, it is always good when someone is willing to help. Even if he WAS still actively working on it I do not know many developers in this community that are not willing to accept some input (or bug fixes) made freely.

2 Likes

Download the Hubitat app