Skip to content

feat: make step size configurable for all number entities#138

Merged
bvweerd merged 3 commits into
devfrom
feature/configurable-number-steps
May 12, 2026
Merged

feat: make step size configurable for all number entities#138
bvweerd merged 3 commits into
devfrom
feature/configurable-number-steps

Conversation

@bvweerd
Copy link
Copy Markdown
Owner

@bvweerd bvweerd commented May 12, 2026

Summary

  • Adds configurable step size for all 8 number entities (Kp, Ki, Kd, sample time, setpoint, output min/max, startup value) via the options flow
  • Uses a generic step_{key} pattern in entry.options — no extra entities, no reload on every change
  • Defaults match current hardcoded values, so existing installations are unaffected
  • Also fixes a pre-existing bug in ControlParameterNumber.__init__ where _attr_native_step was set twice (second assignment overwrote the first)

Why not PR #137?

PR #137 adds a SetpointStepNumber entity that calls async_reload on every value change — this tears down the entire integration each time the step is adjusted. Step size is UI configuration (like input/output ranges), not a runtime parameter. The options flow already handles this correctly, including the reload after saving.

This PR also extends the feature consistently to all number entities, not just the setpoint.

Test plan

  • All 86 existing tests pass
  • New test_pid_number_step_from_options — parametrized for all 4 PID parameter entities
  • New test_pid_number_step_defaults — fallback to DEFAULT_STEPS when no option set
  • New test_control_number_step_from_options — parametrized for all 4 control entities
  • New test_control_number_step_defaults — fallback for control entities
  • New test_options_flow_with_custom_steps — round-trip via options flow

Closes #135
Supersedes #137

… flow

Closes #135. All number entities (Kp, Ki, Kd, sample time, setpoint,
output min/max, startup value) now read their step size from entry.options
using a generic step_{key} pattern. Defaults match existing hardcoded
values, so existing installations are unaffected.

Also fixes a pre-existing bug in ControlParameterNumber.__init__ where
_attr_native_step was assigned twice, with the second overwriting the first.
@github-actions github-actions Bot added documentation Improvement or addition to documentation enhancement New feature or improvement labels May 12, 2026
bvweerd added 2 commits May 12, 2026 13:09
Tests that step values below the minimum (0.0001), above the maximum
(100.0), and exactly at both boundaries are correctly handled by the
options flow — invalid values raise InvalidData, boundary values are
accepted.
@bvweerd bvweerd force-pushed the feature/configurable-number-steps branch from dbeb5b4 to 20ef5d9 Compare May 12, 2026 11:17
@bvweerd bvweerd merged commit db30377 into dev May 12, 2026
12 checks passed
@bvweerd bvweerd deleted the feature/configurable-number-steps branch May 12, 2026 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvement or addition to documentation enhancement New feature or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: make setpoint step size configurable

1 participant