mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Preheating support in History Chart (#23878)
Use CLIMATE_HVAC_ACTION_TO_MODE to map hvac action to heat or cool so that history chart correctly shows preheating and defrosting as heat
This commit is contained in:
parent
7f3363621e
commit
dd11b3092e
@ -21,6 +21,7 @@ import {
|
|||||||
import { getTimeAxisLabelConfig } from "./axis-label";
|
import { getTimeAxisLabelConfig } from "./axis-label";
|
||||||
import { measureTextWidth } from "../../util/text";
|
import { measureTextWidth } from "../../util/text";
|
||||||
import { fireEvent } from "../../common/dom/fire_event";
|
import { fireEvent } from "../../common/dom/fire_event";
|
||||||
|
import { CLIMATE_HVAC_ACTION_TO_MODE } from "../../data/climate";
|
||||||
|
|
||||||
const safeParseFloat = (value) => {
|
const safeParseFloat = (value) => {
|
||||||
const parsed = parseFloat(value);
|
const parsed = parseFloat(value);
|
||||||
@ -345,12 +346,16 @@ export class StateHistoryChartLine extends LitElement {
|
|||||||
const isHeating =
|
const isHeating =
|
||||||
domain === "climate" && hasHvacAction
|
domain === "climate" && hasHvacAction
|
||||||
? (entityState: LineChartState) =>
|
? (entityState: LineChartState) =>
|
||||||
entityState.attributes?.hvac_action === "heating"
|
CLIMATE_HVAC_ACTION_TO_MODE[
|
||||||
|
entityState.attributes?.hvac_action
|
||||||
|
] === "heat"
|
||||||
: (entityState: LineChartState) => entityState.state === "heat";
|
: (entityState: LineChartState) => entityState.state === "heat";
|
||||||
const isCooling =
|
const isCooling =
|
||||||
domain === "climate" && hasHvacAction
|
domain === "climate" && hasHvacAction
|
||||||
? (entityState: LineChartState) =>
|
? (entityState: LineChartState) =>
|
||||||
entityState.attributes?.hvac_action === "cooling"
|
CLIMATE_HVAC_ACTION_TO_MODE[
|
||||||
|
entityState.attributes?.hvac_action
|
||||||
|
] === "cool"
|
||||||
: (entityState: LineChartState) => entityState.state === "cool";
|
: (entityState: LineChartState) => entityState.state === "cool";
|
||||||
|
|
||||||
const hasHeat = states.states.some(isHeating);
|
const hasHeat = states.states.some(isHeating);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user