Skip to content

Retry status requests until a partition status arrives - #93

Merged
kk7ds merged 1 commit into
kk7ds:masterfrom
chrodriguez:fix/startup-partition-status
Oct 23, 2026
Merged

kk7ds merged 1 commit into
kk7ds:masterfrom
chrodriguez:fix/startup-partition-status

Conversation

@chrodriguez

Copy link
Copy Markdown
Contributor

Problem

On startup the controller queues a time set and a system status request. The
partition status is only requested from process_msg_8, when "Valid partition N"
shows up as newly asserted. If the panel's answer to that first system status
request is lost, the partition is never requested and /partitions stays empty,
while zones keep working normally.

The only retry is the idle heartbeat, which needs idle_time_heartbeat_seconds
(120 s by default) with no frames from the panel. With motion sensors reporting
regularly that can take a long time: clients such as Home Assistant's nx584
integration show the alarm panel as unknown until it happens.

On my NX-8 this happened in 4 of 11 restarts. Those 4 recovered after 2, 10 and
14 minutes, and one was still empty after more than 12 minutes. The others got
the partition status within a second of starting.

Change

While no partition status has been received, controller_loop re-requests the
missing information every status_retry_seconds (new [config] option, default
15), whether or not there is activity:

  • if no "Valid partition N" flag is known yet, it requests the system status again;
  • if the partitions are known to be valid but their status never arrived, it
    requests the partition status directly. That case was not recovered by the
    heartbeat either, because the flag was no longer "newly asserted".

Once any partition status arrives, nothing changes compared to the current
behavior.

Tests

Three new tests in tests/test_controller.py: the system status is retried, the
partition status is retried when the partition is known to be valid, and nothing
is retried when a partition is already known. Without the change the two retry
tests fail. The full suite passes. The README documents the new option.

@chrodriguez

Copy link
Copy Markdown
Contributor Author

Hi Dan, thanks for merging #94 so quickly!

This one is the other half of the same problem: when the panel's reply to the startup system status request is lost, /partitions stays empty and the HA alarm panel shows unknown until the idle heartbeat fires, which with motion sensors reporting can take 10+ minutes (4 of 11 restarts on my NX-8).

The change only acts while no partition status has been received yet. Once one arrives, behavior is identical to today. The retry interval is configurable (status_retry_seconds, default 15), it's covered by three new tests, and CI is green. I've been running it on my panel since then without issues.

Happy to adjust anything if you'd prefer a different approach.

@kk7ds

kk7ds commented Oct 23, 2026

Copy link
Copy Markdown
Owner

Sorry I must have missed this when it came in. Contributions to pynx584 are very.. sporadic.

Looks like this needs a rebase, but otherwise fine with me.

The system status request sent at startup is sometimes lost, so the
partition is never requested and /partitions stays empty. The only retry
was the idle heartbeat, which never fires while zones keep reporting
activity, leaving clients (e.g. Home Assistant) with an unknown alarm
state for many minutes.

While no partition status has been received, re-request the system
status (or the partition status for partitions already known to be
valid) every status_retry_seconds (default 15).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chrodriguez
chrodriguez force-pushed the fix/startup-partition-status branch from 00647c5 to b395d7a Compare October 23, 2026 23:23
@kk7ds
kk7ds merged commit 390fbd2 into kk7ds:master Oct 23, 2026
1 check passed
@chrodriguez

Copy link
Copy Markdown
Contributor Author

Sorry I must have missed this when it came in. Contributions to pynx584 are very.. sporadic.

Looks like this needs a rebase, but otherwise fine with me.

No worries, and thanks for taking a look! Rebased onto current master: it's now a single commit on top of 84f563d, touching only README.rst, nx584/controller.py and tests/test_controller.py. Unit tests pass

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