Skip to content

Commit

Permalink
Fix log spam for loading alarms #580
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Dec 5, 2024
1 parent 74308e2 commit f62ff83
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion custom_components/yandex_station/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ async def async_update(self):
else:
self.next_event = None
except Exception as e:
_LOGGER.warning("Не удалось загрузить будильники", exc_info=e)
# https://github.com/AlexxIT/YandexStation/issues/580
if str(e).endswith("return 500 status"):
_LOGGER.debug(f"Не удалось загрузить будильники: {repr(e)}")
else:
_LOGGER.warning("Не удалось загрузить будильники", exc_info=e)

async def async_get_events(
self, hass: HomeAssistant, start_date: datetime, end_date: datetime
Expand Down
2 changes: 2 additions & 0 deletions custom_components/yandex_station/core/yandex_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,8 @@ async def request(self, method: str, url: str, retry: int = 2, **kwargs):
elif r.status == 403:
# 403 - no x-csrf-token
self.csrf_token = None
elif r.status == 500:
await asyncio.sleep(1)
else:
_LOGGER.warning(f"{url} return {r.status} status")

Expand Down

0 comments on commit f62ff83

Please # to comment.