From 64d94272215fcbc8affadba34d48f889803beb64 Mon Sep 17 00:00:00 2001 From: Johannes Date: Sun, 5 Jun 2022 08:40:30 +0200 Subject: [PATCH] add first part of hvac status --- apps/nspanel-lovelace-ui/luibackend/localization.py | 2 +- apps/nspanel-lovelace-ui/luibackend/pages.py | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/nspanel-lovelace-ui/luibackend/localization.py b/apps/nspanel-lovelace-ui/luibackend/localization.py index 87cf6d31..dafa7265 100644 --- a/apps/nspanel-lovelace-ui/luibackend/localization.py +++ b/apps/nspanel-lovelace-ui/luibackend/localization.py @@ -39,4 +39,4 @@ def get_translation(locale, lookupstr): res = lookup(path_frontend_file, path_backend_file, lookupstr) return res -print(get_translation("en_US", "frontend.ui.card.button.press")) \ No newline at end of file +#print(get_translation("en_US", "frontend.ui.card.button.press")) \ No newline at end of file diff --git a/apps/nspanel-lovelace-ui/luibackend/pages.py b/apps/nspanel-lovelace-ui/luibackend/pages.py index 0245dba1..d6cc1d8a 100644 --- a/apps/nspanel-lovelace-ui/luibackend/pages.py +++ b/apps/nspanel-lovelace-ui/luibackend/pages.py @@ -286,13 +286,16 @@ class LuiPagesGen(object): heading = title if title != "unknown" else entity.attributes.friendly_name current_temp = get_attr_safe(entity, "current_temperature", "") dest_temp = int(get_attr_safe(entity, "temperature", 0)*10) - status = get_attr_safe(entity, "hvac_action", "") + + hvac_action = get_attr_safe(entity, "hvac_action", "") state_value = "" - if status != "": + if hvac_action != "": + state_value = get_translation(self._locale, f"state_attributes.climate.hvac_action.{hvac_action}") state_value += f"{get_translation(self._locale, status)}\r\n(" state_value += f"{get_translation(self._locale, entity.state)}" - if status != "": + if hvac_action != "": state_value += ")" + min_temp = int(get_attr_safe(entity, "min_temp", 0)*10) max_temp = int(get_attr_safe(entity, "max_temp", 0)*10) step_temp = int(get_attr_safe(entity, "target_temp_step", 0.5)*10)