diff --git a/custom_components/irrigation_unlimited/irrigation_unlimited.py b/custom_components/irrigation_unlimited/irrigation_unlimited.py index e5d9f29..9500b9c 100644 --- a/custom_components/irrigation_unlimited/irrigation_unlimited.py +++ b/custom_components/irrigation_unlimited/irrigation_unlimited.py @@ -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, diff --git a/tests/configs/service_manual_run.yaml b/tests/configs/service_manual_run.yaml index ec5b150..e6470c0 100644 --- a/tests/configs/service_manual_run.yaml +++ b/tests/configs/service_manual_run.yaml @@ -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: @@ -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: @@ -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" diff --git a/tests/test_service.py b/tests/test_service.py index fb75e2e..7df30e5 100644 --- a/tests/test_service.py +++ b/tests/test_service.py @@ -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()