feat: make step size configurable for all number entities#138
Merged
Conversation
… 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.
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.
dbeb5b4 to
20ef5d9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
step_{key}pattern inentry.options— no extra entities, no reload on every changeControlParameterNumber.__init__where_attr_native_stepwas set twice (second assignment overwrote the first)Why not PR #137?
PR #137 adds a
SetpointStepNumberentity that callsasync_reloadon 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
test_pid_number_step_from_options— parametrized for all 4 PID parameter entitiestest_pid_number_step_defaults— fallback to DEFAULT_STEPS when no option settest_control_number_step_from_options— parametrized for all 4 control entitiestest_control_number_step_defaults— fallback for control entitiestest_options_flow_with_custom_steps— round-trip via options flowCloses #135
Supersedes #137