Skip to content

feat(mqtt): publish each zone as its own HA device under the panel - #619

Merged
yozik04 merged 1 commit into
ParadoxAlarmInterface:devfrom
brettmeyerowitz:zone-subdevices-dev
Sep 28, 2026
Merged

yozik04 merged 1 commit into
ParadoxAlarmInterface:devfrom
brettmeyerowitz:zone-subdevices-dev

Conversation

@brettmeyerowitz

Copy link
Copy Markdown
Contributor

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_device so Home Assistant nests them underneath it. Partitions, PGMs and system entities are untouched.

Before — every zone entity:

"device": {
  "manufacturer": "Paradox", "model": "EVO192",
  "identifiers": ["Paradox_aabbccdd"],
  "name": "EVO192", "sw_version": "6.80 build 5"
}

After — a zone entity:

"device": {
  "manufacturer": "Paradox", "model": "Zone",
  "identifiers": ["Paradox_aabbccdd_zone_Front_Door"],
  "name": "Front Door",
  "via_device": "Paradox_aabbccdd"
}

The zone's binary sensor, numeric sensors and bypass switch all resolve to the same device, so they group together.

Migration safety

unique_id is 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. Zone key is label-derived, so renaming a zone on the panel changes its identifier — that is the same pre-existing caveat that already applies to unique_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 including via_device.
  • Full suite: 1700 passed. flake8 --select=E9,F63,F7,F82 clean, black/isort clean.

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.

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.
@sonarqubecloud

Copy link
Copy Markdown

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.

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

@yozik04
yozik04 merged commit dc9384b into ParadoxAlarmInterface:dev Sep 28, 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.

3 participants