Upgrading Hue dimmer with ZHA OTA

Hi, I have a mix of Tradfri and Hue bulbs and units, and ZHA allows for OTA updates of Tradfri which is just peachy. But as Hue doesn’t publicly release their firmware, you have do some additional steps (if you have the firmware available.

I have gotten far, but I suppose I will need help to get to the finish line:

  1. I have ZHA perfectly setup, and I am able to control everything.
  2. I’ve added the following to my config yaml:
zha:
  zigpy_config:
    ota:
      ikea_provider: true                        # Auto update Trådfri devices
      ledvance_provider: true                    # Auto update LEDVANCE devices
      otau_directory: /config/zigpy_ota  # Utilize .ota files to update everything else
  1. I’ve added the file found here to the specified folder, which I believe is the newest version of the dimmer switch firmware (please correct me if I am wrong).
  2. Now, either the dimmer is going to update itself(?), or I have to force it. If I want to force it, how would I go about it? I suppose I have to send a cluster command, but which one?

No one who has gone down this road before? :blush:

I can’t help you but I want to thank you. I just learned that Philips Hue firmware can be downloaded from the Deconz web-site.

3 Likes

Anyone? It doesn’t appear that the OTA is happening by itself.

I read this part of the documentation and my impression is that OTA is unavailable for Hue devices. There are two options to enable OTA, one for Ikea Tradfri and the other for LEDVANCE. What leads you to believe that enabling both of them will also make it work for Philips Hue?

Was it this line?

Note that the otau_directory setting is optional and can be used for any firmware files you have downloaded yourself.

My impression is it means any firmware you downloaded for Ikea or LEDVANCE. However, it seems to suggest that it’s for any vendor’s firmware. If that were true, it leads to the question of how do you tell ZHA to perform OTA with the Hue firmware if there’s no option for it (like for Ikea and LEDVANCE)?


EDIT

To be clear, I’m just thinking out loud here; as mentioned, I have no practical experience with this integration. If I was actually trying to get OTA to work with Hue, I would have exactly the same questions as you: how and when does OTA happen? :thinking:

1 Like

I’ve never gotten OTA updates to work for Hue devices using ZHA (and I went down the same rabbit hole that you have for weeks).

So, what I typically do every 3 months or so is unpair my Hue devices (remotes and motion sensors) from HA. Pair them up to my Hue bridge, wait for them to update, and then re-pair them to HA. This process usually takes me between 2-3 days.

Is it painful and tedious? Yes. Does it suck? Yes. But, at least the firmware gets updated (yay I guess?).

2 Likes

From what I can understand, the OTA directory is for firmwares other than the officially published ones.

And people here, seems to be successful with using Deconz to update Hue units.

Hah, glad I am not the only one.

It appears it is possible with Deconz, and if you are able to locate a firmware.
I assume it will be the same with ZHA as well, I just got to wait for the project to mature a bit.

Fortunately, I am alone home this coming weekend, and I might migrate to Deconz, just to try updating and then migrate back to ZHA.

1 Like

I tried to confirm that by inspecting the source code but my first attempt failed to even find the OTA option. I’ll try again later, when I have more time.

As far as I know, you tell it to check with the following command:

You may need to put the OTA in debug though to see if it does anything:

logger:
  default: info
  logs:
    zigpy.ota: debug
2 Likes

Thank you very much, I’ll test it and report back if it works!

Any luck @bjorn.sivertsen?

I too would like to know if anybody figures this out. Trying to update my Hue bulbs’ firmware with just Hassio+ZHA with no hub, so a solution here would be helpful.

If I figure it out, I’ll be sure to post back as well.

@ardaedhel That’s easy.
Just download all the files from Philips from here: https://github.com/Koenkk/zigbee-OTA/blob/a02a4cb33f7c46b4d2916805bfcad582124ec975/index.json
Edit: More up-to-date images: https://github.com/Koenkk/zigbee-OTA/blob/master/index.json

Create an zha_ota folder in /config on your Hass. Drop all files in there.
Then follow this, but uncomment (remove the #) otau_directory.
otau_directory should then point to /config/zha_ota.

The config.yaml part should look like this then:

zha:
  zigpy_config:
    ota:
      ikea_provider: true
      ledvance_provider: true
      otau_directory: /config/zha_ota

(the IKEA and LEDVANCE updates are optional)

Note: Philips Hue Dimmer cannot be upgraded like this yet (the OTA file from Philips doesn’t follow any standards.)
Edit: Thanks to puddly, the Hue Dimmer can now also be upgraded if you have that image.

After some time, some Philips Hue bulbs will request an OTA upgrade, but most don’t.
Use the zha.issue_zigbee_cluster_command service with the following args:

ieee: 00:00:00:00:00:00:00:00
endpoint_id: 11
cluster_id: 0x0019
cluster_type: out
command: 0x0
command_type: client
args: [0, 100]

This will send image_notify to the bulb (the args are needed for some bulbs which is why it can’t be done through the Cluster UI of ZHA).
(Replace ieee with your Hue ieee you want to upgrade)

If you have https://www.home-assistant.io/integrations/zha/#debug-logging enabled, you will see some information in the logs about the upgrade.
After some time, the bulb should be upgraded, if it’s not already running the latest firmware.

11 Likes

Oh man, thank you @TheJulianJES , that’s a huge help! I’ll give it a shot later on.

Guess I misunderstood OP’s issue, so… sorry for the derail. :slight_smile:

No worries!
In the future this should also work for the Hue Dimmer if/when zigpy validations of the OTA images change (perhaps adding a special case for the Hue images).
Most Hue images do follow the standard though and at least for me, it works with all my types of bulbs.

Thank you for the detailed description @TheJulianJES! You should really add this to the ZHA documentation.

Do you know if any work is being done towards automating this process?

Kind of a script that checks the Hue devices firmware against any available OTA’s, and then issue the cluster commands for you?

1 Like

All the Zigbee OTA images on the zha_ota directory are already parsed on Home Assistant startup.
With Zigbee, the device needs to request an image and ZHA will look for the correct image to send (in the already parsed list of OTA images). If it finds one, then it will slowly send it to the device. If it doesn’t find one, it’ll simply send back a response that’s there no image.
As Philips Hue (Signify) doesn’t provide its OTA images directly (outside of the Hue Bridge), it’s quite problematic to fetch these images.
The zigbee-ota repo on GitHub (linked in the other post) already does a good job of collecting many OTA images for different devices. If you download all the images (from the “url”) "manufacturerCode": 4107, you will have all currently available images for Hue bulbs. (Important Note: Some Hue OTAs are directly on Philips’ servers while others are on Google’s servers)
The image_notify command basically tells the Zigbee device to ask the Coordinator (your Zigbee stick) to look for an update. Normally, this can be done through the GUI, but the Hue bulbs (and some other Zigbee devices) require these two additional arguments (which can only be provided by using the service call in the other post).

IKEA bulbs (and some Hue bulbs even) regularly ask for an OTA image, so at least for IKEA bulbs, the process is basically automated, as the ikea_provider always looks for the latest images (if IKEA doesn’t upload “corrupted” images again…)

2 Likes

It makes sense, and it is a shame that Hue does not publicly release Otas.

But until it does, I really think it makes sense to update the documentation with that part concerning making the service calls etc.

And even if a clever guy could automate the step of pulling the newest available hue firmwares and make the service call for you, that would be a great QoL improvement. Even if some of the Hue bulbs can ask for themselves, I assume it leaves out a lot.

1 Like

Can’t do it with Philips Hue SML002 Outdoor PIR
I’m receiving some weird errors from zigpy.ota.provider
File is downloaded to OTA folder
Firmware for SML002 is same that’s used for SML001


http://fds.dc1.philips.com/firmware/ZGB_100B_010D/1107323831/Sensor-ATmega_6.1.1.27575_0012.sbl-ota

BTW IKEA bulbs has been updated without problems, also from OTA folder.
Their servers provide bad responses for direct web update

2020-11-17 15:06:58 DEBUG (MainThread) [homeassistant.components.zha.core.device] [0x3E01](SML002): Issued cluster command: cluster_id: 25 command: 0 command_type: client args: (0, 100) cluster_id: out manufacturer: 4107 endpoint_id: 2
2020-11-17 15:06:58 DEBUG (MainThread) [homeassistant.components.zha.api] Issued command for: cluster_id: [25] cluster_type: [out] endpoint_id: [2] command: [0] command_type: [client] args: [0, 100] manufacturer: [4107] response: EmberStatus.SUCCESS
2020-11-17 15:06:58 DEBUG (MainThread) [zigpy.zdo] [0x3e01:zdo] ZDO request ZDOCmd.IEEE_addr_req: [0x0000, 0, 0]
2020-11-17 15:06:59 DEBUG (MainThread) [zigpy.zcl] [0x3e01:2:0x0019] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=CLUSTER_COMMAND manufacturer_specific=False is_reply=False disable_default_response=False> manufacturer=None tsn=74 command_id=1>
2020-11-17 15:06:59 DEBUG (MainThread) [zigpy.zcl] [0x3e01:2:0x0019] ZCL request 0x0001: [0, 4107, 269, 1107321517, None]
2020-11-17 15:06:59 DEBUG (MainThread) [zigpy.zcl] [0x3e01:2:0x0019] OTA query_next_image handler for 'Philips SML002': field_control=0, manufacture_id=4107, image_type=269, current_file_version=1107321517, hardware_version=None
2020-11-17 15:06:59 DEBUG (SyncWorker_5) [zigpy.ota.provider] Couldn't load '/config/ota/Sensor-ATmega_6.1.1.27575_0012.sbl-ota' OTA image
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/zigpy/ota/provider.py", line 335, in _fetch_image
img = OTAImage.deserialize(data[offset:])[0]
File "/usr/local/lib/python3.8/site-packages/zigpy/ota/image.py", line 158, in deserialize
element, element_data = SubElement.deserialize(element_data)
File "/usr/local/lib/python3.8/site-packages/zigpy/ota/image.py", line 131, in deserialize
raise ValueError("Data is too short for {}".format(cls.__name__))
ValueError: Data is too short for SubElement
2020-11-17 15:06:59 DEBUG (MainThread) [zigpy.zcl] [0x3e01:2:0x0019] No OTA image is available