mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Fix plant battery level icon (#19704)
* Fix plant battery level icon * cleanup * cleanup
This commit is contained in:
parent
3ef61aaf02
commit
3c744c09f1
@ -138,10 +138,14 @@ class HuiPlantStatusCard extends LitElement implements LovelaceCard {
|
|||||||
tabindex="0"
|
tabindex="0"
|
||||||
.value=${item}
|
.value=${item}
|
||||||
>
|
>
|
||||||
<div>
|
<div class="icon">
|
||||||
<ha-svg-icon
|
${item === "battery"
|
||||||
.path=${this.computeIcon(item, stateObj.attributes.battery)}
|
? html`<ha-icon
|
||||||
></ha-svg-icon>
|
.icon=${batteryLevelIcon(stateObj.attributes.battery)}
|
||||||
|
></ha-icon>`
|
||||||
|
: html`<ha-svg-icon
|
||||||
|
.path=${SENSOR_ICONS[item]}
|
||||||
|
></ha-svg-icon>`}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class=${stateObj.attributes.problem.indexOf(item) === -1
|
class=${stateObj.attributes.problem.indexOf(item) === -1
|
||||||
@ -214,9 +218,13 @@ class HuiPlantStatusCard extends LitElement implements LovelaceCard {
|
|||||||
padding-bottom: 16px;
|
padding-bottom: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
ha-icon,
|
||||||
ha-svg-icon {
|
ha-svg-icon {
|
||||||
color: var(--paper-item-icon-color);
|
color: var(--paper-item-icon-color);
|
||||||
margin-bottom: 8px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.attributes {
|
.attributes {
|
||||||
@ -250,13 +258,6 @@ class HuiPlantStatusCard extends LitElement implements LovelaceCard {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private computeIcon(attr: string, batLvl: number): string {
|
|
||||||
if (attr === "battery") {
|
|
||||||
return batteryLevelIcon(batLvl);
|
|
||||||
}
|
|
||||||
return SENSOR_ICONS[attr];
|
|
||||||
}
|
|
||||||
|
|
||||||
private _handleMoreInfo(ev: Event): void {
|
private _handleMoreInfo(ev: Event): void {
|
||||||
const target = ev.currentTarget! as PlantAttributeTarget;
|
const target = ev.currentTarget! as PlantAttributeTarget;
|
||||||
const stateObj = this.hass!.states[this._config!.entity];
|
const stateObj = this.hass!.states[this._config!.entity];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user