Add Netatmo error logging when no public stations are available (#65298)

* Log error if public stations don't provide data

Signed-off-by: cgtobi <cgtobi@gmail.com>

* Only log once

Signed-off-by: cgtobi <cgtobi@gmail.com>

* Update homeassistant/components/netatmo/sensor.py

Co-authored-by: Shay Levy <levyshay1@gmail.com>

Co-authored-by: Shay Levy <levyshay1@gmail.com>
pull/65389/head
Tobias Sauerwein 2022-02-01 21:06:03 +01:00 committed by GitHub
parent 9f5d77e0df
commit 3718d7fca8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 9 deletions

View File

@ -839,15 +839,16 @@ class NetatmoPublicSensor(NetatmoBase, SensorEntity):
elif self.entity_description.key == "guststrength":
data = self._data.get_latest_gust_strengths()
if data is None:
if self.state is None:
return
_LOGGER.debug(
"No station provides %s data in the area %s",
self.entity_description.key,
self._area_name,
)
self._attr_native_value = None
if not data:
if self.available:
_LOGGER.error(
"No station provides %s data in the area %s",
self.entity_description.key,
self._area_name,
)
self._attr_native_value = None
self._attr_available = False
return
if values := [x for x in data.values() if x is not None]: