Skip to content

Commit

Permalink
Merge pull request #30 from SgtBatten/patch-1
Browse files Browse the repository at this point in the history
Fix undefined states error
  • Loading branch information
iantrich authored Aug 12, 2021
2 parents 451aac8 + 063dd81 commit 4964b06
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion circle-sensor-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ class CircleSensorCard extends LitElement {
}

_render({ state, dashArray, config }) {
var stateval;
if (state === undefined) {
stateval = 0;
} else {
stateval = state.state;
}
return html`
<style>
:host {
Expand Down Expand Up @@ -81,7 +87,7 @@ class CircleSensorCard extends LitElement {
${config.name != null ? html`<span id="name">${config.name}</span>` : ''}
<span id="label" class$="${!!config.name ? 'bold' : ''}">
<span class="text">
${config.attribute ? state.attributes[config.attribute] : state.state}
${config.attribute ? state.attributes[config.attribute] : stateval}
</span>
<span class="unit">
${config.show_max
Expand Down

0 comments on commit 4964b06

Please sign in to comment.