From 6da219cff0a9d7730d99e99b8755dc9756a300ed Mon Sep 17 00:00:00 2001 From: Robert Lippmann Date: Wed, 13 Dec 2023 23:29:15 -0500 Subject: [PATCH 1/7] fix html parse for pulse v27 --- pyadtpulse/site.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyadtpulse/site.py b/pyadtpulse/site.py index 2f9b85e..b7a2b4c 100644 --- a/pyadtpulse/site.py +++ b/pyadtpulse/site.py @@ -374,7 +374,7 @@ def _update_zone_from_soup(self, soup: BeautifulSoup) -> Optional[ADTPulseZones] except ValueError: last_update = datetime(1970, 1, 1) # name = row.find("a", {"class": "p_deviceNameText"}).get_text() - temp = row.find("span", {"class": "p_grayNormalText"}) + temp = row.find("div", {"class": "p_grayNormalText"}) if temp is None: break zone = int( From 83baf53122a95c0e7eac58a1ff21634c7db35b66 Mon Sep 17 00:00:00 2001 From: rlippmann <70883373+rlippmann@users.noreply.github.com> Date: Wed, 13 Dec 2023 23:40:51 -0500 Subject: [PATCH 2/7] bump version --- pyadtpulse/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyadtpulse/const.py b/pyadtpulse/const.py index aa6268d..e2c4eea 100644 --- a/pyadtpulse/const.py +++ b/pyadtpulse/const.py @@ -1,5 +1,5 @@ """Constants for pyadtpulse.""" -__version__ = "1.1.3" +__version__ = "1.1.4" DEFAULT_API_HOST = "https://portal.adtpulse.com" API_HOST_CA = "https://portal-ca.adtpulse.com" # Canada From 7ba5dd891cd18f4eccd90471123f777fa0e2731d Mon Sep 17 00:00:00 2001 From: rlippmann <70883373+rlippmann@users.noreply.github.com> Date: Wed, 13 Dec 2023 23:41:44 -0500 Subject: [PATCH 3/7] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index da6bda8..65be9c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.1.4 (2023-12-13) + +* fix zone html parsing due to changes in Pulse v27 + ## 1.1.3 (2023-10-11) * revert sync check logic to check against last check value. this should hopefully fix the problem of HA alarm status not updating From 49e91a056f463e737e4d3c1a54f31c6bcd127619 Mon Sep 17 00:00:00 2001 From: Robert Lippmann Date: Fri, 22 Dec 2023 03:42:29 -0500 Subject: [PATCH 4/7] more v27 html fixes --- pyadtpulse/site.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/pyadtpulse/site.py b/pyadtpulse/site.py index b7a2b4c..cf9fff2 100644 --- a/pyadtpulse/site.py +++ b/pyadtpulse/site.py @@ -363,6 +363,21 @@ def _update_zone_from_soup(self, soup: BeautifulSoup) -> Optional[ADTPulseZones] with self._site_lock: gateway_online = False for row in soup.find_all("tr", {"class": "p_listRow"}): + temp = row.find("div", {"class": "p_grayNormalText"}) + # v26 and lower: temp = row.find("span", {"class": "p_grayNormalText"}) + if temp is None: + break + try: + zone = int( + remove_prefix( + temp.get_text(), + "Zone", + ) + ) + except ValueError: + LOG.debug("skipping row due to zone not being an integer") + continue + # parse out last activity (required dealing with "Yesterday 1:52 PM") temp = row.find("span", {"class": "devStatIcon"}) if temp is None: break @@ -374,15 +389,7 @@ def _update_zone_from_soup(self, soup: BeautifulSoup) -> Optional[ADTPulseZones] except ValueError: last_update = datetime(1970, 1, 1) # name = row.find("a", {"class": "p_deviceNameText"}).get_text() - temp = row.find("div", {"class": "p_grayNormalText"}) - if temp is None: - break - zone = int( - remove_prefix( - temp.get_text(), - "Zone\xa0", - ) - ) + state = remove_prefix( row.find("canvas", {"class": "p_ic_icon_device"}).get("icon"), "devStat", From 0c86f8ab1c083ec863577e1a9aea9dc78eac929b Mon Sep 17 00:00:00 2001 From: Robert Lippmann Date: Fri, 22 Dec 2023 03:49:56 -0500 Subject: [PATCH 5/7] strip whitespace when trying to find last event date/time --- pyadtpulse/site.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyadtpulse/site.py b/pyadtpulse/site.py index cf9fff2..b010e86 100644 --- a/pyadtpulse/site.py +++ b/pyadtpulse/site.py @@ -385,6 +385,8 @@ def _update_zone_from_soup(self, soup: BeautifulSoup) -> Optional[ADTPulseZones] try: last_update = parse_pulse_datetime( remove_prefix(temp.get("title"), "Last Event:") + .lstrip() + .rstrip() ) except ValueError: last_update = datetime(1970, 1, 1) From 79afa8f53fb78666bf6760a595fd9dc0141ea55e Mon Sep 17 00:00:00 2001 From: Robert Lippmann Date: Fri, 22 Dec 2023 03:51:06 -0500 Subject: [PATCH 6/7] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65be9c7..d589094 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.1.5 (2023-12-22) + +* fix more zone html parsing due to changes in Pulse v27 + ## 1.1.4 (2023-12-13) * fix zone html parsing due to changes in Pulse v27 From 94d8d0d1920a81999d6cf845aacb4349bc446553 Mon Sep 17 00:00:00 2001 From: Robert Lippmann Date: Fri, 22 Dec 2023 03:52:15 -0500 Subject: [PATCH 7/7] bump version to 1.1.5 --- pyadtpulse/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyadtpulse/const.py b/pyadtpulse/const.py index e2c4eea..22a2a0c 100644 --- a/pyadtpulse/const.py +++ b/pyadtpulse/const.py @@ -1,5 +1,5 @@ """Constants for pyadtpulse.""" -__version__ = "1.1.4" +__version__ = "1.1.5" DEFAULT_API_HOST = "https://portal.adtpulse.com" API_HOST_CA = "https://portal-ca.adtpulse.com" # Canada