Make sure entity inherit disabled device (#60469)
This commit is contained in:
parent
d1962f6e51
commit
c54ca7941f
2 changed files with 47 additions and 3 deletions
|
@ -42,7 +42,7 @@ from . import (
|
|||
service,
|
||||
)
|
||||
from .device_registry import DeviceRegistry
|
||||
from .entity_registry import DISABLED_INTEGRATION, EntityRegistry
|
||||
from .entity_registry import DISABLED_DEVICE, DISABLED_INTEGRATION, EntityRegistry
|
||||
from .event import async_call_later, async_track_time_interval
|
||||
from .typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
|
@ -456,6 +456,7 @@ class EntityPlatform:
|
|||
|
||||
device_info = entity.device_info
|
||||
device_id = None
|
||||
device = None
|
||||
|
||||
if config_entry_id is not None and device_info is not None:
|
||||
processed_dev_info: dict[str, str | None] = {
|
||||
|
@ -523,6 +524,11 @@ class EntityPlatform:
|
|||
unit_of_measurement=entity.unit_of_measurement,
|
||||
)
|
||||
|
||||
if device and device.disabled and not entry.disabled:
|
||||
entry = entity_registry.async_update_entity(
|
||||
entry.entity_id, disabled_by=DISABLED_DEVICE
|
||||
)
|
||||
|
||||
entity.registry_entry = entry
|
||||
entity.entity_id = entry.entity_id
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue