Skip to content

ZGP packet forwarding - #767

Merged
puddly merged 15 commits into
zigpy:devfrom
puddly:puddly/gp-forwarding
Oct 22, 2026
Merged

puddly merged 15 commits into
zigpy:devfrom
puddly:puddly/gp-forwarding

Conversation

@puddly

@puddly puddly commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Requires zigpy/zigpy#1848.

Tested on EZSP v9, v13, and v19.

Related: #712

@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.59%. Comparing base (4271531) to head (4fb332a).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #767   +/-   ##
=======================================
  Coverage   99.58%   99.59%           
=======================================
  Files          64       64           
  Lines        4350     4407   +57     
=======================================
+ Hits         4332     4389   +57     
  Misses         18       18           

☔ 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.

@puddly
puddly marked this pull request as ready for review October 21, 2026 19:59
Copilot AI balanced review requested due to automatic review settings October 21, 2026 19:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unprotected GP events are dropped by zigpy, and EZSPv6 cleanup leaves existing sink entries intact.

2 open issues
What changed in this PR

Adds Green Power packet forwarding to zigpy, addressing callback parsing failures reported in #712.

Changes:

  • Corrects GP address layouts and version-specific callback schemas.
  • Adds incoming packet conversion, aliased sends, and GP table cleanup.
  • Raises the zigpy minimum version and adds regression coverage.
File Description
tests/​test_ezsp_v9.py Tests captured GP callbacks.
tests/​test_ezsp_v7.py Tests sink-table cleanup.
tests/​test_ezsp_v6.py Tests aliased multicast sends.
tests/​test_ezsp_v4.py Tests alias support and cleanup behavior.
tests/​test_ezsp_v19.py Exercises captured GP frames.
tests/​test_ezsp_v17.py Tests GP table cleanup.
tests/​test_ezsp_v14.py Tests aliased sends.
tests/​test_ezsp_v13.py Exercises captured GP frames.
tests/​test_application.py Tests forwarding, security filtering, aliases, and cleanup.
pyproject.toml Requires zigpy 2.4.0 or newer.
bellows/​zigbee/​application.py Converts GP packets and forwards alias parameters.
bellows/​types/​struct.py Corrects GP address and proxy-entry layouts.
bellows/​types/​named.py Defines bidirectional GP flags.
bellows/​ezsp/​v7/​__init__.py Adds sink-table cleanup.
bellows/​ezsp/​v6/​commands.py Corrects aliased multicast schema.
bellows/​ezsp/​v6/​__init__.py Implements aliased multicast sends.
bellows/​ezsp/​v4/​commands.py Corrects legacy GP callback parsing.
bellows/​ezsp/​v4/​__init__.py Adds aliased broadcasts and cleanup fallback.
bellows/​ezsp/​v17/​commands.py Adjusts GP callbacks to firmware payloads.
bellows/​ezsp/​v17/​__init__.py Clears sink and proxy tables.
bellows/​ezsp/​v14/​commands.py Defines version-specific GP callback schema.
bellows/​ezsp/​v14/​__init__.py Passes alias parameters to sends.
bellows/​ezsp/​protocol.py Extends cleanup and sending interfaces.

Review effort: Balanced

Comment thread bellows/ezsp/v4/__init__.py
Comment thread bellows/zigbee/application.py

@zigpy-review-bot zigpy-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice work, the EZSP side is well put together and the captured frames from v9/v13/v19 are a good basis for the parsing tests (the v13/v19 test_gpep_incoming_frame cases only check that parsing doesn't raise, so asserting not rest or a field there would make them stronger). I ran the full suite on the head with zigpy 2.4.0 (749 passed). One thing I'd fix before merging, plus two smaller ones.

Should fix

  • Unprotected GPDFs are reported with security_key_type=None, but zigpy compares it with the key type stored at commissioning and drops mismatches. Details in the inline comment on application.py.

Smaller

  • EZSPv6 inherits the no-op clear_gp_tables() although v6/commands.py defines gpClearSinkTable (0xE2, the same ID v7 renames to gpSinkTableClearAll). Details inline on v4/__init__.py.
  • Unmapped GP statuses raise KeyError in _handle_gp_frame. Details inline on application.py.

Everything else I checked holds up: the EmberGpAddress layout against the captured frames, the alias plumbing (v14+ sendBroadcast/sendMulticast, v6 sendMulticastWithAlias, v4 proxyBroadcast), and the GPPGPDLink LQI/RSSI decoding.

Comment thread bellows/zigbee/application.py
Comment thread bellows/zigbee/application.py
Comment thread bellows/ezsp/v4/__init__.py

@zigpy-review-bot zigpy-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Both points from my earlier review are fixed at 98e5c73, and I re-ran the suite on this head with zigpy 2.4.0 (753 passed).

  • Unprotected GPDFs now report NoKey, and test_frame_handler_gp_unprotected_device checks delivery to a device commissioned without security.
  • EZSPv6 now clears the sink table through gpClearSinkTable and tolerates InvalidCommandError, with tests for both cases.

The new SUCCESS to SecuritySuccess mapping for pre-v14 firmware looks fine and is covered by a frame-based test. I have nothing further.

@puddly
puddly merged commit adfbefa into zigpy:dev Oct 22, 2026
12 checks passed
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