Skip to content

Commit 74f90fd

Browse files
authored
Update predbat-table-card.js
Better error handling when predbat HTML entity not available
1 parent 23dfb61 commit 74f90fd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

predbat-table-card.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,14 @@ class PredbatTableCard extends HTMLElement {
8383

8484

8585
const entityId = this.config.entity;
86+
8687
const state = hass.states[entityId];
8788
const stateStr = state ? state.state : "unavailable";
89+
90+
if (stateStr === "unavailable") {
91+
throw new Error("Predbat HTML entity is not currently available");
92+
}
93+
8894
let columnsToReturn = this.config.columns;
8995
let rawHTML = hass.states[entityId].attributes.html;
9096
const dataArray = this.getArrayDataFromHTML(rawHTML, hass.themes.darkMode);

0 commit comments

Comments
 (0)