diff --git a/HMI/README.md b/HMI/README.md index 90ecccfc..5b57dd70 100644 --- a/HMI/README.md +++ b/HMI/README.md @@ -111,7 +111,7 @@ The following message can be used to update the content on the cardEntities Page ### popupShutter Page -`entityUpdateDetail~*ignored*~*sliderPos*~2ndrow~textPosition~icon1~iconUp~iconStop~iconDown` +`entityUpdateDetail~*ignored*~*sliderPos*~2ndrow~textPosition~icon1~iconUp~iconStop~iconDown~iconUpStatus~iconStopStatus~iconDownStatus `entityUpdateDetail~1~77` diff --git a/HMI/US/landscape/nspanel_US_L.HMI b/HMI/US/landscape/nspanel_US_L.HMI index a33bc8a0..06ba9a3c 100644 Binary files a/HMI/US/landscape/nspanel_US_L.HMI and b/HMI/US/landscape/nspanel_US_L.HMI differ diff --git a/HMI/US/landscape/nspanel_US_L.tft b/HMI/US/landscape/nspanel_US_L.tft index 043e26e0..77333037 100644 Binary files a/HMI/US/landscape/nspanel_US_L.tft and b/HMI/US/landscape/nspanel_US_L.tft differ diff --git a/HMI/US/portrait/nspanel_US_P.HMI b/HMI/US/portrait/nspanel_US_P.HMI index 90bfa81b..810a07a1 100644 Binary files a/HMI/US/portrait/nspanel_US_P.HMI and b/HMI/US/portrait/nspanel_US_P.HMI differ diff --git a/HMI/US/portrait/nspanel_US_P.tft b/HMI/US/portrait/nspanel_US_P.tft index e5dd5368..b16210db 100644 Binary files a/HMI/US/portrait/nspanel_US_P.tft and b/HMI/US/portrait/nspanel_US_P.tft differ diff --git a/HMI/code_gen/pages/cardEntitiesSerial.py b/HMI/code_gen/pages/cardEntitiesSerial.py index 8fcd077f..fb94fe66 100644 --- a/HMI/code_gen/pages/cardEntitiesSerial.py +++ b/HMI/code_gen/pages/cardEntitiesSerial.py @@ -49,47 +49,50 @@ for i in range(1,6): vis hSlider{i},0 vis nNum{i},0 // get Button State (optional Value) - spstr strCommand.txt,tId.txt,"~",{idxstart+5} + spstr strCommand.txt,tId.txt,"~",{idxstart+5} // up button - spstr tId.txt,tTmp.txt,"|",0 + spstr tId.txt,tTmp.txt,"|",3 if(tTmp.txt=="disable") {{ bUp{i}.pco=27501 + spstr tId.txt,bUp{i}.txt,"|",0 tsw bUp{i},0 }} - else if(tTmp.txt!="") + else if(tTmp.txt=="enable") {{ bUp{i}.pco=65535 - bUp{i}.txt=tTmp.txt + spstr tId.txt,bUp{i}.txt,"|",0 tsw bUp{i},1 }} // stop button - spstr tId.txt,tTmp.txt,"|",1 + spstr tId.txt,tTmp.txt,"|",4 if(tTmp.txt=="disable") {{ bStop{i}.pco=27501 + spstr tId.txt,bStop{i}.txt,"|",1 tsw bStop{i},0 }} - else if(tTmp.txt!="") + else if(tTmp.txt=="enable") {{ bStop{i}.pco=65535 - bStop{i}.txt=tTmp.txt + spstr tId.txt,bStop{i}.txt,"|",1 tsw bStop{i},1 }} // down button - spstr tId.txt,tTmp.txt,"|",2 + spstr tId.txt,tTmp.txt,"|",5 if(tTmp.txt=="disable") {{ bDown{i}.pco=27501 + spstr tId.txt,bDown{i}.txt,"|",2 tsw bDown{i},0 }} - else if(tTmp.txt!="") + else if(tTmp.txt=="enable") {{ bDown{i}.pco=65535 - bDown{i}.txt=tTmp.txt + spstr tId.txt,bDown{i}.txt,"|",2 tsw bDown{i},1 }} }} diff --git a/HMI/nspanel.HMI b/HMI/nspanel.HMI index e1c3a28d..0eb8b1e6 100644 Binary files a/HMI/nspanel.HMI and b/HMI/nspanel.HMI differ diff --git a/HMI/nspanel.tft b/HMI/nspanel.tft index c18f3814..60cb3509 100644 Binary files a/HMI/nspanel.tft and b/HMI/nspanel.tft differ diff --git a/apps/nspanel-lovelace-ui/luibackend/icons.py b/apps/nspanel-lovelace-ui/luibackend/icons.py index bb93cd9c..e2979858 100644 --- a/apps/nspanel-lovelace-ui/luibackend/icons.py +++ b/apps/nspanel-lovelace-ui/luibackend/icons.py @@ -60,18 +60,69 @@ sensor_mapping = { "voltage": "flash" } -cover_mapping = { - #"device_class": ("icon-open", "icon-closed", "icon-cover-open", "icon-cover-stop", "icon-cover-close") - "awning": ("window-open", "window-closed", "arrow-up", "stop", "arrow-down"), - "blind": ("blinds-open", "blinds", "arrow-up", "stop", "arrow-down"), - "curtain": ("curtains-closed", "curtains", "arrow-expand-horizontal", "stop", "arrow-collapse-horizontal"), - "damper": ("checkbox-blank-circle", "circle-slice-8", "arrow-up", "stop", "arrow-down"), - "door": ("door-open", "door-closed", "arrow-expand-horizontal", "stop", "arrow-collapse-horizontal"), - "garage": ("garage-open", "garage", "arrow-up", "stop", "arrow-down"), - "gate": ("gate-open", "gate", "arrow-expand-horizontal", "stop", "arrow-collapse-horizontal"), - "shade": ("blinds-open", "blinds", "arrow-up", "stop", "arrow-down"), - "shutter": ("window-shutter-open", "window-shutter", "arrow-up", "stop", "arrow-down"), - "window": ("window-open" "window-closed", "arrow-up", "stop", "arrow-down"), +cover_mapping_open = { + "awning": "window-open", + "blind": "blinds-open", + "curtain": "curtains-closed", + "damper": "checkbox-blank-circle", + "door": "door-open", + "garage": "garage-open", + "gate": "gate-open", + "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", + "gate": "gate", + "shade": "blinds", + "shutter": "window-shutter", + "window": "window-closed" +} + +cover_mapping_action_open = { + "awning": "arrow-up", + "blind": "arrow-up", + "curtain": "arrow-expand-horizontal", + "damper": "arrow-up", + "door": "arrow-expand-horizontal", + "garage": "arrow-up", + "gate": "arrow-expand-horizontal", + "shade": "arrow-up", + "shutter": "arrow-up", + "window": "arrow-up" +} + +cover_mapping_action_close = { + "awning": "arrow-down", + "blind": "arrow-down", + "curtain": "arrow-collapse-horizontal", + "damper": "arrow-down", + "door": "arrow-collapse-horizontal", + "garage": "arrow-down", + "gate": "arrow-collapse-horizontal", + "shade": "arrow-down", + "shutter": "arrow-down", + "window": "arrow-down" +} + +cover_mapping_action_stop = { + "awning": "stop", + "blind": "stop", + "curtain": "stop", + "damper": "stop", + "door": "stop", + "garage": "stop", + "gate": "stop", + "shade": "stop", + "shutter": "stop", + "window": "stop" } def map_to_mdi_name(ha_type, state=None, device_class=None, cardType=None): @@ -94,12 +145,10 @@ def map_to_mdi_name(ha_type, state=None, device_class=None, cardType=None): if ha_type == "input_boolean": return "check-circle-outline" if state == "on" else "close-circle-outline" if ha_type == "cover": - if device_class is None: - device_class = "window" if state == "closed": - return cover_mapping[device_class][1] if device_class in cover_mapping else "alert-circle-outline" + return cover_mapping_closed[device_class] if device_class in cover_mapping_closed else "alert-circle-outline" else: - return cover_mapping[device_class][0] if device_class in cover_mapping else "alert-circle-outline" + 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" @@ -122,17 +171,14 @@ def get_action_id_ha(ha_type, action, device_class=None, overwrite=None): if overwrite is not None: return get_icon_id(overwrite) if ha_type == "cover": - if device_class is None: - device_class = "window" if action == "open": - actionicon = cover_mapping[device_class][2] if device_class in cover_mapping else "alert-circle-outline" + actionicon = cover_mapping_action_open[device_class] if device_class in cover_mapping_action_open else "alert-circle-outline" elif action == "close": - actionicon = cover_mapping[device_class][4] if device_class in cover_mapping else "alert-circle-outline" + actionicon = cover_mapping_action_close[device_class] if device_class in cover_mapping_action_close else "alert-circle-outline" elif action == "stop": - actionicon = cover_mapping[device_class][3] if device_class in cover_mapping else "alert-circle-outline" + actionicon = cover_mapping_action_stop[device_class] if device_class in cover_mapping_action_stop else "alert-circle-outline" else: actionicon = "alert-circle-outline" else: actionicon = "alert-circle-outline" return get_icon_id(actionicon) - diff --git a/apps/nspanel-lovelace-ui/luibackend/pages.py b/apps/nspanel-lovelace-ui/luibackend/pages.py index c01ffe45..35fa536d 100644 --- a/apps/nspanel-lovelace-ui/luibackend/pages.py +++ b/apps/nspanel-lovelace-ui/luibackend/pages.py @@ -145,7 +145,7 @@ class LuiPagesGen(object): name = name if name is not None else entity.attributes.friendly_name if entityType == "cover": - device_class = entity.attributes.get("device_class", "") + device_class = entity.attributes.get("device_class", "window") icon_id = get_icon_id_ha("cover", state=entity.state, device_class=device_class, overwrite=icon) icon_up = get_action_id_ha(ha_type="cover", action="open", device_class=device_class) icon_stop = get_action_id_ha(ha_type="cover", action="stop", device_class=device_class) @@ -153,12 +153,12 @@ class LuiPagesGen(object): pos = int(entity.attributes.get("current_position", 50)) if pos == 100: - status = f"disable|{icon_stop}|{icon_down}" + status = f"disable|enable|enable" elif pos == 0: - status = f"{icon_up}|{icon_stop}|disable" + status = f"enable|enable|disable" else: - status = f"{icon_up}|{icon_stop}|{icon_down}" - return f"~shutter~{entityId}~{icon_id}~17299~{name}~{status}" + status = f"enable|enable|enable" + return f"~shutter~{entityId}~{icon_id}~17299~{name}~{icon_up}|{icon_stop}|{icon_down}|{status}" if entityType in "light": switch_val = 1 if entity.state == "on" else 0 icon_color = self.get_entity_color(entity) @@ -444,19 +444,22 @@ class LuiPagesGen(object): icon_up = get_action_id_ha(ha_type="cover", action="open", device_class=device_class) icon_stop = get_action_id_ha(ha_type="cover", action="stop", device_class=device_class) icon_down = get_action_id_ha(ha_type="cover", action="close", device_class=device_class) - + icon_up_status = "enable" + icon_stop_status = "enable" + icon_down_status = "enable" + if pos == 100: - icon_up = "disable" + icon_up_status = "disable" elif pos == 0: - icon_down = "disable" + icon_down_status = "disable" elif pos == "disable": if pos_status == "open": - icon_up = "disable" + icon_up_status = "disable" elif pos_status == "closed": - icon_down = "disable" + icon_down_status = "disable" pos_translation = get_translation(self._locale, "position") - self._send_mqtt_msg(f"entityUpdateDetail~{pos}~{pos_translation}: {pos_status}~{pos_translation}~{icon_id}~{icon_up}~{icon_stop}~{icon_down}") + self._send_mqtt_msg(f"entityUpdateDetail~{pos}~{pos_translation}: {pos_status}~{pos_translation}~{icon_id}~{icon_up}~{icon_stop}~{icon_down}~{icon_up_status}~{icon_stop_status}~{icon_down_status}") def send_message_page(self, id, heading, msg, b1, b2): self._send_mqtt_msg(f"pageType~popupNotify")