fix area index on ZHA device card (#4406)

This commit is contained in:
David F. Mulcahey 2020-01-02 04:50:19 -05:00 committed by Bram Kragten
parent 2988cc512f
commit 1b0d8bba29

View File

@ -81,6 +81,12 @@ class ZHADeviceCard extends LitElement {
super.connectedCallback();
this._unsubAreas = subscribeAreaRegistry(this.hass.connection, (areas) => {
this._areas = areas;
if (this.device) {
this._selectedAreaIndex =
this._areas.findIndex(
(area) => area.area_id === this.device!.area_id
) + 1; // account for the no area selected index
}
});
this.hass.connection
.subscribeEvents((event: HassEvent) => {