diff --git a/src/data/history.ts b/src/data/history.ts index 7bab985c1c..1589aae9a2 100644 --- a/src/data/history.ts +++ b/src/data/history.ts @@ -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) {