mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-19 19:07:23 +00:00
unique-id -> id (#13552)
This commit is contained in:
parent
8fcd396445
commit
430e671901
@ -61,7 +61,7 @@ class HaDemo extends HomeAssistantAppEl {
|
||||
area_id: null,
|
||||
disabled_by: null,
|
||||
entity_id: "sensor.co2_intensity",
|
||||
unique_id: "sensor.co2_intensity",
|
||||
id: "sensor.co2_intensity",
|
||||
name: null,
|
||||
icon: null,
|
||||
platform: "co2signal",
|
||||
@ -75,7 +75,7 @@ class HaDemo extends HomeAssistantAppEl {
|
||||
area_id: null,
|
||||
disabled_by: null,
|
||||
entity_id: "sensor.grid_fossil_fuel_percentage",
|
||||
unique_id: "sensor.co2_intensity",
|
||||
id: "sensor.co2_intensity",
|
||||
name: null,
|
||||
icon: null,
|
||||
platform: "co2signal",
|
||||
|
@ -191,7 +191,7 @@ const createEntityRegistryEntries = (
|
||||
hidden_by: null,
|
||||
entity_category: null,
|
||||
entity_id: "binary_sensor.updater",
|
||||
unique_id: "binary_sensor.updater",
|
||||
id: "binary_sensor.updater",
|
||||
name: null,
|
||||
icon: null,
|
||||
platform: "updater",
|
||||
|
@ -7,8 +7,8 @@ import { debounce } from "../common/util/debounce";
|
||||
import { HomeAssistant } from "../types";
|
||||
|
||||
export interface EntityRegistryEntry {
|
||||
id: string;
|
||||
entity_id: string;
|
||||
unique_id: string;
|
||||
name: string | null;
|
||||
icon: string | null;
|
||||
platform: string;
|
||||
@ -23,6 +23,7 @@ export interface EntityRegistryEntry {
|
||||
}
|
||||
|
||||
export interface ExtEntityRegistryEntry extends EntityRegistryEntry {
|
||||
unique_id: string;
|
||||
capabilities: Record<string, unknown>;
|
||||
original_icon?: string;
|
||||
device_class?: string;
|
||||
@ -162,11 +163,11 @@ export const sortEntityRegistryByName = (entries: EntityRegistryEntry[]) =>
|
||||
caseInsensitiveStringCompare(entry1.name || "", entry2.name || "")
|
||||
);
|
||||
|
||||
export const entityRegistryByUniqueId = memoizeOne(
|
||||
export const entityRegistryById = memoizeOne(
|
||||
(entries: HomeAssistant["entities"]) => {
|
||||
const entities: HomeAssistant["entities"] = {};
|
||||
for (const entity of Object.values(entries)) {
|
||||
entities[entity.unique_id] = entity;
|
||||
entities[entity.id] = entity;
|
||||
}
|
||||
return entities;
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import { localizeDeviceAutomationAction } from "./device_automation";
|
||||
import { computeDeviceName } from "./device_registry";
|
||||
import {
|
||||
computeEntityRegistryName,
|
||||
entityRegistryByUniqueId,
|
||||
entityRegistryById,
|
||||
} from "./entity_registry";
|
||||
import { domainToName } from "./integration";
|
||||
import {
|
||||
@ -91,9 +91,7 @@ export const describeAction = <T extends ActionType>(
|
||||
targets.push(targetThing);
|
||||
}
|
||||
} else {
|
||||
const entityReg = entityRegistryByUniqueId(hass.entities)[
|
||||
targetThing
|
||||
];
|
||||
const entityReg = entityRegistryById(hass.entities)[targetThing];
|
||||
if (entityReg) {
|
||||
targets.push(
|
||||
computeEntityRegistryName(hass, entityReg) || targetThing
|
||||
|
@ -68,10 +68,10 @@ import type { HomeAssistant, Route } from "../../../types";
|
||||
import { configSections } from "../ha-panel-config";
|
||||
import "../integrations/ha-integration-overflow-menu";
|
||||
|
||||
export interface StateEntity extends Omit<EntityRegistryEntry, "unique_id"> {
|
||||
export interface StateEntity extends Omit<EntityRegistryEntry, "id"> {
|
||||
readonly?: boolean;
|
||||
selectable?: boolean;
|
||||
unique_id?: string;
|
||||
id?: string;
|
||||
}
|
||||
|
||||
export interface EntityRow extends StateEntity {
|
||||
|
Loading…
x
Reference in New Issue
Block a user