Skip to content

Commit

Permalink
Merge pull request #4 from rlippmann/1.1.5
Browse files Browse the repository at this point in the history
1.1.5
  • Loading branch information
rlippmann authored Dec 22, 2023
2 parents 7ba5dd8 + 94d8d0d commit 9e699b0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyadtpulse/const.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
27 changes: 18 additions & 9 deletions pyadtpulse/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,26 +363,35 @@ 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
last_update = datetime(1970, 1, 1)
try:
last_update = parse_pulse_datetime(
remove_prefix(temp.get("title"), "Last Event:")
.lstrip()
.rstrip()
)
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",
Expand Down

0 comments on commit 9e699b0

Please sign in to comment.