1
0
mirror of https://github.com/home-assistant/frontend.git synced 2026-05-24 17:19:17 +01:00

Hide standalone helpers and entities from the Home “Other devices” view (#51853)

* Initial plan

* Hide standalone helpers and entities from other devices view

Agent-Logs-Url: https://github.com/home-assistant/frontend/sessions/ecad0a9d-6983-4c5c-9728-6ef04be88e42

* Simplify other devices strategy test assertions

Agent-Logs-Url: https://github.com/home-assistant/frontend/sessions/ecad0a9d-6983-4c5c-9728-6ef04be88e42

* Clean up other devices strategy test helpers

Agent-Logs-Url: https://github.com/home-assistant/frontend/sessions/ecad0a9d-6983-4c5c-9728-6ef04be88e42

* Polish other devices strategy test fixtures

Agent-Logs-Url: https://github.com/home-assistant/frontend/sessions/ecad0a9d-6983-4c5c-9728-6ef04be88e42

* Remove other devices strategy test file

Agent-Logs-Url: https://github.com/home-assistant/frontend/sessions/2a54dac8-a7fc-42e5-a309-e0af02ca4303

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
Copilot
2026-05-11 20:27:00 +02:00
committed by GitHub
parent 89d8723c5a
commit 76131ff09e
@@ -1,7 +1,6 @@
import { ReactiveElement } from "lit";
import { customElement } from "lit/decorators";
import { computeDeviceName } from "../../../../common/entity/compute_device_name";
import { computeDomain } from "../../../../common/entity/compute_domain";
import { getEntityContext } from "../../../../common/entity/context/get_entity_context";
import {
findEntities,
@@ -11,7 +10,6 @@ import { clamp } from "../../../../common/number/clamp";
import type { LovelaceSectionRawConfig } from "../../../../data/lovelace/config/section";
import type { LovelaceViewConfig } from "../../../../data/lovelace/config/view";
import type { HomeAssistant } from "../../../../types";
import { isHelperDomain } from "../../../config/helpers/const";
import type {
EmptyStateCardConfig,
EntitiesCardConfig,
@@ -41,7 +39,6 @@ export class HomeOtherDevicesViewStrategy extends ReactiveElement {
const sections: LovelaceSectionRawConfig[] = [];
const entitiesByDevice: Record<string, string[]> = {};
const entitiesWithoutDevices: string[] = [];
for (const entityId of otherDevicesEntities) {
const stateObj = hass.states[entityId];
if (!stateObj) continue;
@@ -53,7 +50,6 @@ export class HomeOtherDevicesViewStrategy extends ReactiveElement {
hass.floors
);
if (!device) {
entitiesWithoutDevices.push(entityId);
continue;
}
if (!(device.id in entitiesByDevice)) {
@@ -69,16 +65,6 @@ export class HomeOtherDevicesViewStrategy extends ReactiveElement {
})
);
const helpersEntities = entitiesWithoutDevices.filter((entityId) => {
const domain = computeDomain(entityId);
return isHelperDomain(domain);
});
const otherEntities = entitiesWithoutDevices.filter((entityId) => {
const domain = computeDomain(entityId);
return !isHelperDomain(domain);
});
const primaryFilter = generateEntityFilter(hass, {
entity_category: "none",
});
@@ -149,44 +135,6 @@ export class HomeOtherDevicesViewStrategy extends ReactiveElement {
// Allow between 2 and 3 columns (the max should be set to define the width of the header)
const maxColumns = clamp(sections.length, 2, 3);
if (helpersEntities.length) {
sections.push({
type: "grid",
column_span: maxColumns,
cards: [
{
type: "heading",
heading: hass.localize(
"ui.panel.lovelace.strategy.home-other-devices.helpers"
),
} satisfies HeadingCardConfig,
...helpersEntities.map((e) => ({
type: "tile",
entity: e,
})),
],
});
}
if (otherEntities.length) {
sections.push({
type: "grid",
column_span: maxColumns,
cards: [
{
type: "heading",
heading: hass.localize(
"ui.panel.lovelace.strategy.home-other-devices.entities"
),
} satisfies HeadingCardConfig,
...otherEntities.map((e) => ({
type: "tile",
entity: e,
})),
],
});
}
// No sections, show empty state
if (sections.length === 0) {
return {