Skip to content

Commit

Permalink
Fixed issue when ha state has yet to be initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
niemyjski committed Oct 15, 2022
1 parent c2c744c commit 4f9ead3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions surveillance-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) {
Expand Down

0 comments on commit 4f9ead3

Please sign in to comment.