dresden-elektronik / deconz-ota-plugin

Server side implementation of the standard Zigbee OTA protocol.
BSD 3-Clause "New" or "Revised" License
47 stars 13 forks source link

Hue Motion Sensors update stuck at queued #27

Open woytekbode opened 3 years ago

woytekbode commented 3 years ago

I recently installed Home Assistant on a Raspberry Pi4 with SSD and conbee 2. Running the Deconz add-on and want to have hue lights, motion sensors and aqara sensors on the network.

When I found out it is possible to update devices over the air with the Deconz addon it made me very happy. That means it's not necessary to keep an old Hue Hub present for updates. However, I'm having some problems with updating my Hue motion sensors.

Steps that I took:

The update is recognised and seems to start but it hangs on "queued" and the time stops at 0.46. Things I have tried:

Otau_update_queued

woytekbode commented 3 years ago

So I have managed to update my Hue motion sensors. I did the following:

I'm glad I got it to work but I am wondering how I can do the update when the sensors are located all over the house with routers everywhere in between. It's not so easy to force a direct connection with the coordinator in that situation.

Maybe we can try and figure out if something is wrong when updating via routers?

jonnycastaway commented 3 years ago

Same issue with all Hue Devices. Hue Devices, no matter if it's a Bulb, Dimmer, Motion Sensor, stuck at queued or at 0.03%. Ikea Devices updates without problems. Biggest Problem ist that stuck at 0.03% will block the complete updates because deconz handles updates one by one. Bring the device near to the coordinator is not an option because i have bulbs that i cannot move.

matlimatli commented 3 years ago

I agree that it seems to be an issue with updating via routers. I managed to shut off various lights around the house and thereby forcing my dimmer switch to connect directly to the coordinator. The update then went smoothly, until after ~90%, when the device suddenly connected to a different router. After this, the update didn't make any progress at all.

NePheus commented 3 years ago

Same problem here. Is this a fixable bug by the dev team? Or cant this behavior be changed and we have to force (somehow) the connection directly to the coordinator?

ebaauw commented 3 years ago

Do you guys have source routing enabled? If so, could you disable it, wait a couple of minutes and try again?

jdeluyck commented 3 years ago

Do you guys have source routing enabled? If so, could you disable it, wait a couple of minutes and try again?

Where can I find this? I've been peeking through deconz, but...

ebaauw commented 3 years ago

In the GUI, enable the Source Routing panel under Panels.

jdeluyck commented 3 years ago

Not enabled here. (and Hue doesn't update unless it's directly linked)

ebaauw commented 3 years ago

What coordinator device and firmware do you use?

jdeluyck commented 3 years ago

ConbeeII running firmware 26660700, home assistant addon.

antonbo commented 3 years ago

I was able to proceed a little by using instructions from #22. But it still stuck for me at 4-5%. And restarted from 0% if I press Query or Update Devices for update: Dimmer Switch and Presence Sensor

UPD1: I'm able to proceed in my network if I press scan every 1.5 minutes. Smells like someone is going into sleep mode and stops transmitting OTA packets. It does not help to set "Add light time" to 60 minutes in my case. Is there any command line equivalent for "Scan for Devices" button in Old WebUI?

I'm using Conbee II with 26700700, no source routing. Most of devices are from IKEA (lights and sockets)

antonbo commented 3 years ago

So all my sensors are updated now. The procedure involved 'xdotool click 1' to force Touchlink scan every 60-90 seconds via old UI settings. Be careful to avoid OTA plugin generated images. In my case they were corrupted so I've used original ones from Philips site. I've tried to do the same with dimmer switches, but it fails with unknown reason for me. The firmware was sent fully to the device, but after restart (and few red-green blinks on device) it still shows the old one.

It's also possible to request Touchlink scan via REST API, but I have not tried it.

woytekbode commented 2 years ago

@ebaauw Hi Erik. IS there something we can do to progress this? I'd be happy to run some tests to find out where the issue is. I can imagine it's not high priority but on the long run it would be very inconvenient if firmware updates are not possible when using Deconz instead of the Hue Hub.

@antonbo Nice to see you have made some progress!

ebaauw commented 2 years ago

IS there something we can do to progress this?

I wouldn't know what.

As far as I understand the OTAU protocol, the device is directing the upgrade, requesting each block of data from the OTAU server. The update stalls when the device is no longer requesting next blocks. Most likely, this happens because the device didn't receive a proper answer from its previous request. We've seen this happen with source routing enabled during the OTAU upgrade, as the packet would become too large with the source routing header info. Of course your "regular" interference and Zigbee routing issues would also apply here.

It's been a while, but I managed to update all my Hue devices through the OTAU plugin, without resorting to continuous (touchlink) scanning. It's been challenging sometimes on my production network, especially for end devices. I suspect there's a mismatch in the timing between deCONZ sending the response and the device polling its parent. Analysing and fixing this is beyond my skills, I'm afraid.

I helps to use a test network without routers (other than the coordinator), forcing the end device to use the coordinator as parent. As I mentioned earlier: make sure to turn off source routing (if you're updating on a network with other routers), and to install fresh batteries in the end device (don't blindly trust the reported battery level).

smallgreyrock commented 2 years ago

Disabling source routing made the OTAU feature mostly work on my 50-60 device network, albeit not very reliably.

One frustrating thing about Hue devices is that if they're sufficiently out of date you seem to have to update to a different old firmware (or multiple different old firmwares) before you can update to the current one. I don't know if deconz handles that gracefully, you may have to select a specific firmware file in that case.

Sometimes the update check fails for reasons I don't understand -- I've seen deconz reply OTAU_NO_IMAGE_AVAILABLE for querying devices that definitely do have an updated image available.

Trying to force the device to start updating using query/update does not seem to work reliably.

Leaving deconz alone overnight updated ~90% of the devices. The remaining 10% were either stuck in the queued state, or at some random percentage. Clicking abort/query/update a couple of times sometimes unstuck them.

I wish disabling source routing was more clearly documented, I'd never have guessed that was breaking OTAU if I hadn't found this ticket. For anyone else who stumbles on this, OTAU does work, you just ... might have to wait and flail around a bit.