Skip to content

Commit

Permalink
Issue #48 - Power usage unit bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Marc Collin committed Jan 25, 2025
1 parent 2a52ef1 commit 5841b57
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/versatile-thermostat-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ const autoFanModeMapping={
const hvacOffReasonAutoStartStop="auto_start_stop";
const autoStartStopLevels=["auto_start_stop_slow", "auto_start_stop_medium", "auto_start_stop_fast"];

const minPowerWatt=7;

interface RegisterCardParams {
type: string;
name: string;
Expand Down Expand Up @@ -1029,7 +1031,7 @@ export class VersatileThermostatUi extends LitElement implements LovelaceCard {
this!.powerInfos!.push({
name: "mean_power_cycle",
value: roundNumber(attributes?.mean_cycle_power, 1),
unit: attributes?.mean_cycle_power < 20 ? "kW" : "W",
unit: attributes?.mean_cycle_power < minPowerWatt ? "kW" : "W",
class: "vt-power-color"
});
}
Expand All @@ -1055,7 +1057,7 @@ export class VersatileThermostatUi extends LitElement implements LovelaceCard {
this.powerInfos.push({
name: "mean_power_cycle",
value: attributes?.device_power,
unit: attributes?.device_power < 20 ? "kW" : "W",
unit: attributes?.device_power < minPowerWatt ? "kW" : "W",
class: "vt-power-color"
});
}
Expand Down

0 comments on commit 5841b57

Please sign in to comment.