mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-01 13:37:47 +00:00
Make states that are numbers line graphs by default
This commit is contained in:
parent
a9192ae2e1
commit
aaf65e0599
@ -200,6 +200,15 @@ const processLineChartEntities = (
|
||||
};
|
||||
};
|
||||
|
||||
const isNumberValued = (states: HassEntity[]): boolean => {
|
||||
for (const state of states) {
|
||||
if (isNaN(parseFloat(state.state))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
export const computeHistory = (
|
||||
hass: HomeAssistant,
|
||||
stateHistory: HassEntity[][],
|
||||
@ -231,6 +240,8 @@ export const computeHistory = (
|
||||
unit = hass.config.unit_system.temperature;
|
||||
} else if (computeStateDomain(stateInfo[0]) === "humidifier") {
|
||||
unit = "%";
|
||||
} else if (isNumberValued(stateInfo)) {
|
||||
unit = " ";
|
||||
}
|
||||
|
||||
if (!unit) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user