1
0
mirror of https://github.com/home-assistant/frontend.git synced 2025-12-20 02:38:53 +00:00

Rename unassigned to other

This commit is contained in:
Paul Bottein
2025-12-15 15:06:35 +01:00
parent c08d229757
commit d819f784ac
7 changed files with 27 additions and 27 deletions

View File

@@ -35,7 +35,7 @@ const COLORS: Record<HomeSummary, string> = {
climate: "deep-orange", climate: "deep-orange",
security: "blue-grey", security: "blue-grey",
media_players: "blue", media_players: "blue",
unassigned_devices: "grey", other_devices: "grey",
}; };
@customElement("hui-home-summary-card") @customElement("hui-home-summary-card")

View File

@@ -52,8 +52,8 @@ const STRATEGIES: Record<LovelaceStrategyConfigType, Record<string, any>> = {
"home-media-players": () => "home-media-players": () =>
import("./home/home-media-players-view-strategy"), import("./home/home-media-players-view-strategy"),
"home-area": () => import("./home/home-area-view-strategy"), "home-area": () => import("./home/home-area-view-strategy"),
"home-unassigned-devices": () => "home-other-devices": () =>
import("./home/home-unassigned-devices-view-strategy"), import("./home/home-other-devices-view-strategy"),
light: () => import("../../light/strategies/light-view-strategy"), light: () => import("../../light/strategies/light-view-strategy"),
security: () => import("../../security/strategies/security-view-strategy"), security: () => import("../../security/strategies/security-view-strategy"),
climate: () => import("../../climate/strategies/climate-view-strategy"), climate: () => import("../../climate/strategies/climate-view-strategy"),

View File

@@ -10,7 +10,7 @@ export const HOME_SUMMARIES = [
"climate", "climate",
"security", "security",
"media_players", "media_players",
"unassigned_devices", "other_devices",
] as const; ] as const;
export type HomeSummary = (typeof HOME_SUMMARIES)[number]; export type HomeSummary = (typeof HOME_SUMMARIES)[number];
@@ -20,7 +20,7 @@ export const HOME_SUMMARIES_ICONS: Record<HomeSummary, string> = {
climate: "mdi:home-thermometer", climate: "mdi:home-thermometer",
security: "mdi:security", security: "mdi:security",
media_players: "mdi:multimedia", media_players: "mdi:multimedia",
unassigned_devices: "mdi:shape", other_devices: "mdi:devices",
}; };
export const HOME_SUMMARIES_FILTERS: Record<HomeSummary, EntityFilter[]> = { export const HOME_SUMMARIES_FILTERS: Record<HomeSummary, EntityFilter[]> = {
@@ -28,7 +28,7 @@ export const HOME_SUMMARIES_FILTERS: Record<HomeSummary, EntityFilter[]> = {
climate: climateEntityFilters, climate: climateEntityFilters,
security: securityEntityFilters, security: securityEntityFilters,
media_players: [{ domain: "media_player", entity_category: "none" }], media_players: [{ domain: "media_player", entity_category: "none" }],
unassigned_devices: [ other_devices: [
{ {
area: null, area: null,
hidden_platform: [ hidden_platform: [

View File

@@ -71,14 +71,14 @@ export class HomeDashboardStrategy extends ReactiveElement {
icon: HOME_SUMMARIES_ICONS.media_players, icon: HOME_SUMMARIES_ICONS.media_players,
} satisfies LovelaceViewRawConfig; } satisfies LovelaceViewRawConfig;
const unassignedDevicesView = { const otherDevicesView = {
title: getSummaryLabel(hass.localize, "unassigned_devices"), title: getSummaryLabel(hass.localize, "other_devices"),
path: "unassigned-devices", path: "other-devices",
subview: true, subview: true,
strategy: { strategy: {
type: "home-unassigned-devices", type: "home-other-devices",
}, },
icon: HOME_SUMMARIES_ICONS.unassigned_devices, icon: HOME_SUMMARIES_ICONS.other_devices,
} satisfies LovelaceViewRawConfig; } satisfies LovelaceViewRawConfig;
return { return {
@@ -93,7 +93,7 @@ export class HomeDashboardStrategy extends ReactiveElement {
}, },
...areaViews, ...areaViews,
mediaPlayersView, mediaPlayersView,
unassignedDevicesView, otherDevicesView,
], ],
}; };
} }

View File

@@ -14,29 +14,29 @@ import { isHelperDomain } from "../../../config/helpers/const";
import type { HeadingCardConfig } from "../../cards/types"; import type { HeadingCardConfig } from "../../cards/types";
import { HOME_SUMMARIES_FILTERS } from "./helpers/home-summaries"; import { HOME_SUMMARIES_FILTERS } from "./helpers/home-summaries";
export interface HomeUnassignedDevicesViewStrategyConfig { export interface HomeOtherDevicesViewStrategyConfig {
type: "home-unassigned-devices"; type: "home-other-devices";
} }
@customElement("home-unassigned-devices-view-strategy") @customElement("home-other-devices-view-strategy")
export class HomeUnassignedDevicesViewStrategy extends ReactiveElement { export class HomeOtherDevicesViewStrategy extends ReactiveElement {
static async generate( static async generate(
_config: HomeUnassignedDevicesViewStrategyConfig, _config: HomeOtherDevicesViewStrategyConfig,
hass: HomeAssistant hass: HomeAssistant
): Promise<LovelaceViewConfig> { ): Promise<LovelaceViewConfig> {
const allEntities = Object.keys(hass.states); const allEntities = Object.keys(hass.states);
const unassignedFilters = HOME_SUMMARIES_FILTERS.unassigned_devices.map( const otherDevicesFilters = HOME_SUMMARIES_FILTERS.other_devices.map(
(filter) => generateEntityFilter(hass, filter) (filter) => generateEntityFilter(hass, filter)
); );
const unassignedEntities = findEntities(allEntities, unassignedFilters); const otherDevicesEntities = findEntities(allEntities, otherDevicesFilters);
const sections: LovelaceSectionRawConfig[] = []; const sections: LovelaceSectionRawConfig[] = [];
const entitiesByDevice: Record<string, string[]> = {}; const entitiesByDevice: Record<string, string[]> = {};
const entitiesWithoutDevices: string[] = []; const entitiesWithoutDevices: string[] = [];
for (const entityId of unassignedEntities) { for (const entityId of otherDevicesEntities) {
const stateObj = hass.states[entityId]; const stateObj = hass.states[entityId];
if (!stateObj) continue; if (!stateObj) continue;
const { device } = getEntityContext( const { device } = getEntityContext(
@@ -202,6 +202,6 @@ export class HomeUnassignedDevicesViewStrategy extends ReactiveElement {
declare global { declare global {
interface HTMLElementTagNameMap { interface HTMLElementTagNameMap {
"home-unassigned-devices-view-strategy": HomeUnassignedDevicesViewStrategy; "home-other-devices-view-strategy": HomeOtherDevicesViewStrategy;
} }
} }

View File

@@ -81,11 +81,11 @@ export class HomeOverviewViewStrategy extends ReactiveElement {
media_query: "(min-width: 871px)", media_query: "(min-width: 871px)",
}; };
const unassignedFilters = HOME_SUMMARIES_FILTERS.unassigned_devices.map( const otherDevicesFilters = HOME_SUMMARIES_FILTERS.other_devices.map(
(filter) => generateEntityFilter(hass, filter) (filter) => generateEntityFilter(hass, filter)
); );
const entitiesWithoutAreas = findEntities(allEntities, unassignedFilters); const entitiesWithoutAreas = findEntities(allEntities, otherDevicesFilters);
const floorsSections: LovelaceSectionConfig[] = []; const floorsSections: LovelaceSectionConfig[] = [];
for (const floorStructure of home.floors) { for (const floorStructure of home.floors) {
@@ -134,7 +134,7 @@ export class HomeOverviewViewStrategy extends ReactiveElement {
hide_state: true, hide_state: true,
tap_action: { tap_action: {
action: "navigate", action: "navigate",
navigation_path: "unassigned-devices", navigation_path: "other-devices",
}, },
grid_options: { grid_options: {
rows: 2, rows: 2,
@@ -262,11 +262,11 @@ export class HomeOverviewViewStrategy extends ReactiveElement {
} satisfies HomeSummaryCard), } satisfies HomeSummaryCard),
{ {
type: "home-summary", type: "home-summary",
summary: "unassigned_devices", summary: "other_devices",
vertical: true, vertical: true,
tap_action: { tap_action: {
action: "navigate", action: "navigate",
navigation_path: "unassigned-devices", navigation_path: "other-devices",
}, },
grid_options: { grid_options: {
rows: 2, rows: 2,

View File

@@ -7153,7 +7153,7 @@
"home": { "home": {
"summary_list": { "summary_list": {
"media_players": "Media players", "media_players": "Media players",
"unassigned_devices": "Unassigned devices" "other_devices": "Other devices"
}, },
"welcome_user": "Welcome {user}", "welcome_user": "Welcome {user}",
"summaries": "Summaries", "summaries": "Summaries",