=> {
const entityComponentIcons = await getComponentIcons(hass, domain);
if (entityComponentIcons) {
- return entityComponentIcons._?.default;
+ const translations =
+ (deviceClass && entityComponentIcons[deviceClass]) ||
+ entityComponentIcons._;
+ return translations?.default;
}
return undefined;
};
diff --git a/src/panels/lovelace/cards/hui-area-card.ts b/src/panels/lovelace/cards/hui-area-card.ts
index fd8f89072263..c8deec18490e 100644
--- a/src/panels/lovelace/cards/hui-area-card.ts
+++ b/src/panels/lovelace/cards/hui-area-card.ts
@@ -25,7 +25,6 @@ import { styleMap } from "lit/directives/style-map";
import memoizeOne from "memoize-one";
import { FIXED_DEVICE_CLASS_ICONS, STATES_OFF } from "../../../common/const";
import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element";
-import { binarySensorIcon } from "../../../common/entity/binary_sensor_icon";
import { computeDomain } from "../../../common/entity/compute_domain";
import { navigate } from "../../../common/navigate";
import {
@@ -36,6 +35,7 @@ import { blankBeforeUnit } from "../../../common/translations/blank_before_unit"
import parseAspectRatio from "../../../common/util/parse-aspect-ratio";
import { subscribeOne } from "../../../common/util/subscribe-one";
import "../../../components/ha-card";
+import "../../../components/ha-domain-icon";
import "../../../components/ha-icon-button";
import "../../../components/ha-svg-icon";
import {
@@ -391,7 +391,15 @@ export class HuiAreaCard
const icon = FIXED_DEVICE_CLASS_ICONS[deviceClass];
sensors.push(
html`
- ${icon ? html`` : ""}
+ ${icon
+ ? html`
+
+ `
+ : nothing}
${this._average(domain, deviceClass)}
`
);
@@ -434,16 +442,18 @@ export class HuiAreaCard
${ALERT_DOMAINS.map((domain) => {
if (!(domain in entitiesByDomain)) {
- return "";
+ return nothing;
}
return this._deviceClasses[domain].map((deviceClass) => {
const entity = this._isOn(domain, deviceClass);
return entity
- ? html``
+ ? html`
+
+ `
: nothing;
});
})}
@@ -572,7 +582,14 @@ export class HuiAreaCard
padding: 16px;
}
- .alerts ha-svg-icon {
+ ha-state-icon {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ position: relative;
+ }
+
+ .alerts ha-state-icon {
background: var(--accent-color);
color: var(--text-accent-color, var(--text-primary-color));
padding: 8px;