[ST Edge] Zigbee motion sensor driver issues with IKEA and Sonoff devices

OK, I’m going to flag this here because something feels wrong.

I will previously have mentioned issues with the stock Edge driver for Zigbee Contact when used with Sonoff contact sensors. They are forever going offline. Most of the time they come back online with activity but occasionally they don’t. Sometimes they’ll be paired again and be online for just an hour or two. They particularly enjoy being offline when STHM arms so I have to open a couple of doors. One was opened an hour ago and has just had to be opened again as it was already offline.

However now it is the turn of Zigbee Motion with IKEA motion sensors to take the limelight. They were pretty much the first Edge drivers I tried so I’ve been using them for a little while now. They do go offline from time to time, though curiously they will also happily keep going for a week with no activity except whatever it is that produces their annoying false positives. This morning I was told that our motion lighting wasn’t working overnight. I checked and sure enough it wasn’t. The lighting could still be controlled but the motion sensors just weren’t reporting. I actually had to power cycle the hub to restore sanity.

Then this evening the same thing happened. The motion sensors just stopped responding until I power cycled the hub again. Interestingly when the hub came up a couple of the motion sensors were already marked as offline, and those were in the occupied rooms.

Ideally I’d have started some logging up to see if that would enlighten me, but I’m not really geared up to do that at the drop of a hat.

Something feels different.

2 Likes

I had the same issue with my Ikea sensor and Edge driver. Tried back and forth between Edge and Groovy. Groovy never fails, and Edge stop responding after couple of hours. I am back to Groovy, more than a month, and no problem at all.

This is what @carter.swedal had to say about this problem:

As far as I can tell, the devices are configured correctly by default to report the proper clusters, but not all clusters are being reported as they should.
The office sensor (Iris V3 Motion Sensor) seems to be reporting as expected, and does not have online/offline changes.
The Freezer door sensor (Sonoff contact sensor) does not seem to report the PowerConfiguration or the IASZone clusters. And therefore it is marked offline after about 2.5 hours without communication
The Workbench Motion sensor (Sonoff motion Sensor) does not seem to report the IASZone cluster every 5 min like we configure it to.

I will reach out to our integration testing team to see if this is a known problem with the device models. In the meantime. One thing you could do if this is a large bother, is to configure reporting for the PowerConfiguration cluster to be more frequent (<2 hours). By default we configure PowerConfiguration to report battery percentage every 6 hours, and IASZone to report every 5 minutes; so we are relying on the IASZone attribute reporting to monitor the device is online for these devices.

IKEA Outlets have been known to get into a state where they mangle power configuration requests, though whether that is just an own goal against IKEA buttons isn’t clear to me. So that doesn’t hurt. When I first started with the contact sensors, they were going offline after a day or so, now it can be as little as an hour.

Happened again. Here is a typical log entry for a motion sensor while I am having problems (I think I coughed and dropped the wrong first line, judging by the timestamp):

2021-10-20T22:14:12.205125880+00:00 TRACE Zigbee Motion Sensor  Received event with handler zigbee
2021-10-20T22:12:36.210238952+00:00 INFO Zigbee Motion Sensor  <ZigbeeDevice: REDACTED [0x3467] (Dining Room Motion)> received Zigbee message: < ZigbeeMessageRx || type: 0x01, < AddressHeader || src_addr: 0x3467, src_endpoint: 0x01, dest_addr: 0x0000, dest_endpoint: 0xFF, profile: 0x0104, cluster: OnOff >, lqi: 0xFF, rssi: -48, body_length: 0x0008, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x01, seqno: 0x1A, ZCLCommandId: 0x42 >, < OnWithTimedOff || on_off_control: 0x00, on_time: 0x0708, off_wait_time: 0x0000 > > >
2021-10-20T22:12:36.221943452+00:00 DEBUG Zigbee Motion Sensor  Dining Room Motion device thread event handled

Here is what I get after the hub is power cycled:

