mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Fix missing Netatmo sensors (#28899)
* Update pyatmo to 3.0.1 * Improve sensor name * Fix missing sensors * Update pyatmo module * Update pyatmo to 3.1.0 * Update requirements * Fix method call
This commit is contained in:
parent
c7c7a9ad06
commit
86e581b83d
@ -259,4 +259,4 @@ class CameraData:
|
|||||||
@Throttle(MIN_TIME_BETWEEN_EVENT_UPDATES)
|
@Throttle(MIN_TIME_BETWEEN_EVENT_UPDATES)
|
||||||
def update_event(self):
|
def update_event(self):
|
||||||
"""Call the Netatmo API to update the events."""
|
"""Call the Netatmo API to update the events."""
|
||||||
self.camera_data.updateEvent(home=self.home, cameratype=self.camera_type)
|
self.camera_data.updateEvent(home=self.home, devicetype=self.camera_type)
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"name": "Netatmo",
|
"name": "Netatmo",
|
||||||
"documentation": "https://www.home-assistant.io/integrations/netatmo",
|
"documentation": "https://www.home-assistant.io/integrations/netatmo",
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"pyatmo==3.0.1"
|
"pyatmo==3.1.0"
|
||||||
],
|
],
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"webhook"
|
"webhook"
|
||||||
|
@ -155,14 +155,12 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
for module in all_module_infos.values():
|
for module in all_module_infos.values():
|
||||||
if module["module_name"] not in module_names:
|
if module["module_name"] not in module_names:
|
||||||
continue
|
continue
|
||||||
|
_LOGGER.debug(
|
||||||
|
"Adding module %s %s", module["module_name"], module["id"]
|
||||||
|
)
|
||||||
for condition in data.station_data.monitoredConditions(
|
for condition in data.station_data.monitoredConditions(
|
||||||
moduleId=module["id"]
|
moduleId=module["id"]
|
||||||
):
|
):
|
||||||
_LOGGER.debug(
|
|
||||||
"Adding %s %s",
|
|
||||||
module["module_name"],
|
|
||||||
data.station_data.moduleById(mid=module["id"]),
|
|
||||||
)
|
|
||||||
entities.append(NetatmoSensor(data, module, condition.lower()))
|
entities.append(NetatmoSensor(data, module, condition.lower()))
|
||||||
return entities
|
return entities
|
||||||
|
|
||||||
@ -200,18 +198,26 @@ class NetatmoSensor(Entity):
|
|||||||
def __init__(self, netatmo_data, module_info, sensor_type):
|
def __init__(self, netatmo_data, module_info, sensor_type):
|
||||||
"""Initialize the sensor."""
|
"""Initialize the sensor."""
|
||||||
self.netatmo_data = netatmo_data
|
self.netatmo_data = netatmo_data
|
||||||
module = self.netatmo_data.station_data.moduleById(mid=module_info["id"])
|
|
||||||
if module["type"] == "NHC":
|
device = self.netatmo_data.station_data.moduleById(mid=module_info["id"])
|
||||||
|
if not device:
|
||||||
|
# Assume it's a station if module can't be found
|
||||||
|
device = self.netatmo_data.station_data.stationById(sid=module_info["id"])
|
||||||
|
|
||||||
|
if device["type"] == "NHC":
|
||||||
self.module_name = module_info["station_name"]
|
self.module_name = module_info["station_name"]
|
||||||
else:
|
else:
|
||||||
self.module_name = module_info["module_name"]
|
self.module_name = (
|
||||||
|
f"{module_info['station_name']} {module_info['module_name']}"
|
||||||
|
)
|
||||||
|
|
||||||
self._name = f"{DOMAIN} {self.module_name} {SENSOR_TYPES[sensor_type][0]}"
|
self._name = f"{DOMAIN} {self.module_name} {SENSOR_TYPES[sensor_type][0]}"
|
||||||
self.type = sensor_type
|
self.type = sensor_type
|
||||||
self._state = None
|
self._state = None
|
||||||
self._device_class = SENSOR_TYPES[self.type][3]
|
self._device_class = SENSOR_TYPES[self.type][3]
|
||||||
self._icon = SENSOR_TYPES[self.type][2]
|
self._icon = SENSOR_TYPES[self.type][2]
|
||||||
self._unit_of_measurement = SENSOR_TYPES[self.type][1]
|
self._unit_of_measurement = SENSOR_TYPES[self.type][1]
|
||||||
self._module_type = module["type"]
|
self._module_type = device["type"]
|
||||||
self._module_id = module_info["id"]
|
self._module_id = module_info["id"]
|
||||||
self._unique_id = f"{self._module_id}-{self.type}"
|
self._unique_id = f"{self._module_id}-{self.type}"
|
||||||
|
|
||||||
|
@ -1115,7 +1115,7 @@ pyalmond==0.0.2
|
|||||||
pyarlo==0.2.3
|
pyarlo==0.2.3
|
||||||
|
|
||||||
# homeassistant.components.netatmo
|
# homeassistant.components.netatmo
|
||||||
pyatmo==3.0.1
|
pyatmo==3.1.0
|
||||||
|
|
||||||
# homeassistant.components.atome
|
# homeassistant.components.atome
|
||||||
pyatome==0.1.1
|
pyatome==0.1.1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user