diff --git a/src/data/area_registry.ts b/src/data/area_registry.ts index 8161e8a64e..915a26c005 100644 --- a/src/data/area_registry.ts +++ b/src/data/area_registry.ts @@ -75,17 +75,11 @@ export const reorderAreaRegistryEntries = ( }); export const getAreaEntityLookup = ( - entities: (EntityRegistryEntry | EntityRegistryDisplayEntry)[], - filterHidden = false + entities: (EntityRegistryEntry | EntityRegistryDisplayEntry)[] ): AreaEntityLookup => { const areaEntityLookup: AreaEntityLookup = {}; for (const entity of entities) { - if ( - !entity.area_id || - (filterHidden && - ((entity as EntityRegistryDisplayEntry).hidden || - (entity as EntityRegistryEntry).hidden_by)) - ) { + if (!entity.area_id) { continue; } if (!(entity.area_id in areaEntityLookup)) { diff --git a/src/data/device_registry.ts b/src/data/device_registry.ts index b342832be2..861983bb4c 100644 --- a/src/data/device_registry.ts +++ b/src/data/device_registry.ts @@ -111,17 +111,11 @@ export const sortDeviceRegistryByName = ( ); export const getDeviceEntityLookup = ( - entities: (EntityRegistryEntry | EntityRegistryDisplayEntry)[], - filterHidden = false + entities: (EntityRegistryEntry | EntityRegistryDisplayEntry)[] ): DeviceEntityLookup => { const deviceEntityLookup: DeviceEntityLookup = {}; for (const entity of entities) { - if ( - !entity.device_id || - (filterHidden && - ((entity as EntityRegistryDisplayEntry).hidden || - (entity as EntityRegistryEntry).hidden_by)) - ) { + if (!entity.device_id) { continue; } if (!(entity.device_id in deviceEntityLookup)) { diff --git a/src/panels/config/automation/add-automation-element-dialog.ts b/src/panels/config/automation/add-automation-element-dialog.ts index 838a3499d3..0ea2f9cf35 100644 --- a/src/panels/config/automation/add-automation-element-dialog.ts +++ b/src/panels/config/automation/add-automation-element-dialog.ts @@ -1365,12 +1365,12 @@ class DialogAddAutomationElement private _getAreaEntityLookupMemoized = memoizeOne( (entities: HomeAssistant["entities"]) => - getAreaEntityLookup(Object.values(entities), true) + getAreaEntityLookup(Object.values(entities)) ); private _getDeviceEntityLookupMemoized = memoizeOne( (entities: HomeAssistant["entities"]) => - getDeviceEntityLookup(Object.values(entities), true) + getDeviceEntityLookup(Object.values(entities)) ); private _extractTypeAndIdFromTarget = memoizeOne( diff --git a/src/panels/config/automation/add-automation-element/ha-automation-add-from-target.ts b/src/panels/config/automation/add-automation-element/ha-automation-add-from-target.ts index 9b4f00b89b..8cfd1ea397 100644 --- a/src/panels/config/automation/add-automation-element/ha-automation-add-from-target.ts +++ b/src/panels/config/automation/add-automation-element/ha-automation-add-from-target.ts @@ -708,7 +708,11 @@ export default class HaAutomationAddFromTarget extends LitElement { this.floors ); - const label = entityName || deviceName || entityId; + let label = entityName || deviceName || entityId; + + if (this.entities[entityId]?.hidden) { + label += ` (${this.localize("ui.panel.config.automation.editor.entity_hidden")})`; + } return [entityId, label, stateObj] as [string, string, HassEntity]; }) @@ -837,12 +841,12 @@ export default class HaAutomationAddFromTarget extends LitElement { private _getAreaEntityLookupMemoized = memoizeOne( (entities: HomeAssistant["entities"]) => - getAreaEntityLookup(Object.values(entities), true) + getAreaEntityLookup(Object.values(entities)) ); private _getDeviceEntityLookupMemoized = memoizeOne( (entities: HomeAssistant["entities"]) => - getDeviceEntityLookup(Object.values(entities), true) + getDeviceEntityLookup(Object.values(entities)) ); private _getSelectedTargetId = memoizeOne( diff --git a/src/translations/en.json b/src/translations/en.json index 35546d1dd7..04ed305d92 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -4045,6 +4045,7 @@ "other_areas": "Other areas", "services": "Services", "helpers": "Helpers", + "entity_hidden": "[%key:ui::panel::config::devices::entities::hidden%]", "triggers": { "name": "Triggers", "header": "When",