Skip to content

v0.4.0

Choose a tag to compare

@mitchmitchell mitchmitchell released this 05 Nov 01:49
· 58 commits to main since this release
5bb033f

Arm Modes, Area Troubles, Triggered Alarms, Keepalive Stats (0.4.0)

  • Breaking (#102): AreaState.trouble is removed. Read the documented
    troubles string from the new AreaState.trouble_status instead.

  • Breaking (#100): vacation now counts as armed. ARMED_VACATION maps to
    the new ArmMode.ARMED_VACATION instead of None, so integrations
    that treated None as disarmed now see the area as armed.

  • Triggered alarms (#98): AreaState.alarm_active is now set from the
    alarms and alrm_snd fields of area.get_status (stored on the
    new AreaState.alarms and AreaState.alrm_snd), so an armed area in
    alarm reports triggered. FIRE TROUBLE and CO TROUBLE are
    supervisory troubles and do not set it. The legacy alarm_state field
    is still read when alarms/alrm_snd do not indicate an alarm;
    legacy "none" or empty there no longer counts as active. The
    alarms string is not special-cased (alarms="none" still sets
    active). alarm_active clears when the panel reports no alarm.

  • Docs (#108): private reference pointers in PERMISSIONS.md and
    ADR-0107 are replaced with the generic name.

  • Arm state mapping (#100, S1): arm_state strings are matched exactly
    against the documented area_get_status values. ARMED_VACATION is the
    new ArmMode.ARMED_VACATION (it was None, which HA showed as
    disarmed); ARMED_STAY_INST is ARMED_STAY. ALARM_MEM is not an arm
    mode and gives arm_mode=None; it and the documented alarm_mem field
    set the new AreaState.alarm_memory. Any other value logs one warning
    and stays None; it is never treated as disarmed. Bare substrings such
    as "stay" or "away" no longer match.

  • Area troubles (#102, S2): area.get_status now reads the documented
    troubles string into the new AreaState.trouble_status (state and V2
    snapshot). The undocumented trouble bool key is no longer read.

  • Barrier typing (#87): PanelState.barriers is now an explicit
    BarrierStateMap (dict[int, BarrierState]), with public API
    regression tests for complete-inventory rejection, kernel barrier map
    storage, and client.barriers exposing kernel BarrierState
    instances. Behavior unchanged.

  • Keepalive rescue (#88): a keepalive probe is rescued only by traffic
    received after that probe's own send time. A forced probe queued behind an
    in-flight command no longer uses the command's earlier send time, which
    fixes test_o14_keepalive_traffic_rescue on Python 3.11.

  • Keepalive observability (#81): new public read-only
    E27Kernel.keepalive_stats returns a copy of the new KeepaliveStats
    dataclass (probes_sent, replies, rescued, misses,
    consecutive_missed, last_round_trip_s, max_round_trip_s),
    counted since the kernel was created. New DEBUG lines: E27 keepalive armed (interval, timeout, max_missed), E27 keepalive probe sent,
    E27 keepalive round-trip ok (with replies, max= and
    timeout), E27 keepalive missed and a rescued-by-later-traffic
    line; counts and timings only, no identifiers. Keepalive timing and the
    miss budget (keepalive_max_missed = 1) are unchanged.

  • Keepalive test seam (#79): E27Kernel accepts optional
    KeepaliveTestHooks (injectable sleep and keepalive reply-timeout
    scheduling) so offline connection statechart cases O10-O15 run
    deterministically without wall-clock waits. Production keepalive timing is
    unchanged when hooks are unset.

  • E27Kernel.connect() (#50): set panel.connected before
    start_auto_receive() so a disconnect reported by the receive thread
    during connect setup runs the normal link-loss path (abort in-flight work
    and emit connected=False) instead of the pre-connect early return; if
    the session drops in that window, connect() raises (wrapped like other
    transport connect failures so async_connect surfaces
    Elke27ConnectionError) and does not emit connected=True on a dead
    session.

  • Connection events (#80): when HELLO fails for a reason other than a panel
    refusal, the kernel no longer emits an unflagged ConnectionStateChanged
    with connected=False if the session never reached connected=True (same
    pair invariant as a TCP connect failure). Panel HELLO refusals still emit
    connected=False with hello_refused=True.

  • When a command that carried a user code is refused with panel error 11004,
    11008, or 11037, the library now raises the new public
    Elke27CodeRejectedError (a subclass of Elke27PanelError with the
    same panel_error_code and reason). Panel 11037 is always mapped to
    that type; 11004 and 11008 only when the request included a user code
    (session auth failures without a code stay Elke27PanelError). Other
    panel error codes are unchanged (#76).