Skip to content

Commit

Permalink
Make the ZiGateDevice object always initialized (fixes zigpy#97 and z…
Browse files Browse the repository at this point in the history
  • Loading branch information
puddly committed Oct 11, 2021
1 parent 818c3a1 commit 88d1cb6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/test_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ def test_model_detection(app):
assert device.model == 'ZiGate USB-TTL {}'.format(FAKE_FIRMWARE_VERSION)


def test_zigate_device_initialized(app):
device = zigpy_zigate.zigbee.application.ZiGateDevice(app, 0, 0)
assert device.is_initialized


@pytest.mark.asyncio
async def test_form_network_success(app):
app._api.set_channel = AsyncMock()
Expand Down
4 changes: 4 additions & 0 deletions zigpy_zigate/zigbee/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ def __init__(self, application, ieee, nwk):
model = 'ZiGate USB-DIN'
self._model = '{} {}'.format(model, application.version)

@property
def is_initialized(self):
return True

@property
def manufacturer(self):
return "ZiGate"
Expand Down

2 comments on commit 88d1cb6

@max5962
Copy link

Choose a reason for hiding this comment

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

you force the value to "true" but does that fix fix the issue ? ( zigbee network instability ) ?
thanks

@puddly
Copy link
Owner Author

@puddly puddly commented on 88d1cb6 Oct 14, 2021

Choose a reason for hiding this comment

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

The warning has no impact on network stability. All it means is the ZiGateDevice Python object has no node descriptor and no initialized endpoints, nothing more.

I don't have a ZiGate device to test with but if you want to try, see if this change works (https://github.com/zigpy/zigpy-zigate/blob/dev/zigpy_zigate/zigbee/application.py#L58):

        dev = ZiGateDevice(self, self._ieee, self._nwk)
+       await dev.initialize()
        self.devices[dev.ieee] = dev

Not all coordinators support sending requests to themselves but if it works then calling dev.initialize() is the correct fix.

Please sign in to comment.