Area card gallery updates (#11324)

This commit is contained in:
Zack Barett 2022-01-14 17:27:54 -06:00 committed by GitHub
parent 6053b64b2e
commit 4165e64ce0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 8 deletions

View File

@ -46,7 +46,6 @@ const CONFIGS = [
config: ` config: `
- type: area - type: area
area: bedroom area: bedroom
image: "/images/bed.png"
`, `,
}, },
{ {
@ -54,7 +53,6 @@ const CONFIGS = [
config: ` config: `
- type: area - type: area
area: living_room area: living_room
image: "/images/living_room.png"
`, `,
}, },
{ {
@ -62,7 +60,6 @@ const CONFIGS = [
config: ` config: `
- type: area - type: area
area: office area: office
image: "/images/office.jpg"
`, `,
}, },
{ {
@ -70,7 +67,6 @@ const CONFIGS = [
config: ` config: `
- type: area - type: area
area: kitchen area: kitchen
image: "/images/kitchen.png"
`, `,
}, },
]; ];
@ -93,18 +89,22 @@ class DemoArea extends LitElement {
{ {
name: "Bedroom", name: "Bedroom",
area_id: "bedroom", area_id: "bedroom",
picture: "/images/bed.png",
}, },
{ {
name: "Living Room", name: "Living Room",
area_id: "living_room", area_id: "living_room",
picture: "/images/living_room.png",
}, },
{ {
name: "Office", name: "Office",
area_id: "office", area_id: "office",
picture: "/images/office.jpg",
}, },
{ {
name: "Second Office", name: "Second Office",
area_id: "kitchen", area_id: "kitchen",
picture: "/images/kitchen.png",
}, },
]); ]);
hass.mockWS("config/device_registry/list", () => []); hass.mockWS("config/device_registry/list", () => []);

View File

@ -31,6 +31,7 @@ import "../../../components/ha-card";
import "../../../components/ha-icon-button"; import "../../../components/ha-icon-button";
import "../../../components/ha-state-icon"; import "../../../components/ha-state-icon";
import "../../../components/ha-svg-icon"; import "../../../components/ha-svg-icon";
import "../components/hui-image";
import { import {
AreaRegistryEntry, AreaRegistryEntry,
subscribeAreaRegistry, subscribeAreaRegistry,
@ -265,7 +266,7 @@ export class HuiAreaCard
if ( if (
changedProps.has("_devicesInArea") || changedProps.has("_devicesInArea") ||
changedProps.has("_area") || changedProps.has("_areas") ||
changedProps.has("_entities") changedProps.has("_entities")
) { ) {
return true; return true;
@ -372,9 +373,7 @@ export class HuiAreaCard
? html`<hui-image ? html`<hui-image
.config=${this._config} .config=${this._config}
.hass=${this.hass} .hass=${this.hass}
.image=${area.picture .image=${area.picture ? area.picture : undefined}
? this.hass.hassUrl(area.picture)
: undefined}
.cameraImage=${cameraEntityId} .cameraImage=${cameraEntityId}
aspectRatio="16:9" aspectRatio="16:9"
></hui-image>` ></hui-image>`