Skip to content

Commit

Permalink
Issue #140
Browse files Browse the repository at this point in the history
  • Loading branch information
rgc99 committed Oct 17, 2023
1 parent 235d32d commit 07dce24
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3482,7 +3482,10 @@ def muster(self, stime: datetime, force: bool) -> int:

# Post processing
for zone in self._zones:
zone_status |= zone.runs.update_queue(stime)
zts = zone.runs.update_queue(stime)
if zts & IURunQueue.RQ_STATUS_CANCELED:
zone.request_update()
zone_status |= zts

if (
zone_status
Expand Down
10 changes: 9 additions & 1 deletion tests/configs/service_manual_run_sequence.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ irrigation_unlimited:
show_log: false
autoplay: false
times:
- name: '1-Manual run sequence 1'
- name: '1-Manual run sequence 1 time 20 min'
start: '2021-01-04 14:00'
end: '2021-01-04 15:00'
results:
Expand Down Expand Up @@ -49,6 +49,14 @@ irrigation_unlimited:
- {t: '2021-01-04 14:21:01', c: 1, z: 4, s: 1}
- {t: '2021-01-04 14:39:01', c: 1, z: 4, s: 0}
- {t: '2021-01-04 14:40:01', c: 1, z: 0, s: 0}
- name: '4-Manual run and cancel'
start: '2021-01-04 10:00'
end: '2021-01-04 11:00'
results:
- {t: '2021-01-04 10:00:01', c: 1, z: 0, s: 1}
- {t: '2021-01-04 10:01:01', c: 1, z: 1, s: 1}
- {t: '2021-01-04 10:03:00', c: 1, z: 1, s: 0}
- {t: '2021-01-04 10:03:00', c: 1, z: 0, s: 0}
controllers:
- name: "Test controller 1"
preamble: "00:01"
Expand Down
29 changes: 29 additions & 0 deletions tests/test_manual_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
import homeassistant.core as ha
from tests.iu_test_support import (
IUExam,
mk_local,
)
from custom_components.irrigation_unlimited.const import (
SERVICE_MANUAL_RUN,
SERVICE_TIME_ADJUST,
SERVICE_CANCEL,
)
from custom_components.irrigation_unlimited.irrigation_unlimited import (
IULogger,
Expand Down Expand Up @@ -227,6 +229,33 @@ async def test_service_manual_run_sequence(
)
await exam.finish_test()

await exam.begin_test(4)
await exam.call(
SERVICE_MANUAL_RUN,
{
"entity_id": "binary_sensor.irrigation_unlimited_c1_m",
"sequence_id": 1,
},
)
await exam.run_until("2021-01-04 10:03:00")
await exam.call(
SERVICE_CANCEL, {"entity_id": "binary_sensor.irrigation_unlimited_c1_m"}
)

assert hass.states.get("binary_sensor.irrigation_unlimited_c1_z1").attributes[
"next_start"
] == mk_local("2021-01-04 12:00")
assert hass.states.get("binary_sensor.irrigation_unlimited_c1_z2").attributes[
"next_start"
] == mk_local("2021-01-04 12:07")
assert hass.states.get("binary_sensor.irrigation_unlimited_c1_z3").attributes[
"next_start"
] == mk_local("2021-01-04 12:07")
assert hass.states.get("binary_sensor.irrigation_unlimited_c1_z4").attributes[
"next_start"
] == mk_local("2021-01-04 12:20")

await exam.finish_test()
exam.check_summary()


Expand Down

0 comments on commit 07dce24

Please sign in to comment.