Skip to content

Fix downloading diagnostics more than once#661

Merged
puddly merged 3 commits intozigpy:devfrom
TheJulianJES:tjj/fix_diagnostics_download
Feb 19, 2026
Merged

Fix downloading diagnostics more than once#661
puddly merged 3 commits intozigpy:devfrom
TheJulianJES:tjj/fix_diagnostics_download

Conversation

@TheJulianJES
Copy link
Copy Markdown
Contributor

@TheJulianJES TheJulianJES commented Feb 19, 2026

Proposed change

This PR makes a deepcopy of the device's original_signature before modifying the it for a friendlier version in the JSON.
Otherwise, we modify the original device.original_signature and fail with the error below when trying to download diagnostics for the same device a second time.

This fixes the following error when downloading diagnostics:

ep["profile_id"] = f"0x{ep['profile_id']:04x}"                                                                                                                                                                                                                                            
                           ^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                             
ValueError: Unknown format code 'x' for object of type 'str'

Additional information

We can also test the diagnostics stay the same for every device, but that seems a bit overkill: 6d3c660 (this PR)
Now, the PR only tests it for one device (which has an original_signature). The test is in test_discover.py, which isn't great, but just creating test_diagnostics.py for this seems a bit overkill? But I can do that, of course.
It's under the existing diagnostics usage in test_discover.py for now.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.41%. Comparing base (558bc6f) to head (7c369c6).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #661   +/-   ##
=======================================
  Coverage   97.41%   97.41%           
=======================================
  Files          62       62           
  Lines       10724    10725    +1     
=======================================
+ Hits        10447    10448    +1     
  Misses        277      277           

☔ View full report in Codecov by Sentry.
📢 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.

@TheJulianJES TheJulianJES marked this pull request as ready for review February 19, 2026 05:21
@TheJulianJES TheJulianJES marked this pull request as draft February 19, 2026 05:21
@TheJulianJES TheJulianJES marked this pull request as ready for review February 19, 2026 05:27
@puddly puddly merged commit ab558f2 into zigpy:dev Feb 19, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants