Add regression tests for issue #306 zone toggle#399
Merged
Conversation
The old switch-based zone entity closed itself on a `change_mode` event with `mode=auto`, which the B-hyve cloud emits right after `watering_in_progress_notification` when a program starts. The migration to valve entities (PR #240) moved state derivation to the coordinator, but the scenario was never pinned by tests. Replay the event sequence from the issue log against the real coordinator and assert the valve stays open across the interleaved `change_mode` and closes cleanly on `device_idle`.
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
change_modewithmode=auto(which B-hyve emits ~1s afterwatering_in_progress_notificationat program start) setis_on = Falseon every zone, producing the visible on/off toggle.switchentities tovalveentities #240 moved state derivation to the coordinator —EVENT_CHANGE_MODEnow only merges new keys ontostatusand never toucheswatering_status. The scenario was never pinned by tests; this PR adds them.Test plan
pytest tests/test_coordinator.py::TestDeviceEventHandling -vpytest tests/test_valve.py::test_valve_does_not_toggle_on_change_mode_during_watering -vpytest tests/(152 passed, 5 skipped)