Skip to content

Add interface_description string to UsbDeviceDescriptor - #1977

Merged
J. Nick Koston (bdraco) merged 1 commit into
esphome:mainfrom
puddly:puddly/usb-interface-description
Nov 4, 2026
Merged

J. Nick Koston (bdraco) merged 1 commit into
esphome:mainfrom
puddly:puddly/usb-interface-description

Conversation

@puddly

@puddly puddly commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

What does this implement/fix?

Adds the interface_description string to UsbDeviceDescriptor.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code quality improvements to existing code or addition of tests
  • Other

Related issue or feature (if applicable):

  • fixes

Pull request in esphome (if applicable):

Checklist:

  • The code change is tested and works locally.
  • If api.proto was modified, a linked pull request has been made to esphome with the same changes.
  • Tests have been added to verify that the new code works (under tests/ folder).

@codecov

codecov Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (3b2a4a2) to head (7dd3040).
⚠️ Report is 24 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1977   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           30        30           
  Lines         5205      5206    +1     
=========================================
+ Hits          5205      5206    +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.

@codspeed

codspeed Bot commented Oct 28, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 56 untouched benchmarks


Comparing puddly:puddly/usb-interface-description (7dd3040) with main (3b2a4a2)

Open in CodSpeed

@esphbot

Copy link
Copy Markdown
Contributor

PR Review — Add interface_description string to UsbDeviceDescriptor

This is a small, clean proto-mirror change and is ready to merge. I found no issues.

What the PR does well:

  • Proto change is safe for old devices. interface_description is added as field 7, after port_number = 6, so the field numbers don't change. It's a string, so a device that doesn't send it decodes to an empty string.
  • Model default matches the proto. The UsbDeviceDescriptor dataclass default of "" is the same as the proto3 default. from_pb copies declared dataclass fields, so the new field is decoded without any custom code.
  • Generated code looks regenerated, not hand-edited. In api_pb2.py, the descriptor bytes grow by 31 (\x98\x01 to \xb7\x01, 152 to 183). Every _serialized_start/_serialized_end offset after UsbDeviceDescriptor moves by the same 31, which is the pattern the official builder produces.
  • Tests cover both conversion paths. The existing test_serial_proxy_identity_conversion test now sets interface_description="Zigbee" and checks both the from_pb path and the to_dict/from_dict round trip through the nested usb converter.

One check I could not run:



Automated review by Kōan (Claude) HEAD=7dd3040 18s

@esphbot ESPHome Bot (esphbot) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tip

No blocking issues found — ready to merge.

@puddly
puddly marked this pull request as ready for review October 29, 2026 15:18
Copilot AI balanced review requested due to automatic review settings October 29, 2026 15:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@coderabbitai

coderabbitai Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 36a7a97c-0189-4835-aab3-6befbb2ba426
Commits

Reviewing files that changed from the base of the PR and between 3b2a4a2 and 7dd3040.

Files selected for processing: 4
  • aioesphomeapi/api.proto
  • aioesphomeapi/api_pb2.py
  • aioesphomeapi/model.py
  • tests/test_model.py

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Walkthrough

The USB device descriptor now includes an interface description in the protobuf and Python model. The model conversion test checks the field with the value "Zigbee".

Changes

USB descriptor field

Layer / File(s) Summary
Descriptor field and model conversion
aioesphomeapi/api.proto, aioesphomeapi/model.py, tests/test_model.py
UsbDeviceDescriptor adds an interface_description field to the protobuf and Python model. The conversion test checks the value "Zigbee".

Priority: Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Possibly related PRs

Suggested reviewers: bdraco

Merge Risk: Minimal · up to 7dd30

The interface description is consistently represented across the protocol and Python model. No actionable merge-blocking risk was identified; merge after normal checks pass.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: adding the interface_description string to UsbDeviceDescriptor.
Description check Passed The description directly explains the new field, identifies the related firmware pull request, and records testing and checklist results.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files. (1 skipped: 1 unsupported.)

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@bdraco
J. Nick Koston (bdraco) merged commit ea1c52f into esphome:main Nov 4, 2026
22 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants