Skip to content

5.17: a Home Security "all clear" clears only what has ended - #2

Merged
Highsteads merged 1 commit into
mainfrom
claude/all-clear-fix
Nov 1, 2026
Merged

Highsteads merged 1 commit into
mainfrom
claude/all-clear-fix

Conversation

@Highsteads

Copy link
Copy Markdown
Owner

Summary

This fixes the idle-notification fault left open by #1, which still had two xfail(strict) tests for it.

The rule comes from the zwave-js source. I checked it in the published zwave-js 15.31.2 package, in lib/node/CCHandlers/NotificationCC.js. A Notification "idle" (event 0x00) names the event that ended in its first event parameter, and only that one is reset. An idle with no parameter resets everything:

if (value === 0) {
    // Generic idle notification, this contains a value to be reset
    if (isUint8Array(command.eventParameters) && command.eventParameters.length) {
        // The target value is the first byte of the event parameters
        setStateIdle(command.eventParameters[0]);
    } else {
        // Reset all values to idle

Changes (plugin.py)

  • New _handle_home_security_idle():
    • A named idle clears only that event. The motion family (0x01 0x02 0x05 0x06 0x07 0x08, which this plugin records as motion) clears motion, and a tamper (0x03, 0x09) clears tamper.
    • An idle naming another event writes nothing.
    • An idle naming nothing clears both, as before.
    • displayStatus then shows whatever is still active.
  • New _extract_idle_event(): reads the first event parameter. It uses the same layout as _extract_notif_user, with the low 5 bits of the properties byte as the length.
  • onOffState: Home Security events now set it only on Motion and Generic devices. Before, a contact on a node that also reports tamper or motion had its primary state set by those events, so a tamper clearing showed an open door as closed. The motion and tamper states still update on every device type that declares them.
  • Version 5.17 in Info.plist, the plugin.py header, the README and docs/changelog.md.

Not in scope

Access Control door events on a motion device, and SENSOR_BINARY reports, still write onOffState whatever the device type. It's the same class of issue, but outside the idle handling.

Test plan

  • pytest: 281 passed, and ruff is clean. The two idle xfails now pass and their markers are removed. 16 new tests cover named and unnamed idles, each motion-family event, unrelated events, the properties-byte flag bits, contacts and generic devices.
  • Sabotage-checked at runtime. Ignoring the named event fails 5 tests, and letting motion set a contact's primary state fails 3.
  • Run Parser Self-Test: 14 passed, 0 failed.
  • Not yet run on the Indigo Mac. On a sensor that reports both tamper and motion, open the cover during motion, close it, and check that motion stays active. Check any trigger on a non-motion device's main on/off state that relied on motion from the same sensor.

Generated by Claude Code

- An idle notification (event 0x00) names the event that ended in its first
  event parameter. It used to clear motion AND tamper whatever it named, so
  motion ending hid a tamper still active. Now a named idle clears only that
  event (motion family -> motion; tamper -> tamper); an idle naming nothing
  clears both, as before. Same rule as zwave-js 15.31.2
  (lib/node/CCHandlers/NotificationCC.js), checked in the published package.
- Home Security events drive onOffState only on Motion and Generic devices.
  A contact on a node that also reports tamper or motion had its primary state
  set by those events, so a tamper clearing showed an open door as closed.
  The motion and tamper states still update on every device that has them.
- displayStatus after an idle shows what is still active.
- Tests: the two idle xfails now pass (markers removed); new tests for named
  and unnamed idles, each motion-family event, unrelated events, the
  properties-byte flags, contacts and generic devices. 281 passed.
- Version 5.17: Info.plist, plugin.py header, README, docs/changelog.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Z2FM7PBbhgq9QjrM5W2HY
@Highsteads
Highsteads merged commit f88eb70 into main Nov 1, 2026
1 check 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.

2 participants