Allow model-specific lazy_discover setting for xiaomi_miio (#100490)

pull/102107/head
Teemu R 2023-10-16 14:30:05 +02:00 committed by GitHub
parent 4913e7e846
commit e151358aa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -296,10 +296,16 @@ async def async_create_miio_device_and_coordinator(
name = entry.title name = entry.title
device: MiioDevice | None = None device: MiioDevice | None = None
migrate = False migrate = False
lazy_discover = False
update_method = _async_update_data_default update_method = _async_update_data_default
coordinator_class: type[DataUpdateCoordinator[Any]] = DataUpdateCoordinator coordinator_class: type[DataUpdateCoordinator[Any]] = DataUpdateCoordinator
# List of models requiring specific lazy_discover setting
LAZY_DISCOVER_FOR_MODEL = {
"zhimi.fan.za5": True,
"zhimi.airpurifier.za1": True,
}
lazy_discover = LAZY_DISCOVER_FOR_MODEL.get(model, False)
if ( if (
model not in MODELS_HUMIDIFIER model not in MODELS_HUMIDIFIER
and model not in MODELS_FAN and model not in MODELS_FAN