Add optional open_service/close_service per zone - #248
Open
matteobreschig wants to merge 1 commit into
Open
Conversation
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
Adds two optional pairs of zone-level config parameters:
open_service/open_dataandclose_service/close_data. When set, IU calls the specified service instead of the defaultvalve.open_valve/close_valve(orswitch.turn_on/turn_off) when opening/closing that zone.An
open_datapayload can use the{{ duration_minutes }}template variable, which is replaced with the zone's calculated run time in minutes (rounded to the nearest minute).Motivation
See #[numero issue]. Some controllers (e.g. Orbit B-Hyve) expose valves as standard HA
valveentities but ignorevalve.open_valve— they require a proprietary service call with an explicit duration (bhyve.start_watering/bhyve.stop_watering) to work correctly. Without a duration, B-Hyve falls back to a hardware-configured default runtime.entity_states: 'off'+ an external automation is a working alternative for this (confirmed in the issue), but requires one automation (or one trigger block per zone) outside of IU to make the proprietary call. This PR moves that logic into the zone config itself, so a controller's proprietary integration lives next to the rest of its definition.Example
Backwards compatibility
Fully backwards compatible — if
open_service/close_serviceare not set, behavior is unchanged (falls back to the existing valve/switch/cover logic).Testing
test_switch_open_close_servicetotests/test_switch.py, covering both the custom service path and the fallback to default behavior when unset.check_backdelay tuned for B-Hyve's cloud polling latency. No issues since it's been running.Happy to adjust naming, scope, or drop config validation strictness based on feedback.