Skip to content

Add per-room daylight mode binary sensor#2

Open
berfarah wants to merge 1 commit intomainfrom
feat/daylight-binary-sensor
Open

Add per-room daylight mode binary sensor#2
berfarah wants to merge 1 commit intomainfrom
feat/daylight-binary-sensor

Conversation

@berfarah
Copy link
Owner

Summary

  • Exposes NaturalLightIsOn as a per-room HA binary_sensor for each daylight-capable light entity
  • Sensors attach to existing light devices via shared HA identifiers (no new devices created)
  • State hydrated from REST API on startup, polled every 30s, with optimistic updates on NL toggle commands

Design

  • No new types — daylight sensors are derived from LightEntity values with FollowDaylight=true
  • Polling over WebSocket — the openapi-go feedback WS (:3060) would be a whole new connection type; 30s REST polling is simple and sufficient for a mode indicator
  • Optimistic on toggle ON only — after SimulateButtonPress for NL toggle, we set daylight=true immediately; we don't optimistically set false on OFF since other loads in the room may still be NL-active

Test plan

  • go test ./... — all existing + new tests pass
  • go vet ./... — clean
  • Deploy to Savant host, verify HA discovers binary_sensor attached to daylight light devices
  • Toggle daylight mode from physical keypad → sensor updates within 30s
  • Send ON command from HA for a daylight load → sensor updates immediately (optimistic)

🤖 Generated with Claude Code

Expose NaturalLightIsOn as a binary_sensor per daylight-capable room.
Sensors attach to existing light devices via shared HA identifiers.
State is hydrated from the REST API on startup and polled every 30s,
with optimistic updates on NL toggle commands.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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