Repository navigation
Add typed accessors for unit power and the bypass lock - #103
Open
andre-richter wants to merge 1 commit into
Open
andre-richter wants to merge 1 commit into
andre-richter wants to merge 1 commit into
Conversation
Switching the unit off and locking the bypass were only possible with set_values(), so callers had to know the register names and encodings: A_CYC_MODE 5 means off and 0 means on, and A_CYC_BYPASS_LOCKED 1 means the bypass is locked to the winter position. Add the MetricData properties power_on and bypass_locked, and the setters Vallox.set_power_on() and Vallox.set_bypass_locked(). The getters return None when the register is missing. power_on is False only for mode 5: the web UI also treats the other modes, such as test and self-test, as on. set_power_on() only accepts True or False, because a raw register value would be misread: 5 is truthy but means off.
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.
Switching the unit off and locking the bypass were only possible with
set_values(), so callers had to know the register names and encodings. This adds typed getters and setters for both, so this domain knowledge can be removed from the Home Assistant integration going forward.New API
MetricData.power_onA_CYC_MODE(4610)Falsefor 5 (off),Trueotherwise,Noneif missingVallox.set_power_on(on)MetricData.bypass_lockedA_CYC_BYPASS_LOCKED(20552)Truefor 1 (locked),Falsefor 0,Noneif missingVallox.set_bypass_locked(locked)Power values other than 0 and 5: The web UI treats only
C_CYC_MODE_OFFas off and every other mode as on, in all bundles intests/data/js/(2.0.2 to 3.1.6, Helios).power_ondoes the same.Bypass lock: the getter follows the register and the manual.
Setter input:
set_power_on()accepts onlyTrueorFalseand raisesValloxInvalidInputExceptionotherwise, because a raw register value would be misread:set_power_on(5)would switch the unit on.set_bypass_locked()treats its argument as a flag, likeset_timer_enabled(); its raw values 0 and 1 already map correctly.