From 4f9ead3d9b28897c79d95095a4d488a0f476a9f8 Mon Sep 17 00:00:00 2001 From: Blake Niemyjski Date: Sat, 15 Oct 2022 07:37:36 -0500 Subject: [PATCH] Fixed issue when ha state has yet to be initialized --- surveillance-card.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/surveillance-card.js b/surveillance-card.js index 78c2081..b8ed27d 100644 --- a/surveillance-card.js +++ b/surveillance-card.js @@ -114,7 +114,7 @@ class SurveillanceCard extends LitElement { const now = Date.now(); this.cameras = config.cameras.map((camera) => { - const { states } = this.hass || {}; + const { states = {} } = this.hass || {}; const entity = states[camera.entity]; const attributes = entity?.attributes; const motionEntities = Array.isArray(camera.motion_entity) ? camera.motion_entity : [camera.motion_entity].filter(entityId => !!entityId); @@ -137,7 +137,7 @@ class SurveillanceCard extends LitElement { _updateCameras() { const now = Date.now(); - const { states } = this.hass || {}; + const { states = {} } = this.hass || {}; const activatedCameras = []; for (const camera of this.cameras) {