Skip to content

Commit

Permalink
Updated presetModeColors and show presetModeIcon as icon
Browse files Browse the repository at this point in the history
  • Loading branch information
Wesley-Vos committed Oct 18, 2022
1 parent 9c0b592 commit 4c78118
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/cards/climate-card/climate-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import "./controls/climate-temperature-control";
import { isTemperatureControlVisible } from "./controls/climate-temperature-control";
import "./controls/climate-preset-modes-control";
import { isPresetModesVisible } from "./controls/climate-preset-modes-control";
import { getHvacActionColor, getHvacActionIcon, getHvacModeColor } from "./utils";
import { getHvacActionColor, getHvacActionIcon, getHvacModeColor, getPresetModeIcon } from "./utils";

type ClimateCardControl = "temperature_control" | "hvac_mode_control" | "preset_mode_control";

Expand Down Expand Up @@ -147,7 +147,8 @@ export class ClimateCard extends MushroomBaseCard implements LovelaceCard {
const entity = this.hass.states[entity_id] as ClimateEntity;

const name = this._config.name || entity.attributes.friendly_name || "";
const icon = this._config.icon || stateIcon(entity);
// const icon = this._config.icon || stateIcon(entity);
const icon = getPresetModeIcon(entity.attributes.preset_mode)
const appearance = computeAppearance(this._config);
const picture = computeEntityPicture(entity, appearance.icon_type);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class ClimatePresetModesControl extends LitElement {

private renderModeButton(mode: PresetMode) {
const iconStyle = {};
const color = mode === "sleep" || mode === "away" ? "var(--rgb-grey)" : getPresetModeColor(mode);
const color = getPresetModeColor(mode);
if (mode === this.entity.attributes.preset_mode) {
iconStyle["--icon-color"] = `rgb(${color})`;
iconStyle["--bg-color"] = `rgba(${color}, 0.2)`;
Expand Down
8 changes: 4 additions & 4 deletions src/cards/climate-card/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ export const CLIMATE_HVAC_MODE_COLORS: Record<HvacMode, string> = {
};

export const CLIMATE_PRESET_MODE_COLORS: Record<PresetMode, string> = {
sleep: "var(--rgb-state-climate-auto)",
away: "var(--rgb-state-climate-cool)",
comfort: "var(--rgb-state-climate-dry)",
home: "var(--rgb-state-climate-fan-only)",
sleep: "var(--rgb-blue)",
away: "var(--rgb-blue)",
comfort: "var(--rgb-red)",
home: "var(--rgb-green)",
};

export const CLIMATE_HVAC_ACTION_COLORS: Record<HvacAction, string> = {
Expand Down

0 comments on commit 4c78118

Please sign in to comment.