Reduce log spam (#33592)

* Reduce log spam

* Reduce log spam

* Revert
This commit is contained in:
cgtobi 2020-04-03 23:01:24 +02:00 committed by GitHub
parent f1d3c0d19b
commit 851c1711d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 10 deletions

View File

@ -386,6 +386,7 @@ class NetatmoThermostat(ClimateDevice):
) )
self._connected = True self._connected = True
except KeyError as err: except KeyError as err:
if self._connected is not False:
_LOGGER.debug( _LOGGER.debug(
"The thermostat in room %s seems to be out of reach. (%s)", "The thermostat in room %s seems to be out of reach. (%s)",
self._room_name, self._room_name,

View File

@ -220,6 +220,11 @@ class NetatmoSensor(Entity):
"""Return the unique ID for this sensor.""" """Return the unique ID for this sensor."""
return self._unique_id return self._unique_id
@property
def available(self):
"""Return True if entity is available."""
return bool(self._state)
def update(self): def update(self):
"""Get the latest data from Netatmo API and updates the states.""" """Get the latest data from Netatmo API and updates the states."""
self.netatmo_data.update() self.netatmo_data.update()
@ -233,6 +238,7 @@ class NetatmoSensor(Entity):
data = self.netatmo_data.data.get(self._module_id) data = self.netatmo_data.data.get(self._module_id)
if data is None: if data is None:
if self._state:
_LOGGER.debug( _LOGGER.debug(
"No data found for %s (%s)", self.module_name, self._module_id "No data found for %s (%s)", self.module_name, self._module_id
) )
@ -391,6 +397,7 @@ class NetatmoSensor(Entity):
elif data["health_idx"] == 4: elif data["health_idx"] == 4:
self._state = "Unhealthy" self._state = "Unhealthy"
except KeyError: except KeyError:
if self._state:
_LOGGER.info("No %s data found for %s", self.type, self.module_name) _LOGGER.info("No %s data found for %s", self.type, self.module_name)
self._state = None self._state = None
return return