mirror of
https://github.com/home-assistant/core.git
synced 2025-11-10 11:29:46 +00:00
Make sure entity inherit disabled device (#60469)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user