Skip to content

Commit a571726

Browse files
committed
Detect the CC2538 and include Z-Stack build in model number (#72)
1 parent 43dc5da commit a571726

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

tests/application/test_startup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,23 @@
2121

2222
DEV_NETWORK_SETTINGS = {
2323
FormedLaunchpadCC26X2R1: (
24-
"CC13X2/CC26X2, Z-Stack 3.30.00/3.40.00/4.10.00",
24+
"CC1352/CC2652, Z-Stack 3.30+ (build 20200805)",
2525
15,
2626
t.Channels.from_channel_list([15]),
2727
0x4402,
2828
t.EUI64.convert("a2:ba:38:a8:b5:e6:83:a0"),
2929
t.KeyData(bytes.fromhex("4c4e72b8412251799abf35251288ca83")),
3030
),
3131
FormedZStack3CC2531: (
32-
"CC2531, Z-Stack 3.0.1/3.0.2",
32+
"CC2531, Z-Stack 3.0.x (build 20190425)",
3333
15,
3434
t.Channels.from_channel_list([15]),
3535
0xB6AB,
3636
t.EUI64.convert("62:92:32:46:3c:77:2d:b2"),
3737
t.KeyData(bytes.fromhex("6dde24eae28552b6de2956eb05851afa")),
3838
),
3939
FormedZStack1CC2531: (
40-
"CC2531, Z-Stack Home 1.2",
40+
"CC2531, Z-Stack Home 1.2 (build 20190608)",
4141
11,
4242
t.Channels.from_channel_list([11]),
4343
0x1A62,

zigpy_znp/zigbee/application.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,16 @@ def manufacturer(self):
9191

9292
@property
9393
def model(self):
94-
if self.application._znp.version == 1.2:
95-
model = "CC2531"
96-
version = "Home 1.2"
97-
elif self.application._znp.version == 3.0:
98-
model = "CC2531"
99-
version = "3.0.1/3.0.2"
94+
if self.application._znp.version > 3.0:
95+
model = "CC1352/CC2652"
96+
version = "3.30+"
10097
else:
101-
model = "CC13X2/CC26X2"
102-
version = "3.30.00/3.40.00/4.10.00"
98+
model = "CC2538" if self.application._znp.nvram.align_structs else "CC2531"
99+
version = "Home 1.2" if self.application._znp.version == 1.2 else "3.0.x"
103100

104-
return f"{model}, Z-Stack {version}"
101+
build = self.application._version_rsp.CodeRevision
102+
103+
return f"{model}, Z-Stack {version} (build {build})"
105104

106105

107106
class ControllerApplication(zigpy.application.ControllerApplication):
@@ -122,6 +121,7 @@ def __init__(self, config: conf.ConfigType):
122121

123122
self._network_key = None
124123
self._network_key_seq = None
124+
self._version_rsp = None
125125
self._concurrent_requests_semaphore = None
126126
self._currently_waiting_requests = 0
127127
self._route_discovery_futures = {}
@@ -353,11 +353,11 @@ async def _startup(self, auto_form=False, force_form=False, read_only=False):
353353

354354
self._concurrent_requests_semaphore = asyncio.Semaphore(max_concurrent_requests)
355355

356-
version_rsp = await self._znp.request(c.SYS.Version.Req())
356+
self._version_rsp = await self._znp.request(c.SYS.Version.Req())
357357

358358
LOGGER.info("Network settings")
359359
LOGGER.info(" Z-Stack version: %s", self._znp.version)
360-
LOGGER.info(" Z-Stack build id: %s", version_rsp.CodeRevision)
360+
LOGGER.info(" Z-Stack build id: %s", self._version_rsp.CodeRevision)
361361
LOGGER.info(" Max concurrent requests: %s", max_concurrent_requests)
362362
LOGGER.info(" Channel: %s", self.channel)
363363
LOGGER.info(" PAN ID: 0x%04X", self.pan_id)

0 commit comments

Comments
 (0)