From 50b6c5948d5912046864946fd02b2fb3afc2ea6b Mon Sep 17 00:00:00 2001 From: starkillerOG Date: Mon, 23 Jul 2018 12:37:23 +0200 Subject: [PATCH] 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 --- homeassistant/components/sensor/buienradar.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/sensor/buienradar.py b/homeassistant/components/sensor/buienradar.py index 33c7e432fca..992c27bbe2e 100644 --- a/homeassistant/components/sensor/buienradar.py +++ b/homeassistant/components/sensor/buienradar.py @@ -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