mirror of
https://github.com/home-assistant/frontend.git
synced 2025-12-20 02:38:53 +00:00
Filter entities that will never have entries in the logbook card editor (#12876)
This commit is contained in:
@@ -6,7 +6,9 @@ import {
|
||||
} from "../common/const";
|
||||
import { computeDomain } from "../common/entity/compute_domain";
|
||||
import { computeStateDisplay } from "../common/entity/compute_state_display";
|
||||
import { computeStateDomain } from "../common/entity/compute_state_domain";
|
||||
import { LocalizeFunc } from "../common/translations/localize";
|
||||
import { HaEntityPickerEntityFilterFunc } from "../components/entity/ha-entity-picker";
|
||||
import { HomeAssistant } from "../types";
|
||||
import { UNAVAILABLE_STATES } from "./entity";
|
||||
|
||||
@@ -425,3 +427,10 @@ export const localizeStateMessage = (
|
||||
: state
|
||||
);
|
||||
};
|
||||
|
||||
export const filterLogbookCompatibleEntities: HaEntityPickerEntityFilterFunc = (
|
||||
entity
|
||||
) =>
|
||||
computeStateDomain(entity) !== "sensor" ||
|
||||
(entity.attributes.unit_of_measurement === undefined &&
|
||||
entity.attributes.state_class === undefined);
|
||||
|
||||
Reference in New Issue
Block a user