mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-24 00:14:26 +01:00
Cover Icons based on device_class / disable on detail page
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,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 08:52:05.367816736 +0000
|
||||
+++ HMI/US/portrait/n2t-out/pageStartup.txt 2022-05-22 08:52:05.927852627 +0000
|
||||
--- 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
|
||||
|
||||
@@ -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,5 +26,5 @@
|
||||
++ if(tTmp.txt=="disable")
|
||||
++ }else if(tTmp.txt!="")
|
||||
++ bDown5.txt=tTmp.txt
|
||||
+--- HMI/n2t-out/pageStartup.txt 2022-05-22 08:52:05.367816736 +0000
|
||||
++++ HMI/US/portrait/n2t-out/pageStartup.txt 2022-05-22 08:52:05.927852627 +0000
|
||||
+--- 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
|
||||
|
||||
@@ -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,7 +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":
|
||||
return "window-open" if state == "open" else "window-closed"
|
||||
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:
|
||||
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"
|
||||
|
||||
|
||||
@@ -143,10 +143,13 @@ 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)
|
||||
|
||||
device_class = entity.attributes.get("device_class", "")
|
||||
icon_id = get_icon_id_ha("cover", state=entity.state, device_class=device_class, overwrite=icon)
|
||||
icon_up = get_icon_id("arrow-up")
|
||||
icon_stop = get_icon_id("stop")
|
||||
icon_down = get_icon_id("arrow-down")
|
||||
|
||||
pos = int(entity.attributes.get("current_position", 50))
|
||||
if pos == 100:
|
||||
status = f"disable|{icon_stop}|{icon_down}"
|
||||
|
||||
Reference in New Issue
Block a user