-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check for a changed network address when routing fails in zstack #1183
base: master
Are you sure you want to change the base?
Check for a changed network address when routing fails in zstack #1183
Conversation
This would fix #20045 for z-stack adapters (but the issue is present in ember too so if someone wants to have a look at it, I can test it.) |
I fixed that locally, and there's other differences in the fixtures I haven't investigated yet to see if they make sense or are actual regressions. |
// Figure out once if the network address has been changed. | ||
try { | ||
checkedNetworkAddress = true; | ||
const actualNetworkAddress = await this.requestNetworkAddress(ieeeAddr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you move this logic into a function? I see the same code is duplicated on line 570
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, for sure. I had started doing that but it will require a bit of cleanup for all the local variables, so I figured I'd wait until I knew if this was going to break things.
CC @Nerivec for the Ember part |
Seems like something that should be moved higher up the chain, not duplicated in each adapter (it's a regular ZDO req)? |
So you're thinking of something like doing this at
|
We're going to move the ZDO requests out of adapters, so the nwk address request would become a function of |
@Nerivec if it's useful, with Vimar devices I can pretty much replicate the issue every time I power them off. |
@Koenkk yes of course! 2024-09-15 09:47:06 enabled debug log (log attached here: "log of poweroff") Luce bagno Luce specchio bagno Luce corridoio Luce terrazzo studio Luce specchio bagno piccolo Luce camera Luce bagno piccolo Luce terrazzo sala Luce sala TV Luce studio some other 14592.0 are back online after power on: Luce terrazzo camera Luce cucina Luce sala divano 2024-09-15 10:04:00 I start the "recovery" procedure of going around the home and toggling devices and looking in the logs for "Data is from unknown device with address" so I can replace the IDs in the database
2024-09-15 10:16:46 all devices are back online. Downloading both logs |
I think we should do a ZDO network address request by ieeeAddr here: https://github.com/Koenkk/zigbee-herdsman/blob/master/src/controller/controller.ts#L722, need to wait a bit for the ZDO refactor is done, as this request is currently not supported yet (#1187) |
@Koenkk That's what I was thinking too, but there is the issue of close-by networks using default network config that trigger this codepath like crazy. Obviously, it's a "bad setup" example, but adding the ZDO request on top would add to the useless spamming. Been a bit busy to look into it in more details though. Like you said, the ZDO refactor should make this easier wherever it ends up being triggered, and will fix it for all adapters at once. |
@Nerivec I was thinking to do it only once for every unknown networkAddress |
It's not unknown as far as Z2M is concerned though, it's just no longer matching that of the network (no way to know unless we fail a request, then do the ZDO to see if the address changed). Also you need the EUI64 to do the ZDO (which is not available from everywhere in the code). |
This follows up from discussion at Koenkk/zigbee2mqtt#15874 (reply in thread).
With this PR, when my zbmini changes network addresses herdsman can fix it up. This will work well with availability checks. It only works in response to a command from zigbee2mqtt, and not if you trigger a message by flipping the switch itself. If anyone has ideas on making that work too, I'd love to hear them!
This fails two tests, so it's possible this actually introduces a bug. I'm going to run with this on my local network for a few days and see if anything odd happens.