mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-22 08:46:35 +00:00
Show history graph for sensors with state_class and not unit (#9879)
This commit is contained in:
parent
20744e90a0
commit
a93222dbb2
@ -239,14 +239,17 @@ export const computeHistory = (
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const stateWithUnit = stateInfo.find(
|
const stateWithUnitorStateClass = stateInfo.find(
|
||||||
(state) => state.attributes && "unit_of_measurement" in state.attributes
|
(state) =>
|
||||||
|
state.attributes &&
|
||||||
|
("unit_of_measurement" in state.attributes ||
|
||||||
|
"state_class" in state.attributes)
|
||||||
);
|
);
|
||||||
|
|
||||||
let unit: string | undefined;
|
let unit: string | undefined;
|
||||||
|
|
||||||
if (stateWithUnit) {
|
if (stateWithUnitorStateClass) {
|
||||||
unit = stateWithUnit.attributes.unit_of_measurement;
|
unit = stateWithUnitorStateClass.attributes.unit_of_measurement || " ";
|
||||||
} else {
|
} else {
|
||||||
unit = {
|
unit = {
|
||||||
climate: hass.config.unit_system.temperature,
|
climate: hass.config.unit_system.temperature,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user