From d4435663cb9fa81eb6dd8416321c4ba463147875 Mon Sep 17 00:00:00 2001 From: SNoof85 Date: Mon, 15 Feb 2021 11:47:02 +0100 Subject: [PATCH 1/5] Update tempometer-gauge-card.js --- tempometer-gauge-card.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tempometer-gauge-card.js b/tempometer-gauge-card.js index 82d0866..670b7b7 100644 --- a/tempometer-gauge-card.js +++ b/tempometer-gauge-card.js @@ -29,7 +29,15 @@ class TempometerGaugeCard extends HTMLElement { cardConfig.entity = entityParts.entity; if (entityParts.attribute) cardConfig.attribute = entityParts.attribute; - let card_style = cardConfig.style; + const entityMinParts = this._splitEntityAndAttribute(cardConfig.entity_min); + cardConfig.entity_min = entityParts.entity_min; + if (entityMinParts.attribute) cardConfig.minAttribute = entityMinParts.attribute; + + const entityMaxParts = this._splitEntityAndAttribute(cardConfig.entity_max); + cardConfig.entity_max = entityParts.entity_max; + if (entityMaxParts.attribute) cardConfig.maxAttribute = entityMaxParts.attribute; + + let card_style = cardConfig.style; const card = document.createElement('ha-card'); const content = document.createElement('div'); const style = document.createElement('style'); @@ -332,12 +340,12 @@ class TempometerGaugeCard extends HTMLElement { var maxEntityState = null; var minEntityState = null; if (config.entity_max !== undefined) { - maxEntityState = this._getEntityStateValue(hass.states[config.entity_max], config.attribute); + maxEntityState = this._getEntityStateValue(hass.states[config.entity_max], config.maxAttribute); } else { root.getElementById("recentMax").style.display = 'none'; } if (config.entity_min !== undefined) { - minEntityState = this._getEntityStateValue(hass.states[config.entity_min], config.attribute); + minEntityState = this._getEntityStateValue(hass.states[config.entity_min], config.minAttribute); } else { root.getElementById("recentMin").style.display = 'none'; } From 65a68bce0777240e0747c402d880cf29f16bcc98 Mon Sep 17 00:00:00 2001 From: SNoof85 Date: Mon, 15 Feb 2021 11:53:23 +0100 Subject: [PATCH 2/5] Update tempometer-gauge-card.js --- tempometer-gauge-card.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tempometer-gauge-card.js b/tempometer-gauge-card.js index 670b7b7..89e9e41 100644 --- a/tempometer-gauge-card.js +++ b/tempometer-gauge-card.js @@ -30,11 +30,11 @@ class TempometerGaugeCard extends HTMLElement { if (entityParts.attribute) cardConfig.attribute = entityParts.attribute; const entityMinParts = this._splitEntityAndAttribute(cardConfig.entity_min); - cardConfig.entity_min = entityParts.entity_min; + cardConfig.entity_min = entityMinParts.entity_min; if (entityMinParts.attribute) cardConfig.minAttribute = entityMinParts.attribute; const entityMaxParts = this._splitEntityAndAttribute(cardConfig.entity_max); - cardConfig.entity_max = entityParts.entity_max; + cardConfig.entity_max = entityMaxParts.entity_max; if (entityMaxParts.attribute) cardConfig.maxAttribute = entityMaxParts.attribute; let card_style = cardConfig.style; From 3cdc485b9f92139d774bc492371a8b70dea765fa Mon Sep 17 00:00:00 2001 From: SNoof85 Date: Mon, 15 Feb 2021 12:17:03 +0100 Subject: [PATCH 3/5] Update tempometer-gauge-card.js --- tempometer-gauge-card.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tempometer-gauge-card.js b/tempometer-gauge-card.js index 89e9e41..bea6ad3 100644 --- a/tempometer-gauge-card.js +++ b/tempometer-gauge-card.js @@ -30,11 +30,11 @@ class TempometerGaugeCard extends HTMLElement { if (entityParts.attribute) cardConfig.attribute = entityParts.attribute; const entityMinParts = this._splitEntityAndAttribute(cardConfig.entity_min); - cardConfig.entity_min = entityMinParts.entity_min; + cardConfig.entity_min = entityMinParts.entity; if (entityMinParts.attribute) cardConfig.minAttribute = entityMinParts.attribute; const entityMaxParts = this._splitEntityAndAttribute(cardConfig.entity_max); - cardConfig.entity_max = entityMaxParts.entity_max; + cardConfig.entity_max = entityMaxParts.entity; if (entityMaxParts.attribute) cardConfig.maxAttribute = entityMaxParts.attribute; let card_style = cardConfig.style; From 650c41dd9d4081f2cb60edb2e555ea54591caff9 Mon Sep 17 00:00:00 2001 From: SNoof85 Date: Mon, 15 Feb 2021 12:19:57 +0100 Subject: [PATCH 4/5] bump version --- tempometer-gauge-card.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tempometer-gauge-card.js b/tempometer-gauge-card.js index bea6ad3..00b89e7 100644 --- a/tempometer-gauge-card.js +++ b/tempometer-gauge-card.js @@ -1,4 +1,4 @@ -console.info(`%c TEMPOMETER-CARD \n%c v1.1 `, 'color: orange; font-weight: bold; background: black', 'color: white; font-weight: bold; background: dimgray'); +console.info(`%c TEMPOMETER-CARD \n%c v1.2 `, 'color: orange; font-weight: bold; background: black', 'color: white; font-weight: bold; background: dimgray'); class TempometerGaugeCard extends HTMLElement { constructor() { super(); From 9119ee7a3dc9c36af69b884b0f09f167da9b6c34 Mon Sep 17 00:00:00 2001 From: SNoof85 Date: Mon, 15 Feb 2021 12:21:44 +0100 Subject: [PATCH 5/5] Update README.md --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fa77328..f8ac2c2 100644 --- a/README.md +++ b/README.md @@ -22,12 +22,11 @@ Add it as a custom card to your lovelace : `'custom:tempometer-gauge-card'`. ### Card options | **Option** | **Type** | **Description** | |-|:-:|-| -| `entity` ***(required)*** | string | The entity to track. | -| `attribute`| string | The entity attribute to track. | +| `entity` ***(required)*** | string | The entity to track. Can be followed by an attribute to track `entity.attribute)`| | `min` ***(required)*** | number | The gauge's minimum value | | `max` ***(required)*** | number | The gauge's maximum value | -| `entity_min` | string | The entity that define the minimum pressure/temperature reached (you have to create this entity, the card will not compute it !) | -| `entity_max` | string | The entity that define the maximum pressure/temerature reached (you have to create this entity, the card will not compute it !) | +| `entity_min` | string | The entity that define the minimum reached. Can be followed by an attribute to track `entity.attribute)` (you have to create this entity, the card will not compute it !) | +| `entity_max` | string | The entity that define the maximum reached. Can be followed by an attribute to track `entity.attribute)` (you have to create this entity, the card will not compute it !) | | `title` | string | Card title to show. | | `style` | string | Set this to `thermometer`, `humidity` or `custom` to change icons. (Default will be barometer theme, custom will need icon1, icon2, icon3 !) | | `measurement` | string | Custom unit of measurement |