Skip to content

Improve HomeKit tile responsiveness (v3.2.1)#25

Open
identd113 wants to merge 4 commits into
OpenGarage:masterfrom
identd113:pr-homekit-responsiveness
Open

Improve HomeKit tile responsiveness (v3.2.1)#25
identd113 wants to merge 4 commits into
OpenGarage:masterfrom
identd113:pr-homekit-responsiveness

Conversation

@identd113
Copy link
Copy Markdown
Contributor

Summary

Three improvements to make the HomeKit garage tile reflect state changes faster, plus a CHANGELOG entry.

Immediate CLOSING/OPENING on HomeKit-triggered commands

Previously, tapping the tile to close/open sent the command but the tile stayed showing the old state until the next background poll. Now CurrentDoorState and TargetDoorState are pushed via updateValue() immediately after the command is sent so the tile shows Closing/Opening without any delay.

Rapid polling during transition

After a HomeKit command, the plugin now polls the device every 2 seconds instead of waiting the full openCloseDurationSecs window. As soon as the device confirms the target state, lastTarget is cleared and the final state is pushed to HomeKit. If the door never reaches the target (obstructed or device unreachable), rapid polling stops at openCloseDurationSecs and the regular poll loop takes over — no infinite loops.

Fresh state on tile navigation

getState() (onGet handler) is now async and awaits a live device poll before returning. Navigating to the tile always shows current state (~200ms query) instead of whatever the last background poll captured.

Test plan

  • All 6 unit tests pass (npm test)
  • Tapping Close in HomeKit → tile immediately shows Closing, then Closed within 2s of door confirming closed
  • Navigating to tile shows live state (brief spinner)
  • Physical remote press → tile updates within pollFrequencySecs seconds as before
  • Device unreachable during transition → rapid polling stops after openCloseDurationSecs, tile shows "No Response"

🤖 Generated with Claude Code

identd113 and others added 4 commits May 15, 2026 16:40
Three fixes for stale tile state:
- async getState(): await a fresh device poll on every onGet so navigating
  to the tile always returns live state (~200ms latency, no stale cache)
- Push CLOSING/OPENING immediately via updateValue() in changeState() so
  HomeKit-triggered commands show the transition state without waiting for
  the next poll
- Update error-case test to use assert.rejects() for async onGet handler
- Add assertions verifying updateValue() fires on changeState()

Also adds CLAUDE.md with architecture overview and dev commands.

Bump to 3.2.1.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
After a HomeKit open/close command, poll the device every 2 seconds
instead of waiting the full openCloseDurationSecs. As soon as the device
confirms the target state, clear lastTarget and push the final state to
HomeKit immediately. If the door never reaches the target (obstructed,
device unreachable), polling stops at openCloseDurationSecs and the
regular poll loop takes over.

The 2-second interval is a private constant — not user-configurable.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@identd113
Copy link
Copy Markdown
Contributor Author

After merge, it needs to be pushed to npm

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.

1 participant