Skip to content

Add optional update interval for sensors - #49

Open
alec-pinson wants to merge 12 commits into
flip-dots:mainfrom
alec-pinson:update_throttle
Open

Add optional update interval for sensors#49
alec-pinson wants to merge 12 commits into
flip-dots:mainfrom
alec-pinson:update_throttle

Conversation

@alec-pinson

@alec-pinson alec-pinson commented Sep 7, 2026

Copy link
Copy Markdown

Sensors publish on every telemetry frame, which for a power station in use is roughly once a second. That is more resolution than most setups need, and every genuinely changing value writes a recorder row.

Adds an optional minimum update interval per device, set from the integration's options. Sensors then publish at most once per interval, holding the most recent update and flushing it when the window closes, so a sensor is never more than the interval stale.

  • Defaults to 0 (off), so existing installs are unchanged.
  • Switches are never throttled — controls stay responsive.
  • Availability changes bypass the throttle, so a device going offline is still reported immediately.
  • Changing the interval applies in place via an options update listener; the BLE connection is not reloaded.

SolixThrottle sits between the device and the sensor entities. It registers a single callback with the device and fans out to its subscribers at most once per window, so there is one timer per device rather than one per entity.

Adds 20 tests; throttle.py is at 100% coverage.

Tested against a real C1000 Gen 2. At 60s, consecutive writes were 60.07s apart; at 0, behaviour is unchanged. Note that exercising this on a Gen 2 also needs flip-dots/SolixBLE#67, without which the model receives no telemetry at all on 4.0.0b1.

🤖 Generated with Claude Code

alec-pinson and others added 12 commits September 4, 2026 17:35
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <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