mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2026-02-13 08:28:19 +01:00
Merge pull request #290 from illuzn/illuzn-patch-status-patch
Illuzn patch status patch
This commit is contained in:
@@ -165,26 +165,28 @@ class LuiPagesGen(object):
|
|||||||
if entityType == "navigate":
|
if entityType == "navigate":
|
||||||
page_search_res = self._config.searchCard(entityId)
|
page_search_res = self._config.searchCard(entityId)
|
||||||
if page_search_res is not None:
|
if page_search_res is not None:
|
||||||
|
icon_res = get_icon_id(icon) if icon is not None else get_icon_id("gesture-tap-button")
|
||||||
|
status_entity = None
|
||||||
name = name if name is not None else page_search_res.title
|
name = name if name is not None else page_search_res.title
|
||||||
text = get_translation(self._locale, "frontend.ui.card.button.press")
|
text = get_translation(self._locale, "frontend.ui.card.button.press")
|
||||||
icon_id = get_icon_id(icon) if icon is not None else get_icon_id("gesture-tap-button")
|
|
||||||
if item.status is not None and self._ha_api.entity_exists(item.status):
|
if item.status is not None and self._ha_api.entity_exists(item.status):
|
||||||
status_entity = self._ha_api.get_entity(item.status)
|
status_entity = self._ha_api.get_entity(item.status)
|
||||||
|
icon_res = get_icon_id_ha(item.status.split(".")[0], state=status_entity.state, device_class=status_entity.attributes.get("device_class", "_"), overwrite=icon)
|
||||||
icon_color = self.get_entity_color(status_entity)
|
icon_color = self.get_entity_color(status_entity)
|
||||||
if item.status.startswith("sensor") and cardType == "cardGrid":
|
if item.status.startswith("sensor") and cardType == "cardGrid":
|
||||||
icon_id = status_entity.state[:4]
|
icon_res = status_entity.state[:4]
|
||||||
if icon_id[-1] == ".":
|
if icon_res[-1] == ".":
|
||||||
icon_id = icon_id[:-1]
|
icon_res = icon_res[:-1]
|
||||||
else:
|
else:
|
||||||
icon_color = 17299
|
icon_color = 17299
|
||||||
return f"~button~{entityId}~{icon_id}~{icon_color}~{name}~{text}"
|
return f"~button~{entityId}~{icon_res}~{icon_color}~{name}~{text}"
|
||||||
else:
|
else:
|
||||||
return f"~text~{entityId}~{get_icon_id('alert-circle-outline')}~17299~page not found~"
|
return f"~text~{entityId}~{get_icon_id('alert-circle-outline')}~17299~page not found~"
|
||||||
if entityType == "iText":
|
if entityType == "iText":
|
||||||
value = entityId.split(".", 2)[1]
|
value = entityId.split(".", 2)[1]
|
||||||
name = name if name is not None else "conf name missing"
|
name = name if name is not None else "conf name missing"
|
||||||
icon_id = get_icon_id(icon) if icon is not None else get_icon_id("alert-circle-outline")
|
icon_res = get_icon_id(icon) if icon is not None else get_icon_id("alert-circle-outline")
|
||||||
return f"~text~{entityId}~{icon_id}~17299~{name}~{value}"
|
return f"~text~{entityId}~{icon_res}~17299~{name}~{value}"
|
||||||
if not self._ha_api.entity_exists(entityId):
|
if not self._ha_api.entity_exists(entityId):
|
||||||
return f"~text~{entityId}~{get_icon_id('alert-circle-outline')}~17299~Not found check~ apps.yaml"
|
return f"~text~{entityId}~{get_icon_id('alert-circle-outline')}~17299~Not found check~ apps.yaml"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user