From 03868806e5172c23d67da70aed53717959978004 Mon Sep 17 00:00:00 2001 From: PeteRager <76050312+PeteRager@users.noreply.github.com> Date: Sat, 6 Jan 2024 08:31:59 -0500 Subject: [PATCH] Retrieve min and max temperatures when in emergency heat mode --- .vscode/launch.json | 22 ++++++++++++++-------- .vscode/settings.json | 8 ++++++-- custom_components/lennoxs30/climate.py | 4 ++-- pytest.ini | 2 ++ tests/conftest.py | 4 ++++ tests/test_climate.py | 4 ++++ 6 files changed, 32 insertions(+), 12 deletions(-) create mode 100644 pytest.ini diff --git a/.vscode/launch.json b/.vscode/launch.json index fbc0b20..4bae663 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,11 +1,17 @@ { - "version": "0.2.0", "configurations": [ - { - "name": "Debug test", - "type": "python", - "request": "attach", - "justMyCode": false - } - ] + { + "name": "Python: Debug Tests", + "type": "python", + "request": "launch", + "program": "${file}", + "purpose": ["debug-test"], + "console": "integratedTerminal", + "justMyCode": false, + "presentation": { + "hidden": true, // keep original launch order in 'run and debug' tab + } + }, + ], + "version": "0.2.0" } diff --git a/.vscode/settings.json b/.vscode/settings.json index 25602b3..4d9ab92 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,10 @@ { - "python.testing.pytestArgs": ["tests", "--asyncio-mode=auto"], + "python.testing.pytestArgs": [ + "tests","--asyncio-mode=auto" + ], "python.testing.unittestEnabled": false, "python.testing.pytestEnabled": true, + "python.experiments.enabled": false, "cSpell.words": [ "ASHRAE", "automations", @@ -26,5 +29,6 @@ "python.linting.flake8Enabled": false, "python.linting.enabled": true, "python.linting.flake8Args": ["--config=setup.cfg", "--doctests"], - "python.linting.pylintEnabled": true + "python.linting.pylintEnabled": true, + } diff --git a/custom_components/lennoxs30/climate.py b/custom_components/lennoxs30/climate.py index ccbea68..13418e0 100644 --- a/custom_components/lennoxs30/climate.py +++ b/custom_components/lennoxs30/climate.py @@ -237,7 +237,7 @@ def min_temp(self): if self._manager.is_metric is False: return self._zone.minCsp return self._zone.minCspC - if self._zone.systemMode == LENNOX_HVAC_HEAT: + if self._zone.systemMode in [LENNOX_HVAC_HEAT,LENNOX_HVAC_EMERGENCY_HEAT]: if self._manager.is_metric is False: return self._zone.minHsp return self._zone.minHspC @@ -264,7 +264,7 @@ def max_temp(self): if self._manager.is_metric is False: return self._zone.maxCsp return self._zone.maxCspC - if self._zone.systemMode == LENNOX_HVAC_HEAT: + if self._zone.systemMode in [LENNOX_HVAC_HEAT,LENNOX_HVAC_EMERGENCY_HEAT]: if self._manager.is_metric is False: return self._zone.maxHsp return self._zone.maxHspC diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..9e098ae --- /dev/null +++ b/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +addopts = --allow-unix-socket \ No newline at end of file diff --git a/tests/conftest.py b/tests/conftest.py index 6dd4dad..d04bcaa 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -76,6 +76,10 @@ pytest_plugins = "pytest_homeassistant_custom_component" +@pytest.fixture(autouse=True) +def socket_enabled(): + pass + @pytest.fixture(autouse=True) def auto_enable_custom_integrations(enable_custom_integrations): yield diff --git a/tests/test_climate.py b/tests/test_climate.py index 88670fc..8eeb472 100644 --- a/tests/test_climate.py +++ b/tests/test_climate.py @@ -107,6 +107,10 @@ async def test_climate_min_max_c(hass, manager_mz: Manager): assert c.min_temp == zone.minHspC assert c.max_temp == zone.maxHspC + zone.systemMode = LENNOX_HVAC_EMERGENCY_HEAT + assert c.min_temp == zone.minHspC + assert c.max_temp == zone.maxHspC + assert system.single_setpoint_mode is True zone.systemMode = LENNOX_HVAC_HEAT_COOL assert c.min_temp == zone.minCspC