From cd0a1250685239e0fefffcc6663ba16350a929c4 Mon Sep 17 00:00:00 2001 From: Pedro Ribeiro Date: Sun, 19 Nov 2023 21:11:36 +0000 Subject: [PATCH] Add new Homepilot Premium GW Support --- homepilot/api.py | 5 ++++- setup.py | 2 +- tests/test_api.py | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/homepilot/api.py b/homepilot/api.py index 01ad046..cee23e3 100644 --- a/homepilot/api.py +++ b/homepilot/api.py @@ -37,7 +37,10 @@ async def test_connection(host: str) -> str: try: response = await session.get(f"http://{host}/") if response.status != 200: - return "error" + response = await session.get(f"http://{host}/hp/devices/0") + if response.status != 200: + return "error" + return "ok_v2" response = await session.post( f"http://{host}/authentication/password_salt" ) diff --git a/setup.py b/setup.py index e1490f5..b5a1819 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="pyrademacher", - version="0.10.1", + version="0.11.1", author="Pedro Ribeiro", author_email="pedroeusebio@gmail.com", description="Control devices connected to your Rademacher Homepilot " diff --git a/tests/test_api.py b/tests/test_api.py index 8bf56e3..c8a4b41 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -30,6 +30,7 @@ async def test_test_connection(self): with aioresponses() as mocked: mocked.get(f"http://{TEST_HOST}/", status=500, body="") + mocked.get(f"http://{TEST_HOST}/hp/devices/0", status=500, body="") assert await HomePilotApi.test_connection(TEST_HOST) == "error" with aioresponses() as mocked: