Skip to content

Commit 49e91a0

Browse files
committed
more v27 html fixes
1 parent 7ba5dd8 commit 49e91a0

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

pyadtpulse/site.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,21 @@ def _update_zone_from_soup(self, soup: BeautifulSoup) -> Optional[ADTPulseZones]
363363
with self._site_lock:
364364
gateway_online = False
365365
for row in soup.find_all("tr", {"class": "p_listRow"}):
366+
temp = row.find("div", {"class": "p_grayNormalText"})
367+
# v26 and lower: temp = row.find("span", {"class": "p_grayNormalText"})
368+
if temp is None:
369+
break
370+
try:
371+
zone = int(
372+
remove_prefix(
373+
temp.get_text(),
374+
"Zone",
375+
)
376+
)
377+
except ValueError:
378+
LOG.debug("skipping row due to zone not being an integer")
379+
continue
380+
# parse out last activity (required dealing with "Yesterday 1:52 PM")
366381
temp = row.find("span", {"class": "devStatIcon"})
367382
if temp is None:
368383
break
@@ -374,15 +389,7 @@ def _update_zone_from_soup(self, soup: BeautifulSoup) -> Optional[ADTPulseZones]
374389
except ValueError:
375390
last_update = datetime(1970, 1, 1)
376391
# name = row.find("a", {"class": "p_deviceNameText"}).get_text()
377-
temp = row.find("div", {"class": "p_grayNormalText"})
378-
if temp is None:
379-
break
380-
zone = int(
381-
remove_prefix(
382-
temp.get_text(),
383-
"Zone\xa0",
384-
)
385-
)
392+
386393
state = remove_prefix(
387394
row.find("canvas", {"class": "p_ic_icon_device"}).get("icon"),
388395
"devStat",

0 commit comments

Comments
 (0)