Fix incorrect access to entity registry in Xiaomi Miio (#63446)

This commit is contained in:
Franck Nijhof 2022-01-05 12:21:24 +01:00 committed by GitHub
parent 213b1bf684
commit cac60d5c57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,7 @@ from homeassistant.components.number.const import DOMAIN as PLATFORM_DOMAIN
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import DEGREE, TIME_MINUTES
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import entity_registry as er
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -255,7 +256,7 @@ async def async_setup_entry(
for feature, description in NUMBER_TYPES.items():
if feature == FEATURE_SET_LED_BRIGHTNESS and model != MODEL_FAN_ZA5:
# Delete LED bightness entity created by mistake if it exists
entity_reg = hass.helpers.entity_registry.async_get()
entity_reg = er.async_get(hass)
entity_id = entity_reg.async_get_entity_id(
PLATFORM_DOMAIN, DOMAIN, f"{description.key}_{config_entry.unique_id}"
)