mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Fix DarkSky spamming the log (#37421)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
parent
780376e411
commit
7c0d5526f3
@ -798,6 +798,7 @@ class DarkSkyData:
|
||||
self.longitude = longitude
|
||||
self.units = units
|
||||
self.language = language
|
||||
self._connect_error = False
|
||||
|
||||
self.data = None
|
||||
self.unit_system = None
|
||||
@ -825,7 +826,12 @@ class DarkSkyData:
|
||||
units=self.units,
|
||||
lang=self.language,
|
||||
)
|
||||
if self._connect_error:
|
||||
self._connect_error = False
|
||||
_LOGGER.info("Reconnected to Dark Sky")
|
||||
except (ConnectError, HTTPError, Timeout, ValueError) as error:
|
||||
if not self._connect_error:
|
||||
self._connect_error = True
|
||||
_LOGGER.error("Unable to connect to Dark Sky: %s", error)
|
||||
self.data = None
|
||||
self.unit_system = self.data and self.data.json["flags"]["units"]
|
||||
|
@ -241,6 +241,7 @@ class DarkSkyData:
|
||||
self.currently = None
|
||||
self.hourly = None
|
||||
self.daily = None
|
||||
self._connect_error = False
|
||||
|
||||
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
||||
def update(self):
|
||||
@ -252,7 +253,12 @@ class DarkSkyData:
|
||||
self.currently = self.data.currently()
|
||||
self.hourly = self.data.hourly()
|
||||
self.daily = self.data.daily()
|
||||
if self._connect_error:
|
||||
self._connect_error = False
|
||||
_LOGGER.info("Reconnected to Dark Sky")
|
||||
except (ConnectError, HTTPError, Timeout, ValueError) as error:
|
||||
if not self._connect_error:
|
||||
self._connect_error = True
|
||||
_LOGGER.error("Unable to connect to Dark Sky. %s", error)
|
||||
self.data = None
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user