From 57c5449dfca25d7cd8aedbe5ed94040750f29fb1 Mon Sep 17 00:00:00 2001 From: Johannes Date: Tue, 14 Jun 2022 22:13:41 +0200 Subject: [PATCH 1/6] improve error handling navigation --- apps/nspanel-lovelace-ui/luibackend/controller.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/nspanel-lovelace-ui/luibackend/controller.py b/apps/nspanel-lovelace-ui/luibackend/controller.py index 9e678260..8f6f75bf 100644 --- a/apps/nspanel-lovelace-ui/luibackend/controller.py +++ b/apps/nspanel-lovelace-ui/luibackend/controller.py @@ -241,9 +241,13 @@ class LuiController(object): if button_type == "button": if entity_id.startswith('navigate'): # internal for navigation to nested pages - self._previous_cards.append(self._current_card) - self._current_card = self._config.searchCard(entity_id) - self._pages_gen.render_card(self._current_card) + dstCard = self._config.searchCard(entity_id) + if dstCard is not None: + self._previous_cards.append(self._current_card) + self._current_card = dstCard + self._pages_gen.render_card(self._current_card) + else: + self._ha_api.log(f"No page with key {entity_id} found") elif entity_id.startswith('scene'): self._ha_api.get_entity(entity_id).call_service("turn_on") elif entity_id.startswith('script'): From c7346ed02c03300e272662947d1907363dd0dd23 Mon Sep 17 00:00:00 2001 From: Armilar <102996011+Armilar@users.noreply.github.com> Date: Tue, 14 Jun 2022 22:37:22 +0200 Subject: [PATCH 2/6] Bugfix - Sub-Page closes on Button Action - (Many thanks to Grrzzz) --- ... Sub-Page closes on Button Action - (Many thanks to Grrzzz)} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename ioBroker/{NsPanelTs.ts => Bugfix - Sub-Page closes on Button Action - (Many thanks to Grrzzz)} (99%) diff --git a/ioBroker/NsPanelTs.ts b/ioBroker/ Bugfix - Sub-Page closes on Button Action - (Many thanks to Grrzzz) similarity index 99% rename from ioBroker/NsPanelTs.ts rename to ioBroker/ Bugfix - Sub-Page closes on Button Action - (Many thanks to Grrzzz) index 057b97d7..550340f2 100644 --- a/ioBroker/NsPanelTs.ts +++ b/ioBroker/ Bugfix - Sub-Page closes on Button Action - (Many thanks to Grrzzz) @@ -328,7 +328,7 @@ var WLAN: PageQR = "heading": "Gäste WLAN", "useColor": true, "subPage": true, - "parent": WLAN, + "parent": Subpages_1, "items": [{ id: "alias.0.NSPanel_1.Guest_Wifi" }] }; From 69a5dd323d349e469fabd11fa45d10e41830f380 Mon Sep 17 00:00:00 2001 From: Armilar <102996011+Armilar@users.noreply.github.com> Date: Tue, 14 Jun 2022 22:42:08 +0200 Subject: [PATCH 3/6] V3.0.0 + Bugfix: Sub-Page closes on Button Action (Fix by Grrzzz) --- ...-Page closes on Button Action - (Many thanks to Grrzzz)} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename ioBroker/{ Bugfix - Sub-Page closes on Button Action - (Many thanks to Grrzzz) => Bugfix - Sub-Page closes on Button Action - (Many thanks to Grrzzz)} (99%) diff --git a/ioBroker/ Bugfix - Sub-Page closes on Button Action - (Many thanks to Grrzzz) b/ioBroker/Bugfix - Sub-Page closes on Button Action - (Many thanks to Grrzzz) similarity index 99% rename from ioBroker/ Bugfix - Sub-Page closes on Button Action - (Many thanks to Grrzzz) rename to ioBroker/Bugfix - Sub-Page closes on Button Action - (Many thanks to Grrzzz) index 550340f2..ea8f0c23 100644 --- a/ioBroker/ Bugfix - Sub-Page closes on Button Action - (Many thanks to Grrzzz) +++ b/ioBroker/Bugfix - Sub-Page closes on Button Action - (Many thanks to Grrzzz) @@ -1,6 +1,6 @@ /*----------------------------------------------------------------------- TypeScript zur Steuerung des SONOFF NSPanel mit dem ioBroker -- abgestimmt auf TFT 36 / v2.9.0 / BerryDriver 4 / Tasmota 11.1.0 +- abgestimmt auf TFT 37 / v3.0.0 / BerryDriver 4 / Tasmota 11.1.0 joBr99 Projekt: https://github.com/joBr99/nspanel-lovelace-ui/tree/main/ioBroker NsPanelTs.ts (dieses TypeScript in ioBroker) Stable: https://github.com/joBr99/nspanel-lovelace-ui/blob/main/ioBroker/NsPanelTs.ts icon_mapping.ts: https://github.com/joBr99/nspanel-lovelace-ui/blob/main/ioBroker/icon_mapping.ts (TypeScript muss in global liegen) @@ -550,7 +550,7 @@ check_updates(); //------------------Begin Update Functions function check_updates() { - const desired_display_firmware_version = 36; + const desired_display_firmware_version = 37; const berry_driver_version = 4; if (Debug) console.log("Check-Updates"); @@ -784,7 +784,7 @@ function update_berry_driver_version() { } function update_tft_firmware() { - const tft_version : string = "v2.9.0"; + const tft_version : string = "v3.0.0"; var desired_display_firmware_url = "http://nspanel.pky.eu/lovelace-ui/github/nspanel-" + tft_version + ".tft" require("request")((['http://',get_current_tasmota_ip_address(),'/cm?cmnd=FlashNextion ', desired_display_firmware_url].join('')), async function (error, response, result) { createState(NSPanel_Path + "TFT_Firmware.onlineVersion"); From e84ce9cc1bc28cf260fd1644881dbfc07663bf85 Mon Sep 17 00:00:00 2001 From: Armilar <102996011+Armilar@users.noreply.github.com> Date: Tue, 14 Jun 2022 22:45:37 +0200 Subject: [PATCH 4/6] V3.0.0 + Bugfix: Sub-Page closes on Button Action (Fix by Grrzzz) --- ... on Button Action - (Many thanks to Grrzzz) => NsPanelTs.ts} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename ioBroker/{Bugfix - Sub-Page closes on Button Action - (Many thanks to Grrzzz) => NsPanelTs.ts} (99%) diff --git a/ioBroker/Bugfix - Sub-Page closes on Button Action - (Many thanks to Grrzzz) b/ioBroker/NsPanelTs.ts similarity index 99% rename from ioBroker/Bugfix - Sub-Page closes on Button Action - (Many thanks to Grrzzz) rename to ioBroker/NsPanelTs.ts index ea8f0c23..6af1f12c 100644 --- a/ioBroker/Bugfix - Sub-Page closes on Button Action - (Many thanks to Grrzzz) +++ b/ioBroker/NsPanelTs.ts @@ -82,7 +82,7 @@ Erforderliche Adapter: Upgrades in Konsole: Tasmota BerryDriver : Backlog UpdateDriverVersion https://raw.githubusercontent.com/joBr99/nspanel-lovelace-ui/main/tasmota/autoexec.be; Restart 1 - TFT EU STABLE Version : FlashNextion http://nspanel.pky.eu/lovelace-ui/github/nspanel-v2.9.0.tft + TFT EU STABLE Version : FlashNextion http://nspanel.pky.eu/lovelace-ui/github/nspanel-v3.0.0.tft --------------------------------------------------------------------------------------- */ var Icons = new IconsSelector(); From 2b252d4327ed7d197341e5b40f072d261ae6026a Mon Sep 17 00:00:00 2001 From: Johannes Date: Wed, 15 Jun 2022 16:25:31 +0200 Subject: [PATCH 5/6] additional fix for #284 --- apps/nspanel-lovelace-ui/luibackend/pages.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/nspanel-lovelace-ui/luibackend/pages.py b/apps/nspanel-lovelace-ui/luibackend/pages.py index 968ffc71..f155a4ad 100644 --- a/apps/nspanel-lovelace-ui/luibackend/pages.py +++ b/apps/nspanel-lovelace-ui/luibackend/pages.py @@ -172,7 +172,9 @@ class LuiPagesGen(object): status_entity = self._ha_api.get_entity(item.status) icon_color = self.get_entity_color(status_entity) if item.status.startswith("sensor") and cardType == "cardGrid": - icon_id = status_entity.state + icon_id = status_entity.state[:3] + if icon_id[-1] == ".": + icon_id = icon_id[:-1] else: icon_color = 17299 return f"~button~{entityId}~{icon_id}~{icon_color}~{name}~{text}" From a2a42add20aa0de5454d7ed88549016e327077ef Mon Sep 17 00:00:00 2001 From: Johannes Date: Wed, 15 Jun 2022 17:24:00 +0200 Subject: [PATCH 6/6] add color overwrite to statusIcons #233 --- apps/nspanel-lovelace-ui/luibackend/pages.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/nspanel-lovelace-ui/luibackend/pages.py b/apps/nspanel-lovelace-ui/luibackend/pages.py index f155a4ad..b4b7d218 100644 --- a/apps/nspanel-lovelace-ui/luibackend/pages.py +++ b/apps/nspanel-lovelace-ui/luibackend/pages.py @@ -139,7 +139,7 @@ class LuiPagesGen(object): entity = self._ha_api.get_entity(statusIcon.get("entity")) entityType = statusIcon.get("entity").split(".")[0] icon = get_icon_id_ha(entityType, state=entity.state, device_class=entity.attributes.get("device_class", ""), overwrite=icon) - color = self.get_entity_color(entity) + color = self.get_entity_color(entity, overwrite=statusIcon.get("color", None)) status_res += f"~{icon}~{color}" self._send_mqtt_msg(f"weatherUpdate~{icon_cur}~{text_cur}{weather_res}{altLayout}{status_res}")