Suppress error between 00:00 and 01:00 (#15555)

* 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
This commit is contained in:
starkillerOG 2018-07-23 12:37:23 +02:00 committed by Paulus Schoutsen
parent 3acbd5a769
commit 50b6c5948d

View File

@ -5,7 +5,7 @@ For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.buienradar/
"""
import asyncio
from datetime import timedelta
from datetime import datetime, timedelta
import logging
import async_timeout
@ -481,9 +481,10 @@ class BrData:
_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