mirror of
https://github.com/home-assistant/frontend.git
synced 2025-12-24 04:39:01 +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",
|
climate: "deep-orange",
|
||||||
security: "blue-grey",
|
security: "blue-grey",
|
||||||
media_players: "blue",
|
media_players: "blue",
|
||||||
other_devices: "grey",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@customElement("hui-home-summary-card")
|
@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 { EntityFilter } from "../../../../../common/entity/entity_filter";
|
||||||
import type { LocalizeFunc } from "../../../../../common/translations/localize";
|
import type { LocalizeFunc } from "../../../../../common/translations/localize";
|
||||||
import { climateEntityFilters } from "../../../../climate/strategies/climate-view-strategy";
|
import { climateEntityFilters } from "../../../../climate/strategies/climate-view-strategy";
|
||||||
@@ -10,7 +9,6 @@ export const HOME_SUMMARIES = [
|
|||||||
"climate",
|
"climate",
|
||||||
"security",
|
"security",
|
||||||
"media_players",
|
"media_players",
|
||||||
"other_devices",
|
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export type HomeSummary = (typeof HOME_SUMMARIES)[number];
|
export type HomeSummary = (typeof HOME_SUMMARIES)[number];
|
||||||
@@ -20,7 +18,6 @@ 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",
|
||||||
other_devices: "mdi:devices",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const HOME_SUMMARIES_FILTERS: Record<HomeSummary, EntityFilter[]> = {
|
export const HOME_SUMMARIES_FILTERS: Record<HomeSummary, EntityFilter[]> = {
|
||||||
@@ -28,36 +25,6 @@ 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" }],
|
||||||
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 = (
|
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;
|
} satisfies LovelaceViewRawConfig;
|
||||||
|
|
||||||
const otherDevicesView = {
|
const otherDevicesView = {
|
||||||
title: getSummaryLabel(hass.localize, "other_devices"),
|
title: hass.localize("ui.panel.lovelace.strategy.home.devices"),
|
||||||
path: "other-devices",
|
path: "other-devices",
|
||||||
subview: true,
|
subview: true,
|
||||||
strategy: {
|
strategy: {
|
||||||
type: "home-other-devices",
|
type: "home-other-devices",
|
||||||
},
|
},
|
||||||
icon: HOME_SUMMARIES_ICONS.other_devices,
|
icon: "mdi:devices",
|
||||||
} satisfies LovelaceViewRawConfig;
|
} satisfies LovelaceViewRawConfig;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import type { LovelaceViewConfig } from "../../../../data/lovelace/config/view";
|
|||||||
import type { HomeAssistant } from "../../../../types";
|
import type { HomeAssistant } from "../../../../types";
|
||||||
import { isHelperDomain } from "../../../config/helpers/const";
|
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 { OTHER_DEVICES_FILTERS } from "./helpers/other-devices-filters";
|
||||||
|
|
||||||
export interface HomeOtherDevicesViewStrategyConfig {
|
export interface HomeOtherDevicesViewStrategyConfig {
|
||||||
type: "home-other-devices";
|
type: "home-other-devices";
|
||||||
@@ -26,8 +26,8 @@ export class HomeOtherDevicesViewStrategy extends ReactiveElement {
|
|||||||
): Promise<LovelaceViewConfig> {
|
): Promise<LovelaceViewConfig> {
|
||||||
const allEntities = Object.keys(hass.states);
|
const allEntities = Object.keys(hass.states);
|
||||||
|
|
||||||
const otherDevicesFilters = HOME_SUMMARIES_FILTERS.other_devices.map(
|
const otherDevicesFilters = OTHER_DEVICES_FILTERS.map((filter) =>
|
||||||
(filter) => generateEntityFilter(hass, filter)
|
generateEntityFilter(hass, filter)
|
||||||
);
|
);
|
||||||
|
|
||||||
const otherDevicesEntities = findEntities(allEntities, otherDevicesFilters);
|
const otherDevicesEntities = findEntities(allEntities, otherDevicesFilters);
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import type {
|
|||||||
import type { Condition } from "../../common/validate-condition";
|
import type { Condition } from "../../common/validate-condition";
|
||||||
import type { CommonControlSectionStrategyConfig } from "../usage_prediction/common-controls-section-strategy";
|
import type { CommonControlSectionStrategyConfig } from "../usage_prediction/common-controls-section-strategy";
|
||||||
import { HOME_SUMMARIES_FILTERS } from "./helpers/home-summaries";
|
import { HOME_SUMMARIES_FILTERS } from "./helpers/home-summaries";
|
||||||
|
import { OTHER_DEVICES_FILTERS } from "./helpers/other-devices-filters";
|
||||||
|
|
||||||
export interface HomeOverviewViewStrategyConfig {
|
export interface HomeOverviewViewStrategyConfig {
|
||||||
type: "home-overview";
|
type: "home-overview";
|
||||||
@@ -81,8 +82,8 @@ export class HomeOverviewViewStrategy extends ReactiveElement {
|
|||||||
media_query: "(min-width: 871px)",
|
media_query: "(min-width: 871px)",
|
||||||
};
|
};
|
||||||
|
|
||||||
const otherDevicesFilters = HOME_SUMMARIES_FILTERS.other_devices.map(
|
const otherDevicesFilters = OTHER_DEVICES_FILTERS.map((filter) =>
|
||||||
(filter) => generateEntityFilter(hass, filter)
|
generateEntityFilter(hass, filter)
|
||||||
);
|
);
|
||||||
|
|
||||||
const entitiesWithoutAreas = findEntities(allEntities, otherDevicesFilters);
|
const entitiesWithoutAreas = findEntities(allEntities, otherDevicesFilters);
|
||||||
|
|||||||
Reference in New Issue
Block a user