diff --git a/nspanel-lovelace-ui/config.yaml b/nspanel-lovelace-ui/config.yaml index 1e97a77b9..c613f2db5 100644 --- a/nspanel-lovelace-ui/config.yaml +++ b/nspanel-lovelace-ui/config.yaml @@ -1,6 +1,6 @@ # https://developers.home-assistant.io/docs/add-ons/configuration#add-on-config name: NSPanel Lovelace UI Addon -version: "4.7.28" +version: "4.7.29" slug: nspanel-lovelace-ui description: NSPanel Lovelace UI Addon services: diff --git a/nspanel-lovelace-ui/rootfs/usr/bin/mqtt-manager/ha_cards.py b/nspanel-lovelace-ui/rootfs/usr/bin/mqtt-manager/ha_cards.py index 540663949..81bdea70f 100644 --- a/nspanel-lovelace-ui/rootfs/usr/bin/mqtt-manager/ha_cards.py +++ b/nspanel-lovelace-ui/rootfs/usr/bin/mqtt-manager/ha_cards.py @@ -22,10 +22,11 @@ def render(self, cardType=""): if self.etype in ["delete", "navigate", "iText"]: out = super().render() if self.etype == "navigate" and "status" in self.config: - config["entity"] = config["status"] + self.config["entity"] = self.config.pop("status") + self.__init__(self.locale, self.config, self.panel) status_out = self.render().split("~") status_out[2] = out.split("~")[2] - status_out = status_out.join("~") + status_out = "~".join(status_out) return status_out return out @@ -42,6 +43,8 @@ def render(self, cardType=""): icon_char = ha_icons.get_icon_ha(self.etype, self.state, device_class=self.attributes.get("device_class", None), media_content_type=self.attributes.get("media_content_type", None), overwrite=self.config.get("icon")) color = ha_colors.get_entity_color( self.etype, self.state, self.attributes) + if self.color_overwrite: + color = rgb_dec565(self.color_overwrite) name = self.config.get("name", self.attributes.get("friendly_name", "unknown")) if self.name_overwrite: name = self.name_overwrite @@ -252,11 +255,11 @@ def gen_nav(self): 'color': [255, 255, 255], }, self.panel ).render()[1:] - if not self.iid_prev and not self.iid_next: + if not self.iid_prev and not self.iid_next and len(self.panel.cards) != 1: leftBtn = panel_cards.Entity(self.locale, { 'entity': f'navigate.UP', - 'icon': 'mdi:arrow-left-bold', + 'icon': 'mdi:arrow-up-bold', 'color': [255, 255, 255], }, self.panel ).render()[1:] diff --git a/nspanel-lovelace-ui/rootfs/usr/bin/mqtt-manager/panel_cards.py b/nspanel-lovelace-ui/rootfs/usr/bin/mqtt-manager/panel_cards.py index e1a097624..1ad6174cb 100644 --- a/nspanel-lovelace-ui/rootfs/usr/bin/mqtt-manager/panel_cards.py +++ b/nspanel-lovelace-ui/rootfs/usr/bin/mqtt-manager/panel_cards.py @@ -41,22 +41,27 @@ def __init__(self, locale, config, panel): def render(self, cardType=""): icon_char = self.icon_overwrite or "" color = rgb_dec565([68, 115, 158]) + if self.color_overwrite: + color = rgb_dec565(self.color_overwrite) name = self.name_overwrite or "" value = "" match self.etype: case 'delete': return f"~delete~~~~~" case 'navigate': - page_search_res = self.panel.searchCard( - self.entity_id.split(".")[1]) - if page_search_res is not None: - if name == "": - name = page_search_res.title - value = get_translation( - self.locale, "frontend.ui.card.button.press") + card_iid = self.entity_id.split(".")[1] + if card_iid == "UP": return f"~button~{self.entity_id}~{get_icon_char(icon_char)}~{color}~{name}~{value}" else: - return f"~text~{self.entity_id}~{get_icon_char('mdi:alert-circle-outline')}~17299~page not found~" + page_search_res = self.panel.searchCard(card_iid) + if page_search_res is not None: + if name == "": + name = page_search_res.title + value = get_translation( + self.locale, "frontend.ui.card.button.press") + return f"~button~{self.entity_id}~{get_icon_char(icon_char)}~{color}~{name}~{value}" + else: + return f"~text~{self.entity_id}~{get_icon_char('mdi:alert-circle-outline')}~17299~page not found~" case 'iText': # TODO: Render as HA Template value = self.entity_id.split(".")[1]