2021-10-20T22:17:40.695737588+00:00 TRACE Zigbee Motion Sensor  Received event with handler zigbee
2021-10-20T22:17:40.701071963+00:00 INFO Zigbee Motion Sensor  <ZigbeeDevice: REDACTED [0x3467] (Dining Room Motion)> received Zigbee message: < ZigbeeMessageRx || type: 0x01, < AddressHeader || src_addr: 0x3467, src_endpoint: 0x01, dest_addr: 0x0000, dest_endpoint: 0xFF, profile: 0x0104, cluster: OnOff >, lqi: 0xFF, rssi: -54, body_length: 0x0008, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x01, seqno: 0x1F, ZCLCommandId: 0x42 >, < OnWithTimedOff || on_off_control: 0x00, on_time: 0x0708, off_wait_time: 0x0000 > > >
2021-10-20T22:17:40.714387338+00:00 TRACE Zigbee Motion Sensor  Found ZigbeeMessageDispatcher handler in zigbee-motion -> ikea motion sensor
2021-10-20T22:17:40.717540421+00:00 INFO Zigbee Motion Sensor  Executing ZclClusterCommandHandler: cluster: OnOff, command: OnWithTimedOff
2021-10-20T22:17:40.722338004+00:00 INFO Zigbee Motion Sensor  <ZigbeeDevice: REDACTED [0x3467] (Dining Room Motion)> emitting event: {"state":{"value":"active"},"capability_id":"motionSensor","attribute_id":"motion","component_id":"main"}
2021-10-20T22:17:40.778891629+00:00 DEBUG Zigbee Motion Sensor  Dining Room Motion device thread event handled
2021-10-20T22:17:40.784631921+00:00 DEBUG Zigbee Motion Sensor  Dining Room Motion device thread event handled

So, before the device goes offline, do you see if the device is constantly reporting its status to the Hub?
When you join the device, it shows the configureReporting messages sent, are they effective? Because even if the device doesn’t have a change of state when the maxInterval times out, it should send the current value.

I’d have to look into that more. That was really a secondary plot line that I probably shouldn’t have introduced. What I am seeing now is far more serious and worrying.

This is no longer about devices going offline when they shouldn’t. They are still online. It is about the hub stopping handling them properly. As you can see from the logs the hub is receiving the Zigbee motion events but not processing them. Then after the hub is power cycled it is working correctly.

This is something that seems to have started in the last twenty-four hours or so.

Aaah, I see…and the handler not kicking in happens after a specific amount of time? It would be helpful to monitor the logs to see if something happens before it stops working…In the meantime, could you share the following info by DM, please?

  • Device name and ID
  • Driver ID

I’ve noticed similar problem with my Ikea motion sensor, but even if it is offline sometimes it wakes up when movement is detected. I’ll get Sonoff contact sensor next week. Interesting to see if there is any problems with that.

Edit:

Speakinf of devil. I just said Ikea motion sensor wakes up although it has been offline for some time but this morning it didn’t work that way. It pick and choose when to react. Just like @orangebucket said.

@nayelyz has a DM with the requested details. I found that approximately an hour after power cycling the hubs I get one or two events that aren’t handled properly followed by several of these messages:

WARN Zigbee Motion Sensor failed to cancel dropped timer, timer has leaked Invalid timer ID

From then on the motion events aren’t being passed on to the handlers by the driver.

Update: This sequence was repeated an hour after power cycling the hub again, only this time a couple of properly handled events sneaked in after the warning messages. It should also be noted that unhandled info_changed lifecycle events appear just before this time. They seem to be an hourly thing.

1 Like

Thank you for the information, Graham. I’ll report this to the engineering team and let you know their feedback.

1 Like

Thanks. It is a little weird only having working motion sensors for an hour at a time. I shall have to dig out some more primitive technology as a stopgap.

Wandering to the bathroom, my way lit by four candles (*), I suddenly realised that my motion controlled lights were on.

Checking my device histories, it looks like the motion sensors actually started working yesterday evening and I just hadn’t registered it because lighting was already on. There was also a period of one hour late on Monday evening where there was activity too, and that doesn’t correspond with the last reported boot of the hub.

I’m hoping someone has fixed something somewhere (thank you, if so) as it would add to the puzzle otherwise.

(*) Not really, it was two battery powered motion lights, but just saying ‘four candles’ amuses some of us Brits.