Skip to content

Commit d2413eb

Browse files
committed
Update tests
1 parent 83c8f98 commit d2413eb

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

tests/application/test_startup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ async def test_info(
6767
app, znp_server = make_application(server_cls=device)
6868

6969
# These should not raise any errors even if our NIB is empty
70-
assert app.pan_id is None
71-
assert app.extended_pan_id is None
70+
assert app.pan_id == 0xFFFE # unknown NWK ID
71+
assert app.extended_pan_id == t.EUI64.convert("ff:ff:ff:ff:ff:ff:ff:ff")
7272
assert app.channel is None
7373
assert app.channels is None
7474
assert app.network_key is None

zigpy_znp/zigbee/application.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,6 @@ def __init__(self, config: conf.ConfigType):
121121
self._watchdog_task = asyncio.Future()
122122
self._watchdog_task.cancel()
123123

124-
self._network_key = None
125-
self._network_key_seq = None
126124
self._version_rsp = None
127125
self._concurrent_requests_semaphore = None
128126
self._currently_waiting_requests = 0
@@ -136,12 +134,16 @@ def __init__(self, config: conf.ConfigType):
136134
@property
137135
def network_key(self) -> t.KeyData | None:
138136
# This is not a standard Zigpy property
139-
return self.state.network_information.network_key.key
137+
if self.state.network_information.network_key:
138+
return self.state.network_information.network_key.key
139+
return None
140140

141141
@property
142142
def network_key_seq(self) -> t.uint8_t | None:
143143
# This is not a standard Zigpy property
144-
return self.state.network_information.network_key.seq
144+
if self.state.network_information.network_key:
145+
return self.state.network_information.network_key.seq
146+
return None
145147

146148
@classmethod
147149
async def probe(cls, device_config: conf.ConfigType) -> bool:

0 commit comments

Comments
 (0)