Skip to content

Commit

Permalink
Add adjustment to zone manual run w/ default time
Browse files Browse the repository at this point in the history
  • Loading branch information
rgc99 committed Jun 3, 2023
1 parent b237dec commit 158ceb5
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1642,6 +1642,7 @@ def service_manual_run(self, data: MappingProxyType, stime: datetime) -> None:
duration = self._duration
if duration is None:
return
duration = self._adjustment.adjust(duration)
self._run_queue.add_manual(
self._controller.manual_run_start(stime),
duration,
Expand Down
12 changes: 10 additions & 2 deletions tests/configs/service_manual_run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ irrigation_unlimited:
- {t: '2021-01-04 08:16:00', c: 1, z: 1, s: 1}
- {t: '2021-01-04 08:31:00', c: 1, z: 1, s: 0}
- {t: '2021-01-04 08:32:00', c: 1, z: 0, s: 0}
- name: '10-Manual run with no time Zone 1'
- name: '10-Manual run with zero time Zone 1'
start: '2021-01-04 08:00'
end: '2021-01-04 09:00'
results:
Expand All @@ -116,7 +116,7 @@ irrigation_unlimited:
- {t: '2021-01-04 08:16:00', c: 1, z: 2, s: 1}
- {t: '2021-01-04 08:26:00', c: 1, z: 2, s: 0}
- {t: '2021-01-04 08:27:00', c: 1, z: 0, s: 0}
- name: '12-Manual run with no time Zone 2'
- name: '12-Manual run with zero time Zone 2'
start: '2021-01-04 08:00'
end: '2021-01-04 09:00'
results:
Expand All @@ -128,6 +128,14 @@ irrigation_unlimited:
start: '2021-01-04 08:00'
end: '2021-01-04 09:00'
results: []
- name: '14-Manual run with no time Zone 1 adjusted 50%'
start: '2021-01-04 08:00'
end: '2021-01-04 09:00'
results:
- {t: '2021-01-04 08:15:00', c: 1, z: 0, s: 1}
- {t: '2021-01-04 08:16:00', c: 1, z: 1, s: 1}
- {t: '2021-01-04 08:23:30', c: 1, z: 1, s: 0}
- {t: '2021-01-04 08:24:30', c: 1, z: 0, s: 0}
controllers:
- name: "Test controller 1"
preamble: "00:01"
Expand Down
17 changes: 17 additions & 0 deletions tests/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,23 @@ async def test_service_manual_run(
)
await exam.finish_test()

await exam.begin_test(14)
await exam.call(
SERVICE_TIME_ADJUST,
{"entity_id": "binary_sensor.irrigation_unlimited_c1_z1", "percentage": 50},
)
await exam.run_until("2021-01-04 08:14:59")
await exam.call(
SERVICE_MANUAL_RUN,
{"entity_id": "binary_sensor.irrigation_unlimited_c1_z1"},
)
await exam.run_until("2021-01-04 08:30:00")
await exam.call(
SERVICE_TIME_ADJUST,
{"entity_id": "binary_sensor.irrigation_unlimited_c1_z1", "reset": None},
)
await exam.finish_test()

exam.check_summary()


Expand Down

0 comments on commit 158ceb5

Please sign in to comment.