Skip to content

Commit

Permalink
Add support icon in 2024.2
Browse files Browse the repository at this point in the history
  • Loading branch information
piitaya committed Jan 22, 2024
1 parent 6eb5cec commit 9d16dfb
Show file tree
Hide file tree
Showing 20 changed files with 91 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,12 @@ export class AlarmControlPanelCard extends MushroomBaseCard implements LovelaceC
style=${styleMap(iconStyle)}
class=${classMap({ pulse: shapePulse })}
>
<ha-state-icon .state=${stateObj} .icon=${icon}></ha-state-icon>
<ha-state-icon
.hass=${this.hass}
.stateObj=${stateObj}
.state=${stateObj}
.icon=${icon}
></ha-state-icon>
</mushroom-shape-icon>
`;
}
Expand Down
6 changes: 5 additions & 1 deletion src/cards/chips-card/chips/action-chip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ export class ActionChip extends LitElement implements LovelaceChip {
hasDoubleClick: hasAction(this._config.double_tap_action),
})}
>
<ha-state-icon .icon=${icon} style=${styleMap(iconStyle)}></ha-state-icon>
<ha-state-icon
.hass=${this.hass}
.icon=${icon}
style=${styleMap(iconStyle)}
></ha-state-icon>
</mushroom-chip>
`;
}
Expand Down
2 changes: 2 additions & 0 deletions src/cards/chips-card/chips/alarm-control-panel-chip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ export class AlarmControlPanelChip extends LitElement implements LovelaceChip {
})}
>
<ha-state-icon
.hass=${this.hass}
.stateObj=${stateObj}
.state=${stateObj}
.icon=${icon}
style=${styleMap(iconStyle)}
Expand Down
2 changes: 1 addition & 1 deletion src/cards/chips-card/chips/back-chip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class BackChip extends LitElement implements LovelaceChip {
@action=${this._handleAction}
.actionHandler=${actionHandler()}
>
<ha-state-icon .icon=${icon}></ha-state-icon>
<ha-state-icon .hass=${this.hass} .icon=${icon}></ha-state-icon>
</mushroom-chip>
`;
}
Expand Down
2 changes: 2 additions & 0 deletions src/cards/chips-card/chips/entity-chip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ export class EntityChip extends LitElement implements LovelaceChip {
}
return html`
<ha-state-icon
.hass=${this.hass}
.stateObj=${stateObj}
.state=${stateObj}
.icon=${icon}
style=${styleMap(iconStyle)}
Expand Down
2 changes: 2 additions & 0 deletions src/cards/chips-card/chips/light-chip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ export class LightChip extends LitElement implements LovelaceChip {
})}
>
<ha-state-icon
.hass=${this.hass}
.stateObj=${stateObj}
.state=${stateObj}
.icon=${icon}
style=${styleMap(iconStyle)}
Expand Down
2 changes: 1 addition & 1 deletion src/cards/chips-card/chips/menu-chip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class MenuChip extends LitElement implements LovelaceChip {
@action=${this._handleAction}
.actionHandler=${actionHandler()}
>
<ha-state-icon .icon=${icon}></ha-state-icon>
<ha-state-icon .hass=${this.hass} .icon=${icon}></ha-state-icon>
</mushroom-chip>
`;
}
Expand Down
6 changes: 5 additions & 1 deletion src/cards/chips-card/chips/template-chip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,11 @@ export class TemplateChip extends LitElement implements LovelaceChip {
const iconRgbColor = computeRgbColor(iconColor);
iconStyle["--color"] = `rgb(${iconRgbColor})`;
}
return html`<ha-state-icon .icon=${icon} style=${styleMap(iconStyle)}></ha-state-icon>`;
return html`<ha-state-icon
.hass=${this.hass}
.icon=${icon}
style=${styleMap(iconStyle)}
></ha-state-icon>`;
}

protected renderContent(content: string): TemplateResult {
Expand Down
7 changes: 6 additions & 1 deletion src/cards/climate-card/climate-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,12 @@ export class ClimateCard extends MushroomBaseCard implements LovelaceCard {

return html`
<mushroom-shape-icon slot="icon" .disabled=${!available} style=${styleMap(iconStyle)}>
<ha-state-icon .state=${stateObj} .icon=${icon}></ha-state-icon>
<ha-state-icon
.hass=${this.hass}
.stateObj=${stateObj}
.state=${stateObj}
.icon=${icon}
></ha-state-icon>
</mushroom-shape-icon>
`;
}
Expand Down
7 changes: 6 additions & 1 deletion src/cards/cover-card/cover-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,12 @@ export class CoverCard extends MushroomBaseCard implements LovelaceCard {

return html`
<mushroom-shape-icon slot="icon" .disabled=${!available} style=${styleMap(iconStyle)}>
<ha-state-icon .state=${stateObj} .icon=${icon}></ha-state-icon
<ha-state-icon
.hass=${this.hass}
.stateObj=${stateObj}
.state=${stateObj}
.icon=${icon}
></ha-state-icon
></mushroom-shape-icon>
`;
}
Expand Down
7 changes: 6 additions & 1 deletion src/cards/entity-card/entity-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,12 @@ export class EntityCard extends MushroomBaseCard implements LovelaceCard {
}
return html`
<mushroom-shape-icon slot="icon" .disabled=${!active} style=${styleMap(iconStyle)}>
<ha-state-icon .state=${stateObj} .icon=${icon}></ha-state-icon>
<ha-state-icon
.hass=${this.hass}
.stateObj=${stateObj}
.state=${stateObj}
.icon=${icon}
></ha-state-icon>
</mushroom-shape-icon>
`;
}
Expand Down
7 changes: 6 additions & 1 deletion src/cards/fan-card/fan-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,12 @@ export class FanCard extends MushroomBaseCard implements LovelaceCard {
style=${styleMap(iconStyle)}
.disabled=${!active}
>
<ha-state-icon .state=${stateObj} .icon=${icon}></ha-state-icon>
<ha-state-icon
.hass=${this.hass}
.stateObj=${stateObj}
.state=${stateObj}
.icon=${icon}
></ha-state-icon>
</mushroom-shape-icon>
`;
}
Expand Down
7 changes: 6 additions & 1 deletion src/cards/light-card/light-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,12 @@ export class LightCard extends MushroomBaseCard implements LovelaceCard {
}
return html`
<mushroom-shape-icon slot="icon" .disabled=${!active} style=${styleMap(iconStyle)}>
<ha-state-icon .state=${stateObj} .icon=${icon}></ha-state-icon>
<ha-state-icon
.hass=${this.hass}
.stateObj=${stateObj}
.state=${stateObj}
.icon=${icon}
></ha-state-icon>
</mushroom-shape-icon>
`;
}
Expand Down
7 changes: 6 additions & 1 deletion src/cards/lock-card/lock-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,12 @@ export class LockCard extends MushroomBaseCard implements LovelaceCard {

return html`
<mushroom-shape-icon slot="icon" .disabled=${!available} style=${styleMap(iconStyle)}>
<ha-state-icon .state=${stateObj} .icon=${icon}></ha-state-icon>
<ha-state-icon
.hass=${this.hass}
.stateObj=${stateObj}
.state=${stateObj}
.icon=${icon}
></ha-state-icon>
</mushroom-shape-icon>
`;
}
Expand Down
7 changes: 6 additions & 1 deletion src/cards/number-card/number-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,12 @@ export class NumberCard extends MushroomBaseCard implements LovelaceCard {
}
return html`
<mushroom-shape-icon slot="icon" .disabled=${!active} style=${styleMap(iconStyle)}>
<ha-state-icon .state=${stateObj} .icon=${icon}></ha-state-icon>
<ha-state-icon
.hass=${this.hass}
.stateObj=${stateObj}
.state=${stateObj}
.icon=${icon}
></ha-state-icon>
</mushroom-shape-icon>
`;
}
Expand Down
7 changes: 6 additions & 1 deletion src/cards/select-card/select-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,12 @@ export class SelectCard extends MushroomBaseCard implements LovelaceCard {
}
return html`
<mushroom-shape-icon slot="icon" .disabled=${!active} style=${styleMap(iconStyle)}>
<ha-state-icon .state=${stateObj} .icon=${icon}></ha-state-icon>
<ha-state-icon
.hass=${this.hass}
.stateObj=${stateObj}
.state=${stateObj}
.icon=${icon}
></ha-state-icon>
</mushroom-shape-icon>
`;
}
Expand Down
2 changes: 1 addition & 1 deletion src/cards/template-card/template-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export class TemplateCard extends MushroomBaseElement implements LovelaceCard {
}
return html`
<mushroom-shape-icon style=${styleMap(iconStyle)} slot="icon">
<ha-state-icon .icon=${icon}></ha-state-icon>
<ha-state-icon .hass=${this.hass} .icon=${icon}></ha-state-icon>
</mushroom-shape-icon>
`;
}
Expand Down
7 changes: 6 additions & 1 deletion src/cards/update-card/update-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,12 @@ export class UpdateCard extends MushroomBaseCard implements LovelaceCard {
})}
style=${styleMap(style)}
>
<ha-state-icon .state=${stateObj} .icon=${icon}></ha-state-icon>
<ha-state-icon
.hass=${this.hass}
.stateObj=${stateObj}
.state=${stateObj}
.icon=${icon}
></ha-state-icon>
</mushroom-shape-icon>
`;
}
Expand Down
7 changes: 6 additions & 1 deletion src/cards/vacuum-card/vacuum-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,12 @@ export class VacuumCard extends MushroomBaseCard implements LovelaceCard {
style=${styleMap({})}
.disabled=${!isActive(stateObj)}
>
<ha-state-icon .state=${stateObj} .icon=${icon}></ha-state-icon
<ha-state-icon
.hass=${this.hass}
.stateObj=${stateObj}
.state=${stateObj}
.icon=${icon}
></ha-state-icon
></mushroom-shape-icon>
`;
}
Expand Down
7 changes: 6 additions & 1 deletion src/utils/base-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ export class MushroomBaseCard extends MushroomBaseElement {
const active = isActive(stateObj);
return html`
<mushroom-shape-icon slot="icon" .disabled=${!active}>
<ha-state-icon .state=${stateObj} .icon=${icon}></ha-state-icon
<ha-state-icon
.hass=${this.hass}
.stateObj=${stateObj}
.state=${stateObj}
.icon=${icon}
></ha-state-icon
></mushroom-shape-icon>
`;
}
Expand Down

0 comments on commit 9d16dfb

Please sign in to comment.