mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-26 17:34:26 +01:00
fixes #867
This commit is contained in:
@@ -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('<I>', '').replace('</I>', '')
|
||||
|
||||
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>.+?<\/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]
|
||||
|
||||
Reference in New Issue
Block a user