Skip to content

Commit

Permalink
Suppress error between 00:00 and 01:00 (home-assistant#15555)
Browse files Browse the repository at this point in the history
* Suppress error between 00:00 and 01:00

Suppress an error that often occers between 00:00 and 01:00 CE(S)T during that time, probably because buienradar.nl is then updating its forcast for the next day. The API does not always work between these times (in the middle of the night).

* white space & import

* unnecessary brackets
  • Loading branch information
starkillerOG authored and michaeldavie committed Jul 31, 2018
1 parent f673e3f commit f4f3a93
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions homeassistant/components/sensor/buienradar.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
https://home-assistant.io/components/sensor.buienradar/
"""
import asyncio
from datetime import timedelta
from datetime import datetime, timedelta
import logging

import async_timeout
Expand Down Expand Up @@ -481,9 +481,10 @@ def async_update(self, *_):

_LOGGER.debug("Buienradar parsed data: %s", result)
if result.get(SUCCESS) is not True:
_LOGGER.warning("Unable to parse data from Buienradar."
"(Msg: %s)",
result.get(MESSAGE),)
if int(datetime.now().strftime('%H')) > 0:
_LOGGER.warning("Unable to parse data from Buienradar."
"(Msg: %s)",
result.get(MESSAGE),)
yield from self.schedule_update(SCHEDULE_NOK)
return

Expand Down

0 comments on commit f4f3a93

Please sign in to comment.