From 88874ea7b8376a88eafb38cea420b68a66e61667 Mon Sep 17 00:00:00 2001
From: Johannes <29555657+joBr99@users.noreply.github.com>
Date: Wed, 19 Apr 2023 17:39:02 +0200
Subject: [PATCH] fixes #867
---
apps/nspanel-lovelace-ui/luibackend/icon_mapping.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/apps/nspanel-lovelace-ui/luibackend/icon_mapping.py b/apps/nspanel-lovelace-ui/luibackend/icon_mapping.py
index 6323963a..65f63eb7 100644
--- a/apps/nspanel-lovelace-ui/luibackend/icon_mapping.py
+++ b/apps/nspanel-lovelace-ui/luibackend/icon_mapping.py
@@ -6900,15 +6900,19 @@ icons = {
import apis
def get_icon_id(ma_name):
+ if isinstance(ma_name, re.Match):
+ ma_name = ma_name.group(0).replace('', '').replace('', '')
+
if "text:" in ma_name:
return ma_name.replace("text:","")
if "ha:" in ma_name:
splitted_string = ma_name.replace("ha:","").rpartition('}')
template_string = f"{splitted_string[0]}{splitted_string[1]}"
templates_result = apis.ha_api.render_template(template_string)
+ if isinstance(templates_result, str):
+ templates_result = re.sub(r".+?<\/I>", get_icon_id, templates_result)
return f"{templates_result}{splitted_string[2]}"
- if "ha-i:" in ma_name:
- ma_name = apis.ha_api.render_template(ma_name.replace("ha-i:",""))
+
ma_name = ma_name.replace("mdi:","")
if ma_name in icons:
return icons[ma_name]