feat(mqtt): publish each zone as its own HA device under the panel - #619
Merged
yozik04 merged 1 commit intoSep 28, 2026
Merged
Conversation
Every zone entity (binary sensors, numeric sensors and the bypass switch) is currently attached to the panel device, so Home Assistant shows one device holding every entity PAI publishes. On a large system that is a flat list of several hundred entities with no grouping. Give zones their own device block, linked back to the panel with `via_device` so Home Assistant nests them underneath it. Each zone then shows as its own device carrying just that zone's entities. `unique_id` is deliberately left alone, so on an existing install the entities are re-parented in place rather than re-created: entity ids, customisations and history are preserved. The only visible change is where they sit in the device tree. The zone identifier is scoped by panel serial number (`Paradox_<serial>_zone_<key>`), matching the convention the panel device itself uses since ParadoxAlarmInterface#592, so two panels on one broker cannot collide. Partitions, PGMs and system entities are unchanged.
|
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved issues were identified, and the changes are covered by tests.
Pull request overview
Adds Home Assistant device nesting so each zone appears as its own device beneath the panel while preserving entity identities.
Changes:
- Adds serial-scoped zone devices linked with
via_device. - Preserves existing panel and entity identifiers.
- Updates unit and integration tests.
File summaries
| File | Description |
|---|---|
tests/interfaces/mqtt/test_homeassistant.py |
Verifies the published zone discovery payload. |
tests/interfaces/mqtt/test_entities.py |
Verifies zone device serialization. |
paradox/interfaces/mqtt/entities/abstract_entity.py |
Generates zone-specific device metadata. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Problem
Every entity PAI publishes lands on a single Home Assistant device — the panel. On a system with a few dozen zones that is one device holding several hundred entities in a flat, ungrouped list, and there is no way to see "everything about the front door" in one place.
Change
Zones get their own device block, linked back to the panel with
via_deviceso Home Assistant nests them underneath it. Partitions, PGMs and system entities are untouched.Before — every zone entity:
After — a zone entity:
The zone's binary sensor, numeric sensors and bypass switch all resolve to the same device, so they group together.
Migration safety
unique_idis deliberately not touched. On an existing install Home Assistant re-parents the entities in place rather than re-creating them — entity ids, customisations and recorder history are all preserved. The only visible change is where they sit in the device tree.The zone identifier is scoped by panel serial (
Paradox_<serial>_zone_<key>) to match the convention the panel device adopted in #592, so two panels on one broker cannot collide. Zonekeyis label-derived, so renaming a zone on the panel changes its identifier — that is the same pre-existing caveat that already applies tounique_id, not something this change introduces.Testing
tests/interfaces/mqtt/test_entities.py— the two zone serialization tests now assert the nested device block; verified they fail without the source change.tests/interfaces/mqtt/test_homeassistant.py— extended the end-to-end discovery test with a zone, asserting the published payload includingvia_device.flake8 --select=E9,F63,F7,F82clean,black/isortclean.Functionally this has been running against an MG5050 since July. The deployed build used an unscoped
Paradox_zone_<key>identifier; this PR scopes it by serial per the note above, which is the only difference from what has been exercised in production.