Skip to content

Feat/Add Zigbee for ESP32-C6 based gateways#502

Merged
silverailscolo merged 68 commits intoramses-rf:masterfrom
IMMRMKW:feat/zigbee
Mar 7, 2026
Merged

Feat/Add Zigbee for ESP32-C6 based gateways#502
silverailscolo merged 68 commits intoramses-rf:masterfrom
IMMRMKW:feat/zigbee

Conversation

@IMMRMKW
Copy link
Copy Markdown
Contributor

@IMMRMKW IMMRMKW commented Mar 5, 2026

Add Zigbee transport for ESP32-C6 based Ramses ESP boards

This PR adds Zigbee as a transport option alongside MQTT for boards based on the ESP32-C6 (Ramses ESP). For now, Zigbee support is limited to ZHA.

A pull request has been submitted to the ZHA device handlers repository so that pairing will eventually be fully automatic. In the meantime, the device handler needs to be added manually — see the Ramses ESP Wiki for pairing instructions and usage details.

Changes in Ramses RF

A new ZigbeeTransport class has been added that handles communication with the Ramses ESP over Zigbee. It integrates with ZHA via the zigpy cluster interface, translating incoming Zigbee frames into the existing packet format and routing outgoing frames back over the Zigbee connection.

The transport factory has been updated to recognise zigbee:// URIs and instantiate ZigbeeTransport accordingly, keeping the Zigbee path cleanly separated from the existing serial and MQTT transports.

IMMRMKW added 17 commits March 3, 2026 21:12
The monolithic transport.py was being shadowed by the transport/ package
added in upstream v0.55.2. ZigbeeTransport, FileTransport, PortTransport
and is_hgi80 were therefore unimportable via ramses_tx.transport.

- Add transport/zigbee.py with _ZigbeeTransportAbstractor + ZigbeeTransport
- Update transport/__init__.py to re-export FileTransport, PortTransport,
  ZigbeeTransport and is_hgi80 so ramses_tx.__init__ imports resolve
…ndling in factory

- ZigbeeTransport.__init__ was using *args/**kwargs and calling super() which
  would fail because _FullTransport.__init__ only accepts keyword args (/, *)
  and _ZigbeeTransportAbstractor.__init__ was never reached in the MRO chain
- Fix: give ZigbeeTransport an explicit signature (zigbee_url, protocol, *,
  config, extra, loop) and call both parent inits explicitly
- factory.py: add zigbee:// handling before assert port_config (Zigbee does
  not need a port_config); imports ZigbeeTransport lazily to avoid circular
  imports; waits for connection_made with 60s timeout
… version to 0.55.2, fix import ordering

- zigbee.py: remove inner per-frame debug logs from cluster_command,
  _decode_command_payload, _send_unacked; demote ACK scheduling from
  INFO to DEBUG; simplify _write_frame log to one line
- transport.py: restore to upstream (zigbee code now lives in transport/zigbee.py)
- Fix ruff issues: import ordering in transport/__init__.py and ramses_tx/__init__.py;
  remove unused FileTransport/PortTransport/is_hgi80 re-exports from ramses_tx/__init__.py;
  rename unused loop variable to _attempt
- Revert version to 0.55.2 (matches upstream)
Copy link
Copy Markdown
Collaborator

@silverailscolo silverailscolo left a comment

Choose a reason for hiding this comment

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

Thanks @IMMRMKW Please add a test set, similar to that of the mqtt protocol with coverage of your module >90%

@silverailscolo silverailscolo added this to the 0.55.4 milestone Mar 7, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 7, 2026

Code Coverage

Package Line Rate Health
ramses_cli 91%
ramses_rf 81%
ramses_rf.device 75%
ramses_rf.system 78%
ramses_tx 72%
ramses_tx.protocol 81%
ramses_tx.transport 61%
test_ha_mqtt 95%
tests 94%
tests_cli 99%
tests_rf 92%
tests_rf.device 98%
tests_rf.virtual_rf 83%
tests_tx 96%
Summary 80% (12649 / 15739)

Minimum allowed line rate is 80%

@silverailscolo silverailscolo changed the title Feat/zigbee Feat/Add Zigbee for ESP32-C6 based gateways Mar 7, 2026
Copy link
Copy Markdown
Collaborator

@silverailscolo silverailscolo left a comment

Choose a reason for hiding this comment

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

Thanks @IMMRMKW
No extra dependencies?
Not 100% sure about the [tool.mypy.overrides]. In general: "Use overrides sparingly" but we can revisit

@silverailscolo silverailscolo merged commit f0229da into ramses-rf:master Mar 7, 2026
6 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