Skip to content

Commit

Permalink
uploaded correct file
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus committed Jul 26, 2018
1 parent 1aa421a commit 4007d96
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions state-element.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
class StateAttributeElement extends HTMLElement {
class StateElement extends HTMLElement {
set hass(hass) {
const entityId = this.config.entity;
const prefix_string = this.config.prefix
const show_empty = this.config.show_empty
const attr = this.config.attribute;
const state = hass.states[entityId].attributes[attr];
const card = document.createElement('state-attribute-element');
const state = hass.states[entityId].state;
const card = document.createElement('state-element');
if (state.length != 0) {
if (prefix_string) {
this.innerHTML = prefix_string + state;
Expand All @@ -24,9 +23,6 @@ class StateAttributeElement extends HTMLElement {
if (!config.entity) {
throw new Error('You need to define an entity');
}
if (!config.attribute) {
throw new Error('You need to define an attribute');
}
if (!config.show_empty) {
config.show_empty = false;
}
Expand All @@ -37,4 +33,4 @@ class StateAttributeElement extends HTMLElement {
return 1;
}
}
customElements.define('state-attribute-element', StateAttributeElement);
customElements.define('state-element', StateElement);

0 comments on commit 4007d96

Please sign in to comment.