mirror of
https://github.com/home-assistant/frontend.git
synced 2025-12-20 02:38:53 +00:00
Move other devices out of summaries
This commit is contained in:
@@ -35,7 +35,6 @@ const COLORS: Record<HomeSummary, string> = {
|
||||
climate: "deep-orange",
|
||||
security: "blue-grey",
|
||||
media_players: "blue",
|
||||
other_devices: "grey",
|
||||
};
|
||||
|
||||
@customElement("hui-home-summary-card")
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { ASSIST_ENTITIES } from "../../../../../common/const";
|
||||
import type { EntityFilter } from "../../../../../common/entity/entity_filter";
|
||||
import type { LocalizeFunc } from "../../../../../common/translations/localize";
|
||||
import { climateEntityFilters } from "../../../../climate/strategies/climate-view-strategy";
|
||||
@@ -10,7 +9,6 @@ export const HOME_SUMMARIES = [
|
||||
"climate",
|
||||
"security",
|
||||
"media_players",
|
||||
"other_devices",
|
||||
] as const;
|
||||
|
||||
export type HomeSummary = (typeof HOME_SUMMARIES)[number];
|
||||
@@ -20,7 +18,6 @@ export const HOME_SUMMARIES_ICONS: Record<HomeSummary, string> = {
|
||||
climate: "mdi:home-thermometer",
|
||||
security: "mdi:security",
|
||||
media_players: "mdi:multimedia",
|
||||
other_devices: "mdi:devices",
|
||||
};
|
||||
|
||||
export const HOME_SUMMARIES_FILTERS: Record<HomeSummary, EntityFilter[]> = {
|
||||
@@ -28,36 +25,6 @@ export const HOME_SUMMARIES_FILTERS: Record<HomeSummary, EntityFilter[]> = {
|
||||
climate: climateEntityFilters,
|
||||
security: securityEntityFilters,
|
||||
media_players: [{ domain: "media_player", entity_category: "none" }],
|
||||
other_devices: [
|
||||
{
|
||||
area: null,
|
||||
hidden_platform: [
|
||||
"automation",
|
||||
"script",
|
||||
"hassio",
|
||||
"backup",
|
||||
"mobile_app",
|
||||
"zone",
|
||||
"person",
|
||||
],
|
||||
hidden_domains: [
|
||||
"ai_task",
|
||||
"automation",
|
||||
"configurator",
|
||||
"device_tracker",
|
||||
"event",
|
||||
"geo_location",
|
||||
"notify",
|
||||
"persistent_notification",
|
||||
"script",
|
||||
"sun",
|
||||
"tag",
|
||||
"todo",
|
||||
"zone",
|
||||
...ASSIST_ENTITIES,
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const getSummaryLabel = (
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import { ASSIST_ENTITIES } from "../../../../../common/const";
|
||||
import type { EntityFilter } from "../../../../../common/entity/entity_filter";
|
||||
|
||||
export const OTHER_DEVICES_FILTERS: EntityFilter[] = [
|
||||
{
|
||||
area: null,
|
||||
hidden_platform: [
|
||||
"automation",
|
||||
"script",
|
||||
"hassio",
|
||||
"backup",
|
||||
"mobile_app",
|
||||
"zone",
|
||||
"person",
|
||||
],
|
||||
hidden_domains: [
|
||||
"ai_task",
|
||||
"automation",
|
||||
"configurator",
|
||||
"device_tracker",
|
||||
"event",
|
||||
"geo_location",
|
||||
"notify",
|
||||
"persistent_notification",
|
||||
"script",
|
||||
"sun",
|
||||
"tag",
|
||||
"todo",
|
||||
"zone",
|
||||
...ASSIST_ENTITIES,
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -72,13 +72,13 @@ export class HomeDashboardStrategy extends ReactiveElement {
|
||||
} satisfies LovelaceViewRawConfig;
|
||||
|
||||
const otherDevicesView = {
|
||||
title: getSummaryLabel(hass.localize, "other_devices"),
|
||||
title: hass.localize("ui.panel.lovelace.strategy.home.devices"),
|
||||
path: "other-devices",
|
||||
subview: true,
|
||||
strategy: {
|
||||
type: "home-other-devices",
|
||||
},
|
||||
icon: HOME_SUMMARIES_ICONS.other_devices,
|
||||
icon: "mdi:devices",
|
||||
} satisfies LovelaceViewRawConfig;
|
||||
|
||||
return {
|
||||
|
||||
@@ -12,7 +12,7 @@ import type { LovelaceViewConfig } from "../../../../data/lovelace/config/view";
|
||||
import type { HomeAssistant } from "../../../../types";
|
||||
import { isHelperDomain } from "../../../config/helpers/const";
|
||||
import type { HeadingCardConfig } from "../../cards/types";
|
||||
import { HOME_SUMMARIES_FILTERS } from "./helpers/home-summaries";
|
||||
import { OTHER_DEVICES_FILTERS } from "./helpers/other-devices-filters";
|
||||
|
||||
export interface HomeOtherDevicesViewStrategyConfig {
|
||||
type: "home-other-devices";
|
||||
@@ -26,8 +26,8 @@ export class HomeOtherDevicesViewStrategy extends ReactiveElement {
|
||||
): Promise<LovelaceViewConfig> {
|
||||
const allEntities = Object.keys(hass.states);
|
||||
|
||||
const otherDevicesFilters = HOME_SUMMARIES_FILTERS.other_devices.map(
|
||||
(filter) => generateEntityFilter(hass, filter)
|
||||
const otherDevicesFilters = OTHER_DEVICES_FILTERS.map((filter) =>
|
||||
generateEntityFilter(hass, filter)
|
||||
);
|
||||
|
||||
const otherDevicesEntities = findEntities(allEntities, otherDevicesFilters);
|
||||
|
||||
@@ -27,6 +27,7 @@ import type {
|
||||
import type { Condition } from "../../common/validate-condition";
|
||||
import type { CommonControlSectionStrategyConfig } from "../usage_prediction/common-controls-section-strategy";
|
||||
import { HOME_SUMMARIES_FILTERS } from "./helpers/home-summaries";
|
||||
import { OTHER_DEVICES_FILTERS } from "./helpers/other-devices-filters";
|
||||
|
||||
export interface HomeOverviewViewStrategyConfig {
|
||||
type: "home-overview";
|
||||
@@ -81,8 +82,8 @@ export class HomeOverviewViewStrategy extends ReactiveElement {
|
||||
media_query: "(min-width: 871px)",
|
||||
};
|
||||
|
||||
const otherDevicesFilters = HOME_SUMMARIES_FILTERS.other_devices.map(
|
||||
(filter) => generateEntityFilter(hass, filter)
|
||||
const otherDevicesFilters = OTHER_DEVICES_FILTERS.map((filter) =>
|
||||
generateEntityFilter(hass, filter)
|
||||
);
|
||||
|
||||
const entitiesWithoutAreas = findEntities(allEntities, otherDevicesFilters);
|
||||
|
||||
Reference in New Issue
Block a user