mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-21 06:54:24 +01:00
fix template icons without <I></I>
This commit is contained in:
@@ -18,7 +18,7 @@ class HAEntity(panel_cards.Entity):
|
|||||||
|
|
||||||
if self.icon_overwrite and self.icon_overwrite.startswith("ha:"):
|
if self.icon_overwrite and self.icon_overwrite.startswith("ha:"):
|
||||||
#icon_char = libs.home_assistant.render_template(self.icon_overwrite[3:])
|
#icon_char = libs.home_assistant.render_template(self.icon_overwrite[3:])
|
||||||
self.icon_overwrite = ha_template.render(self.icon_overwrite[3:])
|
self.icon_overwrite = ha_template.render(self.icon_overwrite)
|
||||||
|
|
||||||
if self.etype in ["delete", "navigate", "iText"]:
|
if self.etype in ["delete", "navigate", "iText"]:
|
||||||
out = super().render()
|
out = super().render()
|
||||||
|
|||||||
@@ -6904,16 +6904,14 @@ icons = {
|
|||||||
def get_icon_id(ma_name):
|
def get_icon_id(ma_name):
|
||||||
if isinstance(ma_name, re.Match):
|
if isinstance(ma_name, re.Match):
|
||||||
ma_name = ma_name.group(0).replace('<I>', '').replace('</I>', '')
|
ma_name = ma_name.group(0).replace('<I>', '').replace('</I>', '')
|
||||||
print(f"testxxxx {ma_name}")
|
|
||||||
|
|
||||||
if "text:" in ma_name:
|
if "text:" in ma_name:
|
||||||
return ma_name.replace("text:", "")
|
return ma_name.replace("text:", "")
|
||||||
|
if "ha:" in ma_name:
|
||||||
if "<I>" in ma_name and "</I>" in ma_name:
|
if "<I>" in ma_name and "</I>" in ma_name:
|
||||||
print(f"testdddd {ma_name}")
|
|
||||||
if isinstance(ma_name, str):
|
if isinstance(ma_name, str):
|
||||||
ma_name = re.sub(r'<I>.+?<\/I>', get_icon_id, ma_name)
|
ma_name = re.sub(r'<I>.+?<\/I>', get_icon_id, ma_name)
|
||||||
print(f"test123d {ma_name}")
|
return ma_name.replace("ha:", "")
|
||||||
return ma_name
|
|
||||||
|
|
||||||
ma_name = ma_name.replace("mdi:", "")
|
ma_name = ma_name.replace("mdi:", "")
|
||||||
if ma_name in icons:
|
if ma_name in icons:
|
||||||
|
|||||||
Reference in New Issue
Block a user