Skip to content

Commit 1585a0c

Browse files
committed
Remove network_key and network_key_seq properties
1 parent 48c46bb commit 1585a0c

File tree

2 files changed

+8
-20
lines changed

2 files changed

+8
-20
lines changed

tests/application/test_startup.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ async def test_info(
7171
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
74-
assert app.network_key is None
75-
assert app.network_key_seq is None
74+
assert app.state.network_information.network_key is None
7675

7776
await app.startup(auto_form=False)
7877

@@ -85,8 +84,8 @@ async def test_info(
8584
assert app.extended_pan_id == ext_pan_id
8685
assert app.channel == channel
8786
assert app.channels == channels
88-
assert app.network_key == network_key
89-
assert app.network_key_seq == 0
87+
assert app.state.network_information.network_key.key == network_key
88+
assert app.state.network_information.network_key.seq == 0
9089

9190
assert app.zigpy_device.manufacturer == "Texas Instruments"
9291
assert app.zigpy_device.model == model

zigpy_znp/zigbee/application.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -131,20 +131,6 @@ def __init__(self, config: conf.ConfigType):
131131
# Implementation of the core zigpy ControllerApplication methods #
132132
##################################################################
133133

134-
@property
135-
def network_key(self) -> t.KeyData | None:
136-
# This is not a standard Zigpy property
137-
if self.state.network_information.network_key:
138-
return self.state.network_information.network_key.key
139-
return None
140-
141-
@property
142-
def network_key_seq(self) -> t.uint8_t | None:
143-
# This is not a standard Zigpy property
144-
if self.state.network_information.network_key:
145-
return self.state.network_information.network_key.seq
146-
return None
147-
148134
@classmethod
149135
async def probe(cls, device_config: conf.ConfigType) -> bool:
150136
"""
@@ -336,10 +322,13 @@ async def _startup(self, auto_form=False, force_form=False, read_only=False):
336322
LOGGER.info(" Device IEEE: %s", self.ieee)
337323
LOGGER.info(" Device NWK: 0x%04X", self.nwk)
338324
LOGGER.debug(
339-
" Network key: %s", ":".join(f"{c:02x}" for c in self.network_key)
325+
" Network key: %s",
326+
":".join(
327+
f"{c:02x}" for c in self.state.network_information.network_key.key
328+
),
340329
)
341330

342-
if self.network_key == Z2M_NETWORK_KEY:
331+
if self.state.network_information.network_key.key == Z2M_NETWORK_KEY:
343332
LOGGER.warning(
344333
"Your network is using the insecure Zigbee2MQTT network key!"
345334
)

0 commit comments

Comments
 (0)