mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Fix incorrect access to entity registry in Xiaomi Miio (#63446)
This commit is contained in:
parent
213b1bf684
commit
cac60d5c57
@ -8,6 +8,7 @@ from homeassistant.components.number.const import DOMAIN as PLATFORM_DOMAIN
|
|||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import DEGREE, TIME_MINUTES
|
from homeassistant.const import DEGREE, TIME_MINUTES
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
|
from homeassistant.helpers import entity_registry as er
|
||||||
from homeassistant.helpers.entity import EntityCategory
|
from homeassistant.helpers.entity import EntityCategory
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
@ -255,7 +256,7 @@ async def async_setup_entry(
|
|||||||
for feature, description in NUMBER_TYPES.items():
|
for feature, description in NUMBER_TYPES.items():
|
||||||
if feature == FEATURE_SET_LED_BRIGHTNESS and model != MODEL_FAN_ZA5:
|
if feature == FEATURE_SET_LED_BRIGHTNESS and model != MODEL_FAN_ZA5:
|
||||||
# Delete LED bightness entity created by mistake if it exists
|
# 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(
|
entity_id = entity_reg.async_get_entity_id(
|
||||||
PLATFORM_DOMAIN, DOMAIN, f"{description.key}_{config_entry.unique_id}"
|
PLATFORM_DOMAIN, DOMAIN, f"{description.key}_{config_entry.unique_id}"
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user