diff --git a/src/panels/config/zha/zha-device-card.ts b/src/panels/config/zha/zha-device-card.ts index 63fb4f0d4c..d0250bd816 100644 --- a/src/panels/config/zha/zha-device-card.ts +++ b/src/panels/config/zha/zha-device-card.ts @@ -42,6 +42,7 @@ import { navigate } from "../../../common/navigate"; import { UnsubscribeFunc, HassEvent } from "home-assistant-js-websocket"; import { formatAsPaddedHex } from "./functions"; import { computeStateName } from "../../../common/entity/compute_state_name"; +import { addEntitiesToLovelaceView } from "../../lovelace/editor/add-entities-to-view"; declare global { // for fire event @@ -109,9 +110,6 @@ class ZHADeviceCard extends LitElement { this.addEventListener("hass-service-called", (ev) => this.serviceCalled(ev) ); - this._serviceData = { - ieee_address: this.device!.ieee, - }; } protected updated(changedProperties: PropertyValues): void { @@ -125,6 +123,9 @@ class ZHADeviceCard extends LitElement { ) + 1; } this._userGivenName = this.device!.user_given_name; + this._serviceData = { + ieee_address: this.device!.ieee, + }; } super.update(changedProperties); } @@ -223,6 +224,13 @@ class ZHADeviceCard extends LitElement { ` )} +
+ + ${this.hass.localize( + "ui.panel.config.devices.entities.add_entities_lovelace" + )} + +
${ this.showEditableInfo ? html` @@ -396,6 +404,14 @@ class ZHADeviceCard extends LitElement { navigate(this, "/config/zha/add/" + this.device!.ieee); } + private _addToLovelaceView(): void { + addEntitiesToLovelaceView( + this, + this.hass, + this.device!.entities.map((entity) => entity.entity_id) + ); + } + static get styles(): CSSResult[] { return [ haStyle, diff --git a/src/panels/config/zha/zha-node.ts b/src/panels/config/zha/zha-node.ts index f6ab86a649..2a45b58554 100644 --- a/src/panels/config/zha/zha-node.ts +++ b/src/panels/config/zha/zha-node.ts @@ -56,17 +56,26 @@ export class ZHANode extends LitElement { )}
- + ${this.device + ? html` + + ` + : html` + + `}
`;