From 420bab081efe6474af02ab5149fd48d8a3e74571 Mon Sep 17 00:00:00 2001 From: Guillaume MARSAN Date: Mon, 16 Aug 2021 11:44:27 +0200 Subject: [PATCH] Fixed data display --- CHANGELOG.md | 4 ++++ bosch-indego-card.js | 17 ++++++----------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6f6595..b1e32ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog All notable changes to this project will be documented in this file. +## 1.0.2 + +Corrected bug that doesn't display infos on card + ## 1.0.0 Card now works without the need of creating a template. diff --git a/bosch-indego-card.js b/bosch-indego-card.js index 32f0642..361327f 100644 --- a/bosch-indego-card.js +++ b/bosch-indego-card.js @@ -1,7 +1,7 @@ /*jshint esversion: 6 */ ((LitElement) => { console.info( - '%c BOSCH-INDEGO-CARD %c 1.0.0 ', + '%c BOSCH-INDEGO-CARD %c 1.0.2 ', 'color: lawngreen; background: black; font-weight: bold;', 'color: lawngreen; background: white; font-weight: bold;' ); @@ -243,39 +243,34 @@ if (INDEGO_SENSOR_START != null) { INDEGO_SENSOR_START = INDEGO_SENSOR_START[0]; } else { - throw new Error("Can't find a valid serial number in entity."); + throw new Error("INDEGO-CARD : Can't find the sensor name in entity."); } INDEGO_SERIAL = entityName.match(serialNumRegex); if (INDEGO_SERIAL != null) { INDEGO_SERIAL = INDEGO_SERIAL[0].substring(1 , 10); } else { - throw new Error("Can't find a valid serial number in entity."); + throw new Error("INDEGO-CARD : Can't find a valid serial number in entity."); } INDEGO_IDENT = entityName.match(indegoEntityIdentRegex); if (INDEGO_IDENT != null) { INDEGO_IDENT = INDEGO_IDENT[0].substring(7 , INDEGO_IDENT[0].length-1); } else { - throw new Error("Can't find a valid indego identifier in entity."); + throw new Error("INDEGO-CARD : Can't find a valid indego identifier in entity."); } - //DEBUG // States loop Object.keys(this.config.state).forEach(key => { - // this.config.state[key].entity="sensor."+INDEGO_IDENT+"_"+INDEGO_SERIAL+this.config.state[key].entity_suffix+"_2"; - if (!this.config.state[key]) { - + if (this.config.state[key]) { this.config.state[key].entity = INDEGO_SENSOR_START + this.config.state[key].entity_suffix; } - // console.log(key, this.config.state[key]); }); // Attributes loop Object.keys(this.config.attributes).forEach(key => { - if(!this.config.attributes[key]) { - + if(this.config.attributes[key]) { this.config.attributes[key].entity = INDEGO_SENSOR_START + this.config.attributes[key].entity_suffix; } // this.config.attributes[key].entity="sensor.indego_"+INDEGO_SERIAL+this.config.attributes[key].entity_suffix+"_2";