Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Feature Request 1088 #1625

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 4 additions & 16 deletions src/cards/humidifier-card/humidifier-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export class HumidifierCard
};
}

@state() private humidity?: number;

protected get hasControls(): boolean {
return Boolean(this._config?.show_target_humidity_control);
Expand All @@ -88,12 +87,6 @@ export class HumidifierCard
handleAction(this, this.hass!, this._config!, ev.detail.action!);
}

private onCurrentHumidityChange(e: CustomEvent<{ value?: number }>): void {
if (e.detail.value != null) {
this.humidity = e.detail.value;
}
}

protected render() {
if (!this._config || !this.hass || !this._config.entity) {
return nothing;
Expand Down Expand Up @@ -151,7 +144,6 @@ export class HumidifierCard
<mushroom-humidifier-humidity-control
.hass=${this.hass}
.entity=${stateObj}
@current-change=${this.onCurrentHumidityChange}
></mushroom-humidifier-humidity-control>
</div>
`
Expand All @@ -162,11 +154,10 @@ export class HumidifierCard
}

protected renderBadge(entity: HumidifierEntity) {
const unavailable = !isAvailable(entity);
if (unavailable) {
return super.renderBadge(entity);
} else {
if (isAvailable(entity)) {
return this.renderActionBadge(entity);
} else {
return super.renderBadge(entity);
}
}

Expand All @@ -175,14 +166,11 @@ export class HumidifierCard
if (!action || action == "off") return nothing;

const color = action == "idle" ? "var(--rgb-disabled)" : "var(--rgb-state-humidifier)";
const icon = "mdi:water-percent";

if (!icon) return nothing;

return html`
<mushroom-badge-icon
slot="badge"
.icon=${icon}
.icon=${"mdi:water-percent"}
vinnyfuria marked this conversation as resolved.
Show resolved Hide resolved
style=${styleMap({
"--main-color": `rgb(${color})`,
})}
Expand Down