Repository navigation
Retry status requests until a partition status arrives - #93
Conversation
|
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, 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 ( Happy to adjust anything if you'd prefer a different approach. |
|
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>
00647c5 to
b395d7a
Compare
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 |
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
/partitionsstays 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
nx584integration show the alarm panel as
unknownuntil 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_loopre-requests themissing information every
status_retry_seconds(new[config]option, default15), whether or not there is activity:
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, thepartition 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.