From 3216d83bddf1a54fa30b6572285d888a1facec1c Mon Sep 17 00:00:00 2001 From: joBr99 <29555657+joBr99@users.noreply.github.com> Date: Sat, 1 Oct 2022 10:00:51 +0200 Subject: [PATCH] implements #484 (#494) --- apps/nspanel-lovelace-ui/luibackend/pages.py | 9 ++++++--- docs/card-climate.md | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/nspanel-lovelace-ui/luibackend/pages.py b/apps/nspanel-lovelace-ui/luibackend/pages.py index 6b9bfbfc..962ed0ec 100644 --- a/apps/nspanel-lovelace-ui/luibackend/pages.py +++ b/apps/nspanel-lovelace-ui/luibackend/pages.py @@ -379,7 +379,7 @@ class LuiPagesGen(object): command += self.generate_entities_item(item, cardType, tempUnit) self._send_mqtt_msg(command) - def generate_thermo_page(self, navigation, title, entity, temp_unit): + def generate_thermo_page(self, navigation, title, entity, temp_unit, overwrite_supported_modes): item = entity.entityId if(temp_unit == "celsius"): @@ -419,7 +419,8 @@ class LuiPagesGen(object): icon_res = "" hvac_modes = get_attr_safe(entity, "hvac_modes", []) - + if overwrite_supported_modes is not None: + hvac_modes = overwrite_supported_modes for mode in hvac_modes: icon_id = get_icon("climate", state=mode) color_on = 64512 @@ -613,7 +614,9 @@ class LuiPagesGen(object): self.generate_entities_page(navigation, card.title, card.entities, card.cardType, temp_unit) return if card.cardType == "cardThermo": - self.generate_thermo_page(navigation, card.title, card.entity, temp_unit) + temp_unit = card.raw_config.get("temperatureUnit", "celsius") + overwrite_supported_modes = card.raw_config.get("supportedModes") + self.generate_thermo_page(navigation, card.title, card.entity, temp_unit, overwrite_supported_modes) return if card.cardType == "cardMedia": mediaBtn = card.raw_config.get("mediaControl", "") diff --git a/docs/card-climate.md b/docs/card-climate.md index c4eba462..da6f5f27 100644 --- a/docs/card-climate.md +++ b/docs/card-climate.md @@ -23,4 +23,5 @@ key | optional | type | default | description `entities` | False | complex | `None` | contains a list of entities of this card `title` | True | string | `None` | Title of the Page `temperatureUnit` | True | string | `celsius` | set this to fahrenheit to change the temperatureUnit on the page -`key` | True | string | `None` | Used by navigate items in combination with the type (cardEntities_key) \ No newline at end of file +`key` | True | string | `None` | Used by navigate items in combination with the type (cardEntities_key) +`supportedModes` | True | list | `None` | Supply list of heat actions if you want to limit the actions on the card. Example `['heat', 'off']`