Use format entity state helpers everywhere (#17757)

This commit is contained in:
Paul Bottein
2023-09-01 15:26:46 +02:00
committed by GitHub
parent 0d0fe75f4e
commit c8feded4f2
45 changed files with 240 additions and 716 deletions

View File

@@ -1,7 +1,6 @@
import { HassEntity } from "home-assistant-js-websocket";
import { CSSResultGroup, LitElement, css, html, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
import { computeStateDisplay } from "../../../common/entity/compute_state_display";
import { computeStateName } from "../../../common/entity/compute_state_name";
import { isUnavailableState } from "../../../data/entity";
import { SENSOR_DEVICE_CLASS_TIMESTAMP } from "../../../data/sensor";
@@ -35,13 +34,7 @@ class EntityPreviewRow extends LitElement {
capitalize
></hui-timestamp-display>
`
: computeStateDisplay(
this.hass!.localize,
stateObj,
this.hass.locale,
this.hass.config,
this.hass.entities
)}
: this.hass.formatEntityState(stateObj)}
</div>`;
}