Skip to content

Conversation

prairiesnpr
Copy link

When the nwk of an existing device in the registry changes, handle_join isn't called. This ensures that handle_join is called when the nwk is changed and that the old entry is removed and replaced. Similar PR in zigpy: zigpy/bellows@4cf1237#diff-a03328e8d311484ecec5cd5f4129ab49

self._devices_by_nwk[src_nwk] = src_ieee
self.handle_join(src_nwk, ember_ieee, 0) # TODO: Parent nwk
device = self.get_device(ember_ieee)
if device.nwk != src_nwk:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is better to conflate line 131 if block and line 134 if block. IEEE never changes, but if src_nwk not in self._devices_by_nwk then either NWK has changed or it is a new device. In both cases we should self.handle_join().

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If statements conflated. Do we still want to remove the original nwk?

@coveralls
Copy link

Pull Request Test Coverage Report for Build 72

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at ?%

Totals Coverage Status
Change from base Build 70: 0.0%
Covered Lines:
Relevant Lines: 0

💛 - Coveralls

@Adminiuga
Copy link
Collaborator

Frankly, I'm not a fan of the current "new device join" handling. I like how it was implemented in zigpy-deconz based on the ZDO device_annce message, which all nodes must broadcast upon joinin or re-joining a network.
Can you give https://github.com/Adminiuga/zigpy-xbee/tree/fixes/update-nwk-change a try and provide feedback? I think this is a better approach. Let me know

@prairiesnpr
Copy link
Author

I've been running fixes/update-nwk-change for awhile and I'm seeing issues where xiaomi devices are losing their quirks and have to be removed and re-added if the system restarts. It's not all devices, but usually 1- 6 of them will be corrupted after restarting. I pulled the latest dev version of Home Assistant, which is supposed to fix the issue, but they are still corrupted upon restart. I'm seeing traffic like this in the logs and think it may be related. Are you seeing similar traffic, the ieee is odd to me.

2019-02-27 19:11:21 DEBUG (MainThread) [zigpy_xbee.uart] Frame received: b'\x91\
xff\xff\xff\xff\xff\xff\xff\xff\xc3\xcf\x01\x01\x00\x06\x01\x04\x00\x18^\n\x00\x
00\x10\x00'                                                                     
2019-02-27 19:11:21 DEBUG (MainThread) [zigpy_xbee.api] Frame received: explicit
_rx_indicator                                                                   
2019-02-27 19:11:21 DEBUG (MainThread) [zigpy_xbee.api] _handle_explicit_rx: opt
s=0                                                                             
2019-02-27 19:11:21 DEBUG (MainThread) [zigpy_xbee.zigbee.application] Received 
frame from unknown device: 0xc3cf/ff:ff:ff:ff:ff:ff:ff:ff  

@Adminiuga
Copy link
Collaborator

I pulled the latest dev version of Home Assistant, which is supposed to fix the issue

Yes, indeed there was a problem, however not in HA, but in zigpy #107 make sure you are running the zigpy version.
Also, HA dev tree installs module from zigpy-xbee-homeassistant PyPi and it adds to confusion. Maybe modify homeassistant.components.zha.__init__.py requireements to include your specific version of zigpy-xbee.

And I need to rebase this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants