From 483c2fcc5d846e062290e4111344eab1e0748c8e Mon Sep 17 00:00:00 2001 From: mmccrackan Date: Fri, 2 Oct 2026 11:31:33 -0400 Subject: [PATCH 1/5] add set_hvac --- src/sorunlib/acu.py | 15 +++++++++++++++ tests/test_acu.py | 8 ++++++++ 2 files changed, 23 insertions(+) diff --git a/src/sorunlib/acu.py b/src/sorunlib/acu.py index 4681536..f7b2e2b 100644 --- a/src/sorunlib/acu.py +++ b/src/sorunlib/acu.py @@ -96,3 +96,18 @@ def set_shutter(action): acu = run.CLIENTS['acu'] resp = acu.set_shutter(action=action) check_response(acu, resp) + + +def set_hvac(targets, values): + """Turn the hvac system for the LAT on or off. + + Args: + targets (list of str): Which subsystems to turn on or off, + which can be 'boosters' and/or 'fans'. + values (str or list of str): Value to set for each target. + If str, broadcast to all targets. + + """ + acu = run.CLIENTS['acu'] + resp = acu.set_hvac(targets=targets, values=values) + check_response(acu, resp) diff --git a/tests/test_acu.py b/tests/test_acu.py index 4cbc757..3ae6f67 100644 --- a/tests/test_acu.py +++ b/tests/test_acu.py @@ -79,3 +79,11 @@ def test_set_scan_params(patch_clients_satp): def test_set_shutter(patch_clients_satp, action): acu.set_shutter(action=action) acu.run.CLIENTS['acu'].set_shutter.assert_called_with(action=action) + + +@pytest.mark.parametrize("values", [('on'), ('off')]) +def test_set_hvac(patch_clients_lat, values): + targets=targets=["boosters", "fans"] + acu.set_hvac(targets=targets, values=values) + acu.run.CLIENTS['acu'].set_hvac.assert_called_with( + targets=targets, values=values) From bffc439830304fe710a8664c89a3fd2cb115d333 Mon Sep 17 00:00:00 2001 From: mmccrackan Date: Fri, 2 Oct 2026 11:34:09 -0400 Subject: [PATCH 2/5] fix typo --- tests/test_acu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_acu.py b/tests/test_acu.py index 3ae6f67..6740647 100644 --- a/tests/test_acu.py +++ b/tests/test_acu.py @@ -83,7 +83,7 @@ def test_set_shutter(patch_clients_satp, action): @pytest.mark.parametrize("values", [('on'), ('off')]) def test_set_hvac(patch_clients_lat, values): - targets=targets=["boosters", "fans"] + targets = ["boosters", "fans"] acu.set_hvac(targets=targets, values=values) acu.run.CLIENTS['acu'].set_hvac.assert_called_with( targets=targets, values=values) From ae13209d39ab81bc9f01d3ccfa5c062b9cf6ca10 Mon Sep 17 00:00:00 2001 From: mmccrackan Date: Fri, 2 Oct 2026 11:36:23 -0400 Subject: [PATCH 3/5] remove examples in docstring --- src/sorunlib/acu.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/sorunlib/acu.py b/src/sorunlib/acu.py index f7b2e2b..03d28a1 100644 --- a/src/sorunlib/acu.py +++ b/src/sorunlib/acu.py @@ -102,8 +102,7 @@ def set_hvac(targets, values): """Turn the hvac system for the LAT on or off. Args: - targets (list of str): Which subsystems to turn on or off, - which can be 'boosters' and/or 'fans'. + targets (list of str): Which subsystems to turn on or off. values (str or list of str): Value to set for each target. If str, broadcast to all targets. From d207e4fc747245bd3db902c559b24f7d76ca7049 Mon Sep 17 00:00:00 2001 From: mmccrackan Date: Fri, 2 Oct 2026 12:00:59 -0400 Subject: [PATCH 4/5] improve docstring and test --- src/sorunlib/acu.py | 8 +++++--- tests/test_acu.py | 12 +++++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/sorunlib/acu.py b/src/sorunlib/acu.py index 03d28a1..1b12533 100644 --- a/src/sorunlib/acu.py +++ b/src/sorunlib/acu.py @@ -102,9 +102,11 @@ def set_hvac(targets, values): """Turn the hvac system for the LAT on or off. Args: - targets (list of str): Which subsystems to turn on or off. - values (str or list of str): Value to set for each target. - If str, broadcast to all targets. + targets (list of str): List of devices to set. + values (int, float, str, or list): Values to set for each target. + If a value matches 'on' or 'off', it will turn the device on or off. + Otherwise, it will be interpreted as a 'setpoint' (i.e fan speed %). + If values is a scalar, broadcast to all targets. """ acu = run.CLIENTS['acu'] diff --git a/tests/test_acu.py b/tests/test_acu.py index 6740647..ae06477 100644 --- a/tests/test_acu.py +++ b/tests/test_acu.py @@ -81,9 +81,15 @@ def test_set_shutter(patch_clients_satp, action): acu.run.CLIENTS['acu'].set_shutter.assert_called_with(action=action) -@pytest.mark.parametrize("values", [('on'), ('off')]) -def test_set_hvac(patch_clients_lat, values): - targets = ["boosters", "fans"] +@pytest.mark.parametrize( + "targets, values", + [ + (["boosters", "fans"], ["on", "on"]), + (["boosters", "fans"], "off"), + (["fans"], 50), + ], +) +def test_set_hvac(patch_clients_lat, targets, values): acu.set_hvac(targets=targets, values=values) acu.run.CLIENTS['acu'].set_hvac.assert_called_with( targets=targets, values=values) From bdabf0b76de50c3cb20aa65ec9214262895ca978 Mon Sep 17 00:00:00 2001 From: mmccrackan Date: Fri, 2 Oct 2026 17:17:06 -0400 Subject: [PATCH 5/5] update docstring --- src/sorunlib/acu.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sorunlib/acu.py b/src/sorunlib/acu.py index 1b12533..05b9755 100644 --- a/src/sorunlib/acu.py +++ b/src/sorunlib/acu.py @@ -102,7 +102,9 @@ def set_hvac(targets, values): """Turn the hvac system for the LAT on or off. Args: - targets (list of str): List of devices to set. + targets (list of str): List of devices to set. Valid targets include + 'fans', 'boosters', 'heaters' or specific devices out of these + categories, such as 'Booster Yoke Traverse M Servo Space'. values (int, float, str, or list): Values to set for each target. If a value matches 'on' or 'off', it will turn the device on or off. Otherwise, it will be interpreted as a 'setpoint' (i.e fan speed %).