Adjust scrape coordinator logging (#81299)

This commit is contained in:
epenet 2022-10-31 13:21:37 +01:00 committed by GitHub
parent dd092d86d4
commit 283f8585b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -33,4 +33,6 @@ class ScrapeCoordinator(DataUpdateCoordinator[BeautifulSoup]):
await self._rest.async_update()
if (data := self._rest.data) is None:
raise UpdateFailed("REST data is not available")
return await self.hass.async_add_executor_job(BeautifulSoup, data, "lxml")
soup = await self.hass.async_add_executor_job(BeautifulSoup, data, "lxml")
_LOGGER.debug("Raw beautiful soup: %s", soup)
return soup

View file

@ -170,7 +170,6 @@ class ScrapeSensor(CoordinatorEntity[ScrapeCoordinator], TemplateSensor):
def _extract_value(self) -> Any:
"""Parse the html extraction in the executor."""
raw_data = self.coordinator.data
_LOGGER.debug("Raw beautiful soup: %s", raw_data)
try:
if self._attr is not None:
value = raw_data.select(self._select)[self._index][self._attr]