Fix Netatmo climate issue (#61154)

Signed-off-by: cgtobi <cgtobi@gmail.com>
This commit is contained in:
Tobias Sauerwein 2021-12-07 13:56:31 +01:00 committed by GitHub
parent f0006b92be
commit 45c463b61c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 121 additions and 10 deletions

View file

@ -135,9 +135,14 @@ async def async_setup_entry(
entities = []
for home_id in climate_topology.home_ids:
signal_name = f"{CLIMATE_STATE_CLASS_NAME}-{home_id}"
await data_handler.register_data_class(
CLIMATE_STATE_CLASS_NAME, signal_name, None, home_id=home_id
)
try:
await data_handler.register_data_class(
CLIMATE_STATE_CLASS_NAME, signal_name, None, home_id=home_id
)
except KeyError:
continue
climate_state = data_handler.data[signal_name]
climate_topology.register_handler(home_id, climate_state.process_topology)

View file

@ -194,7 +194,11 @@ class NetatmoDataHandler:
self._auth, **kwargs
)
await self.async_fetch_data(data_class_entry)
try:
await self.async_fetch_data(data_class_entry)
except KeyError:
self.data_classes.pop(data_class_entry)
raise
self._queue.append(self.data_classes[data_class_entry])
_LOGGER.debug("Data class %s added", data_class_entry)

View file

@ -48,6 +48,14 @@ async def async_setup_entry(
entities = []
for home_id in climate_topology.home_ids:
signal_name = f"{CLIMATE_STATE_CLASS_NAME}-{home_id}"
try:
await data_handler.register_data_class(
CLIMATE_STATE_CLASS_NAME, signal_name, None, home_id=home_id
)
except KeyError:
continue
await data_handler.register_data_class(
CLIMATE_STATE_CLASS_NAME, signal_name, None, home_id=home_id
)

View file

@ -5,7 +5,10 @@
"id": "91763b24c43d3e344f424e8b",
"name": "MYHOME",
"altitude": 112,
"coordinates": [52.516263, 13.377726],
"coordinates": [
52.516263,
13.377726
],
"country": "DE",
"timezone": "Europe/Berlin",
"rooms": [
@ -13,25 +16,33 @@
"id": "2746182631",
"name": "Livingroom",
"type": "livingroom",
"module_ids": ["12:34:56:00:01:ae"]
"module_ids": [
"12:34:56:00:01:ae"
]
},
{
"id": "3688132631",
"name": "Hall",
"type": "custom",
"module_ids": ["12:34:56:00:f1:62"]
"module_ids": [
"12:34:56:00:f1:62"
]
},
{
"id": "2833524037",
"name": "Entrada",
"type": "lobby",
"module_ids": ["12:34:56:03:a5:54"]
"module_ids": [
"12:34:56:03:a5:54"
]
},
{
"id": "2940411577",
"name": "Cocina",
"type": "kitchen",
"module_ids": ["12:34:56:03:a0:ac"]
"module_ids": [
"12:34:56:03:a0:ac"
]
}
],
"modules": [
@ -388,6 +399,85 @@
}
],
"therm_mode": "schedule"
},
{
"id": "111111111111111111111401",
"name": "Home with no modules",
"altitude": 9,
"coordinates": [
1.23456789,
50.0987654
],
"country": "BE",
"timezone": "Europe/Brussels",
"rooms": [
{
"id": "1111111401",
"name": "Livingroom",
"type": "livingroom"
}
],
"temperature_control_mode": "heating",
"therm_mode": "away",
"therm_setpoint_default_duration": 120,
"cooling_mode": "schedule",
"schedules": [
{
"away_temp": 14,
"hg_temp": 7,
"name": "Week",
"timetable": [
{
"zone_id": 1,
"m_offset": 0
},
{
"zone_id": 6,
"m_offset": 420
}
],
"zones": [
{
"type": 0,
"name": "Comfort",
"rooms_temp": [],
"id": 0,
"rooms": []
},
{
"type": 1,
"name": "Nacht",
"rooms_temp": [],
"id": 1,
"rooms": []
},
{
"type": 5,
"name": "Eco",
"rooms_temp": [],
"id": 4,
"rooms": []
},
{
"type": 4,
"name": "Tussenin",
"rooms_temp": [],
"id": 5,
"rooms": []
},
{
"type": 4,
"name": "Ochtend",
"rooms_temp": [],
"id": 6,
"rooms": []
}
],
"id": "700000000000000000000401",
"selected": true,
"type": "therm"
}
]
}
],
"user": {
@ -404,4 +494,4 @@
"status": "ok",
"time_exec": 0.056135892868042,
"time_server": 1559171003
}
}

View file

@ -0,0 +1,4 @@
{
"status": "ok",
"time_server": 1638873670
}