mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Fix state display mixin (#24760)
This commit is contained in:
parent
bbe549fa86
commit
e18f853f7e
@ -1,3 +1,4 @@
|
|||||||
|
import { isComponentLoaded } from "../common/config/is_component_loaded";
|
||||||
import { computeFormatFunctions } from "../common/translations/entity-state";
|
import { computeFormatFunctions } from "../common/translations/entity-state";
|
||||||
import { getSensorNumericDeviceClasses } from "../data/sensor";
|
import { getSensorNumericDeviceClasses } from "../data/sensor";
|
||||||
import type { Constructor, HomeAssistant } from "../types";
|
import type { Constructor, HomeAssistant } from "../types";
|
||||||
@ -31,10 +32,21 @@ export default <T extends Constructor<HassBaseEl>>(superClass: T) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _updateStateDisplay = async () => {
|
private _updateStateDisplay = async () => {
|
||||||
if (!this.hass) return;
|
if (!this.hass || !this.hass.config) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const { numeric_device_classes: sensorNumericDeviceClasses } =
|
let sensorNumericDeviceClasses: string[] = [];
|
||||||
await getSensorNumericDeviceClasses(this.hass);
|
|
||||||
|
if (isComponentLoaded(this.hass, "sensor")) {
|
||||||
|
try {
|
||||||
|
sensorNumericDeviceClasses = (
|
||||||
|
await getSensorNumericDeviceClasses(this.hass)
|
||||||
|
).numeric_device_classes;
|
||||||
|
} catch (_err: any) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
formatEntityState,
|
formatEntityState,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user