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:
@@ -35,7 +35,7 @@ const COLORS: Record<HomeSummary, string> = {
|
||||
climate: "deep-orange",
|
||||
security: "blue-grey",
|
||||
media_players: "blue",
|
||||
unassigned_devices: "grey",
|
||||
other_devices: "grey",
|
||||
};
|
||||
|
||||
@customElement("hui-home-summary-card")
|
||||
|
||||
@@ -52,8 +52,8 @@ const STRATEGIES: Record<LovelaceStrategyConfigType, Record<string, any>> = {
|
||||
"home-media-players": () =>
|
||||
import("./home/home-media-players-view-strategy"),
|
||||
"home-area": () => import("./home/home-area-view-strategy"),
|
||||
"home-unassigned-devices": () =>
|
||||
import("./home/home-unassigned-devices-view-strategy"),
|
||||
"home-other-devices": () =>
|
||||
import("./home/home-other-devices-view-strategy"),
|
||||
light: () => import("../../light/strategies/light-view-strategy"),
|
||||
security: () => import("../../security/strategies/security-view-strategy"),
|
||||
climate: () => import("../../climate/strategies/climate-view-strategy"),
|
||||
|
||||
@@ -10,7 +10,7 @@ export const HOME_SUMMARIES = [
|
||||
"climate",
|
||||
"security",
|
||||
"media_players",
|
||||
"unassigned_devices",
|
||||
"other_devices",
|
||||
] as const;
|
||||
|
||||
export type HomeSummary = (typeof HOME_SUMMARIES)[number];
|
||||
@@ -20,7 +20,7 @@ export const HOME_SUMMARIES_ICONS: Record<HomeSummary, string> = {
|
||||
climate: "mdi:home-thermometer",
|
||||
security: "mdi:security",
|
||||
media_players: "mdi:multimedia",
|
||||
unassigned_devices: "mdi:shape",
|
||||
other_devices: "mdi:devices",
|
||||
};
|
||||
|
||||
export const HOME_SUMMARIES_FILTERS: Record<HomeSummary, EntityFilter[]> = {
|
||||
@@ -28,7 +28,7 @@ export const HOME_SUMMARIES_FILTERS: Record<HomeSummary, EntityFilter[]> = {
|
||||
climate: climateEntityFilters,
|
||||
security: securityEntityFilters,
|
||||
media_players: [{ domain: "media_player", entity_category: "none" }],
|
||||
unassigned_devices: [
|
||||
other_devices: [
|
||||
{
|
||||
area: null,
|
||||
hidden_platform: [
|
||||
|
||||
@@ -71,14 +71,14 @@ export class HomeDashboardStrategy extends ReactiveElement {
|
||||
icon: HOME_SUMMARIES_ICONS.media_players,
|
||||
} satisfies LovelaceViewRawConfig;
|
||||
|
||||
const unassignedDevicesView = {
|
||||
title: getSummaryLabel(hass.localize, "unassigned_devices"),
|
||||
path: "unassigned-devices",
|
||||
const otherDevicesView = {
|
||||
title: getSummaryLabel(hass.localize, "other_devices"),
|
||||
path: "other-devices",
|
||||
subview: true,
|
||||
strategy: {
|
||||
type: "home-unassigned-devices",
|
||||
type: "home-other-devices",
|
||||
},
|
||||
icon: HOME_SUMMARIES_ICONS.unassigned_devices,
|
||||
icon: HOME_SUMMARIES_ICONS.other_devices,
|
||||
} satisfies LovelaceViewRawConfig;
|
||||
|
||||
return {
|
||||
@@ -93,7 +93,7 @@ export class HomeDashboardStrategy extends ReactiveElement {
|
||||
},
|
||||
...areaViews,
|
||||
mediaPlayersView,
|
||||
unassignedDevicesView,
|
||||
otherDevicesView,
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -14,29 +14,29 @@ import { isHelperDomain } from "../../../config/helpers/const";
|
||||
import type { HeadingCardConfig } from "../../cards/types";
|
||||
import { HOME_SUMMARIES_FILTERS } from "./helpers/home-summaries";
|
||||
|
||||
export interface HomeUnassignedDevicesViewStrategyConfig {
|
||||
type: "home-unassigned-devices";
|
||||
export interface HomeOtherDevicesViewStrategyConfig {
|
||||
type: "home-other-devices";
|
||||
}
|
||||
|
||||
@customElement("home-unassigned-devices-view-strategy")
|
||||
export class HomeUnassignedDevicesViewStrategy extends ReactiveElement {
|
||||
@customElement("home-other-devices-view-strategy")
|
||||
export class HomeOtherDevicesViewStrategy extends ReactiveElement {
|
||||
static async generate(
|
||||
_config: HomeUnassignedDevicesViewStrategyConfig,
|
||||
_config: HomeOtherDevicesViewStrategyConfig,
|
||||
hass: HomeAssistant
|
||||
): Promise<LovelaceViewConfig> {
|
||||
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)
|
||||
);
|
||||
|
||||
const unassignedEntities = findEntities(allEntities, unassignedFilters);
|
||||
const otherDevicesEntities = findEntities(allEntities, otherDevicesFilters);
|
||||
|
||||
const sections: LovelaceSectionRawConfig[] = [];
|
||||
|
||||
const entitiesByDevice: Record<string, string[]> = {};
|
||||
const entitiesWithoutDevices: string[] = [];
|
||||
for (const entityId of unassignedEntities) {
|
||||
for (const entityId of otherDevicesEntities) {
|
||||
const stateObj = hass.states[entityId];
|
||||
if (!stateObj) continue;
|
||||
const { device } = getEntityContext(
|
||||
@@ -202,6 +202,6 @@ export class HomeUnassignedDevicesViewStrategy extends ReactiveElement {
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"home-unassigned-devices-view-strategy": HomeUnassignedDevicesViewStrategy;
|
||||
"home-other-devices-view-strategy": HomeOtherDevicesViewStrategy;
|
||||
}
|
||||
}
|
||||
@@ -81,11 +81,11 @@ export class HomeOverviewViewStrategy extends ReactiveElement {
|
||||
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)
|
||||
);
|
||||
|
||||
const entitiesWithoutAreas = findEntities(allEntities, unassignedFilters);
|
||||
const entitiesWithoutAreas = findEntities(allEntities, otherDevicesFilters);
|
||||
|
||||
const floorsSections: LovelaceSectionConfig[] = [];
|
||||
for (const floorStructure of home.floors) {
|
||||
@@ -134,7 +134,7 @@ export class HomeOverviewViewStrategy extends ReactiveElement {
|
||||
hide_state: true,
|
||||
tap_action: {
|
||||
action: "navigate",
|
||||
navigation_path: "unassigned-devices",
|
||||
navigation_path: "other-devices",
|
||||
},
|
||||
grid_options: {
|
||||
rows: 2,
|
||||
@@ -262,11 +262,11 @@ export class HomeOverviewViewStrategy extends ReactiveElement {
|
||||
} satisfies HomeSummaryCard),
|
||||
{
|
||||
type: "home-summary",
|
||||
summary: "unassigned_devices",
|
||||
summary: "other_devices",
|
||||
vertical: true,
|
||||
tap_action: {
|
||||
action: "navigate",
|
||||
navigation_path: "unassigned-devices",
|
||||
navigation_path: "other-devices",
|
||||
},
|
||||
grid_options: {
|
||||
rows: 2,
|
||||
|
||||
@@ -7153,7 +7153,7 @@
|
||||
"home": {
|
||||
"summary_list": {
|
||||
"media_players": "Media players",
|
||||
"unassigned_devices": "Unassigned devices"
|
||||
"other_devices": "Other devices"
|
||||
},
|
||||
"welcome_user": "Welcome {user}",
|
||||
"summaries": "Summaries",
|
||||
|
||||
Reference in New Issue
Block a user