Zigbee2Mqtt and OTA Device Firmware Updates

Zigbee2Mqtt and OTA Device Firmware Updates

A while back I migrated off of Smartthings to Zigbee2Mqtt so that I could have local control of my Zigbee devices. I haven’t looked back. So I was caught off guard when I was scrolling through my states page (as we all do right?…or Im the only one?…anyone?). Anyway, I was scrolling through the states page with total purpose (not admiring how cool my home assistant is with all these entities) and I saw:

In that moment I realized three things.

  1. I didn’t even know these binary sensors were there.
  2. That while I have local control Zigbee2Mqtt isn’t doing something that I assume Smartthings was handling for me or at least wasn’t telling me.
  3. And it turns out all of my Sengled bulbs had firmware updates.

Now in a controlled system this might not be a problem, but IoT devices are ripe for exploit so I always try to keep my devices up to date no matter how isolated I think I have them from the outside world. So off I went looking for a solution, and a few minutes later I arrived at the answer on the Zigbee2Mqtt GitHub.

Turns out earlier in 2020, a plan was hatched to add OTA updates to the Zigbee2Mqtt project. Talk about perfect timing. But as of this article the update process appears to still be experimental and only the following devices are available for OTA updates:

  • IKEA TRÅDFRI devices
  • Ubysis devices
  • Salus SP600 Smart plug
  • Osram/Ledvance devices (not every firmware is made available by them, in case not you will see the following exception in the log No image available for …)
  • Philips Hue devices (not every firmware is made available by them, in case not you will see the following exception in the log No image available for …)
  • Jung ZLLxx5004M (Gira does unfortunately not seem to offer firmware updates for their almost identical 2430-100 devices and the update file for the Jung ZLLxx5004M does not seem to work for Gira)
  • Sengled devices

Which for me was perfect since it was my Sengled bulbs that needed the update. And the update process couldn’t be easier. Well it could be if it was push button, but I haven’t quite figured that out. I will update this article when I get that going. I’m thinking a script that could be kicked off once the binary sensor turns on. But I will need a limiter so it doesn’t get stuck in a loop on failure. Just need some gauze and ball bearings…wait…I’ll save that for a future update.

For now, simply head over to the MQTT page under developer tools.

Per the Readme, you simply post the device friendly name to the zigbee2mqtt/bridge/ota_update/update. In my case the path is homeassistant/bridge/ota_update/update so that’s what I put under topic. And the payload is simply the device name. In my case it looked like:

Then click publish.

After that head over to the Zigbee2Mqtt add-on under Supervisor to watch the log. You may have to click refresh, but you should see:

If your device isn’t supported or doesn’t have a firmware update published you may see an exception that contains No image available for ...

Then as you jackhammer the refresh button to see the log updates you should see the progress percentage slowly get closer to 100%. This may take about 10 minutes.

Or, 44 mins? Ouch. It actually went a lot faster. It was actually really close to 10 mins. But this has to do a lot with your network traffic.

Closer….

From time to time I have seen errors popup in the log like this:

But from what I can tell the update continues on. And before you know it:

Update Complete.

Since I don’t have a push button update method built I added a quick entity filter card that shows what devices have updates available so I can manually run the update:

card:
  title: Zibee Updates
  type: glance
entities:
  - binary_sensor.0xb0ce18140003608a_update_available
  - binary_sensor.0xb0ce18140003b334_update_available
  - binary_sensor.0xb0ce181400051072_update_available
  - binary_sensor.0xb0ce181400051b4c_update_available
state_filter:
  - 'on'
type: entity-filter

Now there is a lot work to be done to make this seamless and in my case There to the the First Law of Home Automation but it looks like this addition has the potential of growing to cover more devices.

Now, I’m going to get back to figuring out how to make this less point, click, type

Until next time…I’ll go automate something.

Mastodon