Skip to content

Commit

Permalink
Update miflora-card.js
Browse files Browse the repository at this point in the history
  • Loading branch information
RodBr authored Jul 20, 2019
1 parent b49bbb5 commit 82a3171
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions miflora-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,15 @@ class MifloraCard extends HTMLElement {
for (var i = 0; i < _sensors.length; i++) {
var _name = _sensors[i][0];
var _sensor = _sensors[i][1];
var _state = hass.states[_sensor].state;
var _uom = hass.states[_sensor].attributes.unit_of_measurement || "";
var _state = '';
var _uom = '';
if (hass.states[_sensor]) {
_state = hass.states[_sensor].state;
_uom = hass.states[_sensor].attributes.unit_of_measurement || "";
} else {
_state = 'Invalid Sensor';
}

var _icon = this._computeIcon(_name, _state);
var _alertStyle = '';
var _alertIcon = '';
Expand Down Expand Up @@ -188,4 +195,4 @@ class MifloraCard extends HTMLElement {
}
}

customElements.define('miflora-card', MifloraCard);
customElements.define('miflora-card', MifloraCard);

0 comments on commit 82a3171

Please sign in to comment.