Skip to content

Add SYS.Model SREQ to report the actual chip model - #295

Open
CubeZ2mDeveloper wants to merge 1 commit into
zigpy:devfrom
CubeZ2mDeveloper:dev
Open

CubeZ2mDeveloper wants to merge 1 commit into
zigpy:devfrom
CubeZ2mDeveloper:dev

Conversation

@CubeZ2mDeveloper

Copy link
Copy Markdown

The node model is currently inferred from the stack version and NV struct alignment: every Z-Stack 3.x device becomes a generic "CC2652", and older devices are either a "CC2531" or a "CC2538". This cannot distinguish between chips like the CC2652R, CC2652P, and CC2652RB, and is wrong for coordinators running customized Z-Stack builds on other hardware.

Add a SYS.Model SREQ command (0x40) that returns the chip model as a length-prefixed UTF-8 string, and probe it while loading network info. The command is a firmware extension, not part of TI's documented MT SYS command set, so the probe degrades gracefully: firmware that does not recognize it (stock Z-Stack replies with RPCError.CommandNotRecognized) or does not answer within 5 seconds falls back to the existing inference. Stock firmware is unaffected and incurs no additional startup delay.

The node model is currently inferred from the stack version and NV struct
alignment: every Z-Stack 3.x device becomes a generic "CC2652", and older
devices are either a "CC2531" or a "CC2538". This cannot distinguish
between chips like the CC2652R, CC2652P, and CC2652RB, and is wrong for
coordinators running customized Z-Stack builds on other hardware.

Add a `SYS.Model` SREQ command (0x40) that returns the chip model as a
length-prefixed UTF-8 string, and probe it while loading network info.
The command is a firmware extension, not part of TI's documented MT SYS
command set, so the probe degrades gracefully: firmware that does not
recognize it (stock Z-Stack replies with `RPCError.CommandNotRecognized`)
or does not answer within 5 seconds falls back to the existing inference.
Stock firmware is unaffected and incurs no additional startup delay.
@zigpy-review-bot zigpy-review-bot added the new feature Adds new feature label Nov 16, 2026
Comment thread zigpy_znp/api.py
model_rsp = (
await self.request(c.SYS.Model.Req(), timeout=5)
).Model.decode("utf-8", errors="replace")
except (CommandNotRecognized, TimeoutError):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why TimeoutError?

@codecov

codecov Bot commented Nov 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 98.55%. Comparing base (c91e7a5) to head (314b5fa).

Files with missing lines Patch % Lines
zigpy_znp/api.py 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #295      +/-   ##
==========================================
- Coverage   98.57%   98.55%   -0.03%     
==========================================
  Files          43       43              
  Lines        3582     3589       +7     
==========================================
+ Hits         3531     3537       +6     
- Misses         51       52       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

new feature Adds new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants