mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-29 12:16:39 +00:00
Better display of sensor values. E.g. with units. (#2205)
This commit is contained in:
parent
3d67d9eba3
commit
1ecb138ec5
@ -8,11 +8,15 @@ import "./hui-error-entity-row";
|
||||
import { HomeAssistant } from "../../../types";
|
||||
import { EntityRow, EntityConfig } from "./types";
|
||||
|
||||
import computeStateDisplay from "../../../common/entity/compute_state_display";
|
||||
import { hassLocalizeLitMixin } from "../../../mixins/lit-localize-mixin";
|
||||
|
||||
interface SensorEntityConfig extends EntityConfig {
|
||||
format?: "relative" | "date" | "time" | "datetime";
|
||||
}
|
||||
|
||||
class HuiSensorEntityRow extends LitElement implements EntityRow {
|
||||
class HuiSensorEntityRow extends hassLocalizeLitMixin(LitElement)
|
||||
implements EntityRow {
|
||||
public hass?: HomeAssistant;
|
||||
private _config?: SensorEntityConfig;
|
||||
|
||||
@ -58,7 +62,7 @@ class HuiSensorEntityRow extends LitElement implements EntityRow {
|
||||
.format="${this._config.format}"
|
||||
></hui-timestamp-display>
|
||||
`
|
||||
: stateObj.state
|
||||
: computeStateDisplay(this.localize, stateObj, this.hass.language)
|
||||
}
|
||||
</div>
|
||||
</hui-generic-entity-row>
|
||||
|
Loading…
x
Reference in New Issue
Block a user