Matter/Thread Network Discussion

Not really. You could try creating an RM rule that runs initialize() on a device if it has been inactive for X time, but that would only be an ugly band-aid.

If you capture it, I’ll run it through the script.

But you and I can continue forever to analyse logs, nothing will change unless we manage to attract staff attention (just noticed this topic is in the Lounge category…)

1 Like

Unless there is some way to detect that other than the device issuing data that may not be that helpful. For example the contact sensor I play with hasn’t had any activity for several hours but is still online right now.

One thing that is a little puzzling I have an IKEA temp/humidity sensor. It almost always shows a red X in Matter status and no ip address. But still regularly reports data and HE records it.

1 Like

Aren't the pings being responded to regularly?

At this point I’m using the stock driver.

If I remember right the ping in your driver is X secs, can’t find the value now. But unless it’s done about once a second and immediately can update it becomes a little unreliable for my usage. For example I need to know pretty quick if a door opened. If it opened when the device was offline, the driver initialized, would it pick up the past event? If not…..

And wondering about Hub load if trying to do things way too often.

Just my thoughts.

No!

The stock drivers are not for troubleshooting…
:grinning_face:

Good point!
How does the stock driver react in this scenario?

You mean the Initialze? Don’t remember now. Next time it happens I’ll pay more attention.

So should the community driver …
If not - it can be fixed ASAP.

Disclaimer : my IKEA contact sensor is lost somewhere in my room… it is online, but I can’t find it to open or close the contact for a test.. :sweat_smile:

1 Like

Sorry, my initial response about immediate was the contact status when online. Then I realized that wasn’t probably what you meant.

1 Like

It depends on the subscription- if the minimum time is 0 seconds, the response should be sent immediately.

It is zero:

String cmd = matter.cleanSubscribe(0, 600, paths)

I can confirm this observation. That’s why I am not using the device matter status in my drivers.

Getting crossed up in comments here.

When the contact sensor is online I get immediate response to close/open status. Which is what is needed.

I will try to test when it goes offline again as to the response time to initialize and whether it reports the correct state after the initialize.

Then I will change to your driver and see if I can duplicate the test.

One thing that stands in the way is Murphys law which says if you want something to malfunction to test it won’t malfunction..:rofl:

EDIT: Does your driver only work with the IKEA? I have an EVE sensor that also messses up.

Change to the HE inbuilt ‘Device’ driver and post the ‘Get Info’ debug output. The IKEA driver is a very simple one, but a generic Matter Contact Sensor driver should work with any make/model of Matter contact sensors, battery reporting included.

If one does a ping like @kkossev does, how does it affect battery?

I also noticed a refresh will return a battery reading which might be another method. Same question regarding battery life.

Which brings me to the question as to how the low level logic would keep the subscription active? If that makes sense.

Some of this came up in a Beta forum post discussing kDefunct. Logic was added in 2.5.0.145 to help with MarkAsDeFunct and triggering an initialize command. I’ve only got mains powered devices and have had no issues since then.

With that said, if I had to make a guess, battery powered devices are sleeping through the reinitialize command. They get marked as DeFunct for not responding, Hubitat issues a re-initialize command, and the device is not awake to receive it. When the device wakes up again, it assumes a different subscription path and things get missed. Depending on how long a device is asleep, Hubitat could have sent several initialize commands which would help explain the different paths.

@gopher.ny put in the logic to help with MarkAsDeFunct. It probably needs some tweaks for battery powered devices.

3 Likes

Something that may apply to these battery devices as well as maybe Zwave and Zigbee.

But if the device is asleep which I would think is most of the time, when it has an event such as contact change it would wake up and send the event. So why do they need to be tickled periodically? Is that the Matter spec for some reason?

Just trying to wrap my head around as to why things work the way they work, or not work.

And again trying to understand. You have Matter devices which I believe are all mains powered. So I thought the purpose of thread was to have low power non mains powered devices. So what is the reason for a mains powered thread device? Other than as a repeater?

I do have main powered thread devices, but even then, they act very differently. I have Inovelli White Dimmers that issue their own re-subscription requests roughly every 12 hours. Hubitat does not need to issue anything because the Inovelli firmware is designed to keep them alive.

I have 7 ThirdReality 3-1 Night Lights that are Matter via Thread. I went through this exact issue back in April. With the Matter Logs, Gemini analysis, and help of Hubitat developers, Hubitat was able to add logic with kDeFunct and adding an initialization command when that occurs.

I saw the above to help provide context to what you are seeing. Your end devices are seeing the exact same issues I saw with the night lights. Based on your logs and the Claude analysis, it looks like Hubitat needs to tweak its code to better handle subscriptions with battery powered devices.

1 Like

I think I worded that wrong. I understand what you say about the mains powered thread devices periodically send something to keep things in sync. But no battery issues there.

I think more what I was curious about was why that should even be needed. I confess I am way over my head on this. Probably should just accept things and not worry about how they work.

Sorry for the nitpick, but the distinction … matters… to the next question :wink: You probably mean Matter-over-Wifi/Ethernet devices ? I believe so too, although Matter-over-Wifi battery devices are possible in theory.

And here you mean Matter-over-Thread (other application layers can use Thread as its network layer). Thread is a mesh network protocol, just like the network part of Zigbee, so yes, relies on repeaters for resiliency, range, etc.

Why would a mains-powered device manufacturer choose to go with Matter-over-Thread? I imagine cost is a factor, but probably primarily to support their own Matter-over-Thread battery-powered sensor ecosystem with mains-powered routing capability.

Mains-powered Thread devices help to strengthen the Thread mesh, much like Zigbee repeaters do.

1 Like

If someone wants to experiment further - this is an experimental “overcomplicated” version of the community IKEA BILRESA Matter Buttons driver :

I was trying to detect and recover from lost Matter subscriptions on Hubitat... with a partial success.

The driver watches the Hubitat Matter JSON log, tries to detect the current subscriptionId, peer node, MaxInterval, and liveness refreshes. If the expected liveness window is missed, it first pings the device to confirm it is still online.Only after consecutive missed liveness checks, while the device still responds, it attempts to re-subscribe.

It also includes extra handling for delayed/stale BILRESA button events, simulated hold events, and debounce logic for multi-presses.

In the end, it was too much effort to patch something that could be handled much better at the Hubitat platform level. It may be wiser to simply clearly describe the needs and publish improvement requests to the HE devs. : )

1 Like