From 8bb0c2d619c20ca6803ec986bdf01446fafa05c9 Mon Sep 17 00:00:00 2001 From: Austin Mroczek Date: Sun, 28 Apr 2024 18:23:05 +0000 Subject: [PATCH 1/6] add py312 to tox --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 3f3c98e..8d513a5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,6 +40,7 @@ legacy_tox_ini = """ env_list = build lint + py312 py311 py310 py39 From 91ce8e994920c8305f1782f5a602450a2e6e777b Mon Sep 17 00:00:00 2001 From: Austin Mroczek Date: Sun, 28 Apr 2024 22:05:27 +0000 Subject: [PATCH 2/6] test for unknown ArmingState in location --- tests/test_location.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/test_location.py b/tests/test_location.py index a977afa..1960247 100644 --- a/tests/test_location.py +++ b/tests/test_location.py @@ -7,11 +7,13 @@ import pytest from const import ( LOCATION_INFO_BASIC_NORMAL, + METADATA_DISARMED, METADATA_DISARMED_LOW_BATTERY, RESPONSE_DISARMED, RESPONSE_GET_ZONE_DETAILS_SUCCESS, ) +from total_connect_client.const import ArmingState from total_connect_client.exceptions import PartialResponseError, TotalConnectError from total_connect_client.location import DEFAULT_USERCODE, TotalConnectLocation @@ -173,3 +175,21 @@ def tests_set_usercode(self): assert loc.set_usercode("1234") is True assert loc.usercode == "1234" assert mock_client.validate_usercode.call_count == 2 + + +def tests_update_status(): + """Test location._update_status().""" + location = TotalConnectLocation(LOCATION_INFO_BASIC_NORMAL, Mock()) + + # known arming state should not produce an error + response = { + "PanelMetadataAndStatus": METADATA_DISARMED, + "ArmingState": ArmingState.DISARMED, + } + location._update_status(response) + assert location.arming_state == ArmingState.DISARMED + + # unknown arming state should produce an error + with pytest.raises(TotalConnectError): + response["ArmingState"] = 10215 + location._update_status(response) From 076db60a2e104dc9a412a42b4244c2564063e63e Mon Sep 17 00:00:00 2001 From: Austin Mroczek Date: Sun, 28 Apr 2024 22:08:31 +0000 Subject: [PATCH 3/6] add ArmingState for 10215 --- total_connect_client/const.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/total_connect_client/const.py b/total_connect_client/const.py index 25b6e81..5d0a666 100644 --- a/total_connect_client/const.py +++ b/total_connect_client/const.py @@ -42,6 +42,7 @@ class ArmingState(Enum): ALARMING = 10207 ALARMING_FIRE_SMOKE = 10212 ALARMING_CARBON_MONOXIDE = 10213 + ALARMING_CARBON_MONOXIDE_PROA7 = 10215 ARMING = 10307 DISARMING = 10308 @@ -125,7 +126,10 @@ def is_triggered_fire(self): def is_triggered_gas(self): """Return True if the system is triggered for carbon monoxide.""" - return self == ArmingState.ALARMING_CARBON_MONOXIDE + return self in ( + ArmingState.ALARMING_CARBON_MONOXIDE, + ArmingState.ALARMING_CARBON_MONOXIDE_PROA7, + ) def is_triggered(self): """Return True if the system is triggered in any way.""" From 84bd9ad28d3b29181fe4641e1835fac840a61113 Mon Sep 17 00:00:00 2001 From: Austin Mroczek Date: Sun, 28 Apr 2024 22:09:13 +0000 Subject: [PATCH 4/6] use new unknown ArmingState in test --- tests/test_location.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_location.py b/tests/test_location.py index 1960247..a63d475 100644 --- a/tests/test_location.py +++ b/tests/test_location.py @@ -191,5 +191,5 @@ def tests_update_status(): # unknown arming state should produce an error with pytest.raises(TotalConnectError): - response["ArmingState"] = 10215 + response["ArmingState"] = 99999 location._update_status(response) From 7a87fe024d0271bf6dbe26dadab3e93896adae07 Mon Sep 17 00:00:00 2001 From: Austin Mroczek Date: Sun, 28 Apr 2024 22:59:44 +0000 Subject: [PATCH 5/6] update deps for testing --- pyproject.toml | 15 ++++++++------- requirements_test.txt | 3 ++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8d513a5..5e45fc9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,7 @@ classifiers = [ "Operating System :: OS Independent", ] keywords=["alarm", "TotalConnect"] -dependencies=["zeep>=4.1.0"] +dependencies=["zeep>=4.2.1"] [project.urls] "Homepage" = "https://github.com/craigjmidwinter/total-connect-client" @@ -37,13 +37,14 @@ disable = ["use-symbolic-message-instead", "too-few-public-methods", "too-many-i legacy_tox_ini = """ [tox] + requires = + tox>=4 + virtualenv>=20.26 + env_list = build lint - py312 - py311 - py310 - py39 + py{39,310,311,312} #skip_missing_interpreters = True @@ -51,11 +52,11 @@ legacy_tox_ini = """ setenv = LANG=en_US.UTF-8 PYTHONPATH = {toxinidir} - commands = - pytest --timeout=30 --cov=total_connect_client --cov-report term-missing -p no:sugar {posargs} deps = -r{toxinidir}/requirements.txt -r{toxinidir}/requirements_test.txt + commands = + pytest tests --timeout=30 --cov=total_connect_client --cov-report term-missing -p no:sugar {posargs} [testenv:lint] deps = diff --git a/requirements_test.txt b/requirements_test.txt index d33f44a..68e3d02 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,6 +1,6 @@ wheel>=0.29.0 build>=0.9.0 -tox>=2.8.1 +tox>=4.15.0 flake8>=3.4.1 flake8-docstrings>=1.1.0 pylint>=1.8.2 @@ -12,3 +12,4 @@ pytest-timeout>=1.0.0 restructuredtext-lint>=1.0.1 pygments>=2.2.0 requests_mock>=1.3.0 +virtualenv>=20.26 From 48ea1d6cd2bbfbdf3aff4bee0c0eafee49d6a170 Mon Sep 17 00:00:00 2001 From: Austin Mroczek Date: Sun, 28 Apr 2024 23:01:18 +0000 Subject: [PATCH 6/6] bump version to 2024.4 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 5e45fc9..5c6ba0f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta:__legacy__" [project] name="total_connect_client" -version="2023.12.1" +version="2024.4" authors = [ { name="Craig J. Midwinter", email="craig.j.midwinter@gmail.com" }, ]