From 6d3759b99c61469aaf1711fc77f9a0ca9d5d910f Mon Sep 17 00:00:00 2001 From: illuzn <57167030+illuzn@users.noreply.github.com> Date: Sun, 22 May 2022 14:57:56 +0930 Subject: [PATCH 1/7] Covers use device_class Covers now use device_class to dynamically change the icon so that it is relevant. --- apps/nspanel-lovelace-ui/luibackend/icons.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/nspanel-lovelace-ui/luibackend/icons.py b/apps/nspanel-lovelace-ui/luibackend/icons.py index 849d826e..76322d42 100644 --- a/apps/nspanel-lovelace-ui/luibackend/icons.py +++ b/apps/nspanel-lovelace-ui/luibackend/icons.py @@ -52,7 +52,19 @@ def map_to_mdi_name(ha_type, state=None, device_class=None): if ha_type == "input_boolean": return "check-circle-outline" if state == "on" else "close-circle-outline" if ha_type == "cover": - return "window-open" if state == "open" else "window-closed" + if device_class == "awning" or device_class == "blind" or device_class == "curtain": + return "blinds-open" if state == "open" else "blinds" + elif device_class == "door": + return "door-open" if state == "open" else "door-closed" + elif device_class == "garage": + return "garage-open" if state == "open" else "garage" + elif device_class == "gate": + return "gate-open" if state == "open" else "gate" + elif device_class == "shade" or device_class == "shutter": + return "window-shutter-open" if state == "open" else "window-shutter" + else: + # This should run for None, window or damper + return "window-open" if state == "open" else "window-closed" if ha_type == "lock": return "lock-open" if state == "unlocked" else "lock" From 93cdc3d83104fc0d5e606bbf9d022d9f412151d3 Mon Sep 17 00:00:00 2001 From: illuzn <57167030+illuzn@users.noreply.github.com> Date: Sun, 22 May 2022 14:57:58 +0930 Subject: [PATCH 2/7] Laying down groundwork for better cover icons Uses device_class to distinguish between different types of cover and passes to get_icon_id_ha. If device_class is not configured, defaults to None (window) as fallback. --- 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 2cacdd8c..14f37aca 100644 --- a/apps/nspanel-lovelace-ui/luibackend/pages.py +++ b/apps/nspanel-lovelace-ui/luibackend/pages.py @@ -143,7 +143,7 @@ class LuiPagesGen(object): entity = self._ha_api.get_entity(entityId) name = name if name is not None else entity.attributes.friendly_name if entityType == "cover": - icon_id = get_icon_id_ha("cover", state=entity.state, overwrite=icon) + icon_id = get_icon_id_ha("cover", state=entity.state, device_class=entity.attributes.get("device_class", ""), overwrite=icon) pos = int(entity.attributes.get("current_position", 50)) if pos == 100: status = "0|1" From feade863f495e73ecff4c3819084c37408ea3155 Mon Sep 17 00:00:00 2001 From: illuzn <57167030+illuzn@users.noreply.github.com> Date: Sun, 22 May 2022 15:34:24 +0930 Subject: [PATCH 3/7] Update pages.py --- 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 14f37aca..8dfb5b41 100644 --- a/apps/nspanel-lovelace-ui/luibackend/pages.py +++ b/apps/nspanel-lovelace-ui/luibackend/pages.py @@ -143,7 +143,7 @@ class LuiPagesGen(object): entity = self._ha_api.get_entity(entityId) name = name if name is not None else entity.attributes.friendly_name if entityType == "cover": - icon_id = get_icon_id_ha("cover", state=entity.state, device_class=entity.attributes.get("device_class", ""), overwrite=icon) + icon_id = get_icon_id_ha("cover", state=entity.state, device_class=entity.attributes.get("device_class"), overwrite=icon) pos = int(entity.attributes.get("current_position", 50)) if pos == 100: status = "0|1" From b11aebc88c695796e8bd36724fc6917a449c276e Mon Sep 17 00:00:00 2001 From: Johannes Date: Sun, 22 May 2022 08:54:14 +0200 Subject: [PATCH 4/7] Update icons.py --- apps/nspanel-lovelace-ui/luibackend/icons.py | 42 ++++++++++++++------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/apps/nspanel-lovelace-ui/luibackend/icons.py b/apps/nspanel-lovelace-ui/luibackend/icons.py index 76322d42..44d13760 100644 --- a/apps/nspanel-lovelace-ui/luibackend/icons.py +++ b/apps/nspanel-lovelace-ui/luibackend/icons.py @@ -31,6 +31,31 @@ sensor_mapping = { "power": "flash" } +cover_mapping_open = { + "awning": "window-open", + "blind": "blinds-open", + "curtain": "curtains-closed", + "damper": "checkbox-blank-circle", + "door": "door-open", + "garage": "garage", + "gate": "gate", + "shade": "blinds-open", + "shutter": "window-shutter-open", + "window": "window-open" +} + +cover_mapping_closed = { + "awning": "window-closed", + "blind": "blinds", + "curtain": "curtains", + "damper": "circle-slice-8", + "door": "door-closed", + "garage": "garage-open", + "gate": "gate-open", + "shade": "blinds", + "shutter": "window-shutter", + "window": "window-closed" +} def map_to_mdi_name(ha_type, state=None, device_class=None): if ha_type == "weather": @@ -52,19 +77,12 @@ def map_to_mdi_name(ha_type, state=None, device_class=None): if ha_type == "input_boolean": return "check-circle-outline" if state == "on" else "close-circle-outline" if ha_type == "cover": - if device_class == "awning" or device_class == "blind" or device_class == "curtain": - return "blinds-open" if state == "open" else "blinds" - elif device_class == "door": - return "door-open" if state == "open" else "door-closed" - elif device_class == "garage": - return "garage-open" if state == "open" else "garage" - elif device_class == "gate": - return "gate-open" if state == "open" else "gate" - elif device_class == "shade" or device_class == "shutter": - return "window-shutter-open" if state == "open" else "window-shutter" + if device_class is None: + device_class = "window" + if state == "closed": + return cover_mapping_closed[device_class] if device_class in cover_mapping_closed else "alert-circle-outline" else: - # This should run for None, window or damper - return "window-open" if state == "open" else "window-closed" + return cover_mapping_open[device_class] if device_class in cover_mapping_open else "alert-circle-outline" if ha_type == "lock": return "lock-open" if state == "unlocked" else "lock" From 7e13d2ec4273c1e29b1e454676f4143b941b5bd4 Mon Sep 17 00:00:00 2001 From: Johannes Date: Sun, 22 May 2022 08:56:02 +0200 Subject: [PATCH 5/7] Update pages.py --- apps/nspanel-lovelace-ui/luibackend/pages.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/nspanel-lovelace-ui/luibackend/pages.py b/apps/nspanel-lovelace-ui/luibackend/pages.py index 8dfb5b41..b4503c22 100644 --- a/apps/nspanel-lovelace-ui/luibackend/pages.py +++ b/apps/nspanel-lovelace-ui/luibackend/pages.py @@ -143,7 +143,8 @@ class LuiPagesGen(object): entity = self._ha_api.get_entity(entityId) name = name if name is not None else entity.attributes.friendly_name if entityType == "cover": - icon_id = get_icon_id_ha("cover", state=entity.state, device_class=entity.attributes.get("device_class"), overwrite=icon) + device_class = entity.attributes.get("device_class", "") + icon_id = get_icon_id_ha("cover", state=entity.state, device_class=device_class, overwrite=icon) pos = int(entity.attributes.get("current_position", 50)) if pos == 100: status = "0|1" From 4aebed68074dff8ed9c1b21ab74587f8f0f5e0a5 Mon Sep 17 00:00:00 2001 From: joBr99 Date: Sun, 22 May 2022 07:58:31 +0000 Subject: [PATCH 6/7] Merge branch 'main' into main (add nextion2text) --- HMI/US/landscape/diff-eu-version.txt | 8 ++++---- HMI/US/portrait/diff-eu-version.txt | 12 ++++++------ HMI/US/portrait/diff-filtered.txt | 14 +++++++------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/HMI/US/landscape/diff-eu-version.txt b/HMI/US/landscape/diff-eu-version.txt index ac260387..6c8c8169 100644 --- a/HMI/US/landscape/diff-eu-version.txt +++ b/HMI/US/landscape/diff-eu-version.txt @@ -1,6 +1,6 @@ diff -bur HMI/n2t-out/Program.s.txt HMI/US/landscape/n2t-out/Program.s.txt ---- HMI/n2t-out/Program.s.txt 2022-05-22 07:55:04.215774434 +0000 -+++ HMI/US/landscape/n2t-out/Program.s.txt 2022-05-22 07:55:05.103784355 +0000 +--- HMI/n2t-out/Program.s.txt 2022-05-22 07:58:25.897799068 +0000 ++++ HMI/US/landscape/n2t-out/Program.s.txt 2022-05-22 07:58:27.009807303 +0000 @@ -11,6 +11,4 @@ // dim value int dimValue=40 @@ -9,8 +9,8 @@ diff -bur HMI/n2t-out/Program.s.txt HMI/US/landscape/n2t-out/Program.s.txt - lcd_dev fffb 0002 0000 0020 page pageStartup diff -bur HMI/n2t-out/pageStartup.txt HMI/US/landscape/n2t-out/pageStartup.txt ---- HMI/n2t-out/pageStartup.txt 2022-05-22 07:55:04.215774434 +0000 -+++ HMI/US/landscape/n2t-out/pageStartup.txt 2022-05-22 07:55:05.107784400 +0000 +--- HMI/n2t-out/pageStartup.txt 2022-05-22 07:58:25.897799068 +0000 ++++ HMI/US/landscape/n2t-out/pageStartup.txt 2022-05-22 07:58:27.009807303 +0000 @@ -177,7 +177,7 @@ recmod=1 bauds=115200 diff --git a/HMI/US/portrait/diff-eu-version.txt b/HMI/US/portrait/diff-eu-version.txt index f9b1d2f1..2c79a36c 100644 --- a/HMI/US/portrait/diff-eu-version.txt +++ b/HMI/US/portrait/diff-eu-version.txt @@ -1,6 +1,6 @@ diff -bur HMI/n2t-out/Program.s.txt HMI/US/portrait/n2t-out/Program.s.txt ---- HMI/n2t-out/Program.s.txt 2022-05-22 07:55:04.215774434 +0000 -+++ HMI/US/portrait/n2t-out/Program.s.txt 2022-05-22 07:55:04.651779305 +0000 +--- HMI/n2t-out/Program.s.txt 2022-05-22 07:58:25.897799068 +0000 ++++ HMI/US/portrait/n2t-out/Program.s.txt 2022-05-22 07:58:26.425802978 +0000 @@ -11,6 +11,6 @@ // dim value int dimValue=40 @@ -11,8 +11,8 @@ diff -bur HMI/n2t-out/Program.s.txt HMI/US/portrait/n2t-out/Program.s.txt + //lcd_dev fffb 0002 0000 0020 page pageStartup diff -bur HMI/n2t-out/cardEntities.txt HMI/US/portrait/n2t-out/cardEntities.txt ---- HMI/n2t-out/cardEntities.txt 2022-05-22 07:55:04.219774478 +0000 -+++ HMI/US/portrait/n2t-out/cardEntities.txt 2022-05-22 07:55:04.651779305 +0000 +--- HMI/n2t-out/cardEntities.txt 2022-05-22 07:58:25.901799098 +0000 ++++ HMI/US/portrait/n2t-out/cardEntities.txt 2022-05-22 07:58:26.425802978 +0000 @@ -62,6 +62,16 @@ vis bText4,0 vis hSlider4,0 @@ -464,8 +464,8 @@ diff -bur HMI/n2t-out/cardEntities.txt HMI/US/portrait/n2t-out/cardEntities.txt if(tInstruction.txt=="pageType") { diff -bur HMI/n2t-out/pageStartup.txt HMI/US/portrait/n2t-out/pageStartup.txt ---- HMI/n2t-out/pageStartup.txt 2022-05-22 07:55:04.215774434 +0000 -+++ HMI/US/portrait/n2t-out/pageStartup.txt 2022-05-22 07:55:04.651779305 +0000 +--- HMI/n2t-out/pageStartup.txt 2022-05-22 07:58:25.897799068 +0000 ++++ HMI/US/portrait/n2t-out/pageStartup.txt 2022-05-22 07:58:26.425802978 +0000 @@ -142,7 +142,7 @@ Disable release event after dragging: 0 Send Component ID : disabled diff --git a/HMI/US/portrait/diff-filtered.txt b/HMI/US/portrait/diff-filtered.txt index 98ee16f7..73468337 100644 --- a/HMI/US/portrait/diff-filtered.txt +++ b/HMI/US/portrait/diff-filtered.txt @@ -1,8 +1,8 @@ -+++ HMI/US/portrait/diff-eu-version.txt 2022-05-22 07:55:04.663779439 +0000 -+--- HMI/n2t-out/Program.s.txt 2022-05-22 07:55:04.215774434 +0000 -++++ HMI/US/portrait/n2t-out/Program.s.txt 2022-05-22 07:55:04.651779305 +0000 -+--- HMI/n2t-out/cardEntities.txt 2022-05-22 07:55:04.219774478 +0000 -++++ HMI/US/portrait/n2t-out/cardEntities.txt 2022-05-22 07:55:04.651779305 +0000 ++++ HMI/US/portrait/diff-eu-version.txt 2022-05-22 07:58:26.469803304 +0000 ++--- HMI/n2t-out/Program.s.txt 2022-05-22 07:58:25.897799068 +0000 +++++ HMI/US/portrait/n2t-out/Program.s.txt 2022-05-22 07:58:26.425802978 +0000 ++--- HMI/n2t-out/cardEntities.txt 2022-05-22 07:58:25.901799098 +0000 +++++ HMI/US/portrait/n2t-out/cardEntities.txt 2022-05-22 07:58:26.425802978 +0000 + Hotspot mSwipeNext + Scope : local +@@ -1876,6 +2104,165 @@ @@ -30,5 +30,5 @@ ++ { ++ bDown5.pco=27501 ++ tsw bDown5,0 -+--- HMI/n2t-out/pageStartup.txt 2022-05-22 07:55:04.215774434 +0000 -++++ HMI/US/portrait/n2t-out/pageStartup.txt 2022-05-22 07:55:04.651779305 +0000 ++--- HMI/n2t-out/pageStartup.txt 2022-05-22 07:58:25.897799068 +0000 +++++ HMI/US/portrait/n2t-out/pageStartup.txt 2022-05-22 07:58:26.425802978 +0000 From a89ba30cd3e3d166818cd302faa646696b25832c Mon Sep 17 00:00:00 2001 From: joBr99 Date: Sun, 22 May 2022 08:56:38 +0000 Subject: [PATCH 7/7] Merge branch 'main' into pr/203 (add nextion2text) --- HMI/US/landscape/diff-eu-version.txt | 8 ++++---- HMI/US/portrait/diff-eu-version.txt | 13 +++++++++---- HMI/US/portrait/diff-filtered.txt | 12 +++++++----- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/HMI/US/landscape/diff-eu-version.txt b/HMI/US/landscape/diff-eu-version.txt index aebc8351..30aa9bbb 100644 --- a/HMI/US/landscape/diff-eu-version.txt +++ b/HMI/US/landscape/diff-eu-version.txt @@ -1,6 +1,6 @@ diff -bur HMI/n2t-out/Program.s.txt HMI/US/landscape/n2t-out/Program.s.txt ---- HMI/n2t-out/Program.s.txt 2022-05-22 08:52:05.367816736 +0000 -+++ HMI/US/landscape/n2t-out/Program.s.txt 2022-05-22 08:52:06.663941704 +0000 +--- HMI/n2t-out/Program.s.txt 2022-05-22 08:56:32.972794177 +0000 ++++ HMI/US/landscape/n2t-out/Program.s.txt 2022-05-22 08:56:34.028800991 +0000 @@ -11,6 +11,4 @@ // dim value int dimValue=40 @@ -9,8 +9,8 @@ diff -bur HMI/n2t-out/Program.s.txt HMI/US/landscape/n2t-out/Program.s.txt - lcd_dev fffb 0002 0000 0020 page pageStartup diff -bur HMI/n2t-out/pageStartup.txt HMI/US/landscape/n2t-out/pageStartup.txt ---- HMI/n2t-out/pageStartup.txt 2022-05-22 08:52:05.367816736 +0000 -+++ HMI/US/landscape/n2t-out/pageStartup.txt 2022-05-22 08:52:06.667941783 +0000 +--- HMI/n2t-out/pageStartup.txt 2022-05-22 08:56:32.972794177 +0000 ++++ HMI/US/landscape/n2t-out/pageStartup.txt 2022-05-22 08:56:34.032801017 +0000 @@ -177,7 +177,7 @@ recmod=1 bauds=115200 diff --git a/HMI/US/portrait/diff-eu-version.txt b/HMI/US/portrait/diff-eu-version.txt index cb0ae92e..2c7ea44b 100644 --- a/HMI/US/portrait/diff-eu-version.txt +++ b/HMI/US/portrait/diff-eu-version.txt @@ -1,6 +1,6 @@ diff -bur HMI/n2t-out/Program.s.txt HMI/US/portrait/n2t-out/Program.s.txt ---- HMI/n2t-out/Program.s.txt 2022-05-22 08:52:05.367816736 +0000 -+++ HMI/US/portrait/n2t-out/Program.s.txt 2022-05-22 08:52:05.927852627 +0000 +--- HMI/n2t-out/Program.s.txt 2022-05-22 08:56:32.972794177 +0000 ++++ HMI/US/portrait/n2t-out/Program.s.txt 2022-05-22 08:56:33.488797507 +0000 @@ -11,6 +11,6 @@ // dim value int dimValue=40 @@ -11,8 +11,8 @@ diff -bur HMI/n2t-out/Program.s.txt HMI/US/portrait/n2t-out/Program.s.txt + //lcd_dev fffb 0002 0000 0020 page pageStartup diff -bur HMI/n2t-out/cardEntities.txt HMI/US/portrait/n2t-out/cardEntities.txt ---- HMI/n2t-out/cardEntities.txt 2022-05-22 08:52:05.367816736 +0000 -+++ HMI/US/portrait/n2t-out/cardEntities.txt 2022-05-22 08:52:05.927852627 +0000 +--- HMI/n2t-out/cardEntities.txt 2022-05-22 08:56:32.976794203 +0000 ++++ HMI/US/portrait/n2t-out/cardEntities.txt 2022-05-22 08:56:33.492797532 +0000 @@ -62,6 +62,16 @@ vis bText4,0 vis hSlider4,0 @@ -465,8 +465,13 @@ diff -bur HMI/n2t-out/cardEntities.txt HMI/US/portrait/n2t-out/cardEntities.txt if(tInstruction.txt=="pageType") { diff -bur HMI/n2t-out/pageStartup.txt HMI/US/portrait/n2t-out/pageStartup.txt +--- HMI/n2t-out/pageStartup.txt 2022-05-22 08:56:32.972794177 +0000 ++++ HMI/US/portrait/n2t-out/pageStartup.txt 2022-05-22 08:56:33.488797507 +0000 +@@ -142,7 +142,7 @@ + Disable release event after dragging: 0 Send Component ID : disabled Associated Keyboard : none +- Text : please check your backend configuration + Text : pls check your backend configuration Max. Text Size : 100 diff --git a/HMI/US/portrait/diff-filtered.txt b/HMI/US/portrait/diff-filtered.txt index aa09eec7..67fd2d23 100644 --- a/HMI/US/portrait/diff-filtered.txt +++ b/HMI/US/portrait/diff-filtered.txt @@ -1,8 +1,8 @@ -+++ HMI/US/portrait/diff-eu-version.txt 2022-05-22 08:52:06.071870294 +0000 -+--- HMI/n2t-out/Program.s.txt 2022-05-22 08:52:05.367816736 +0000 -++++ HMI/US/portrait/n2t-out/Program.s.txt 2022-05-22 08:52:05.927852627 +0000 -+--- HMI/n2t-out/cardEntities.txt 2022-05-22 08:52:05.367816736 +0000 -++++ HMI/US/portrait/n2t-out/cardEntities.txt 2022-05-22 08:52:05.927852627 +0000 ++++ HMI/US/portrait/diff-eu-version.txt 2022-05-22 08:56:33.504797610 +0000 ++--- HMI/n2t-out/Program.s.txt 2022-05-22 08:56:32.972794177 +0000 +++++ HMI/US/portrait/n2t-out/Program.s.txt 2022-05-22 08:56:33.488797507 +0000 ++--- HMI/n2t-out/cardEntities.txt 2022-05-22 08:56:32.976794203 +0000 +++++ HMI/US/portrait/n2t-out/cardEntities.txt 2022-05-22 08:56:33.492797532 +0000 + Hotspot mSwipeNext + Scope : local +@@ -1880,6 +2108,166 @@ @@ -26,3 +26,5 @@ ++ if(tTmp.txt=="disable") ++ }else if(tTmp.txt!="") ++ bDown5.txt=tTmp.txt ++--- HMI/n2t-out/pageStartup.txt 2022-05-22 08:56:32.972794177 +0000 +++++ HMI/US/portrait/n2t-out/pageStartup.txt 2022-05-22 08:56:33.488797507 +0000