diff --git a/src/sorunlib/acu.py b/src/sorunlib/acu.py index 4681536..05b9755 100644 --- a/src/sorunlib/acu.py +++ b/src/sorunlib/acu.py @@ -96,3 +96,21 @@ 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): 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 %). + If values is a scalar, 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..ae06477 100644 --- a/tests/test_acu.py +++ b/tests/test_acu.py @@ -79,3 +79,17 @@ 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( + "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)