mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-21 15:04:24 +01:00
icons for shutters are now configurable
This commit is contained in:
@@ -89,7 +89,7 @@ The following message can be used to update the content on the cardEntities Page
|
|||||||
|
|
||||||
`~light~light.entityName~1~17299~Light1~0`
|
`~light~light.entityName~1~17299~Light1~0`
|
||||||
|
|
||||||
`~shutter~cover.entityName~0~17299~Shutter2~`
|
`~shutter~cover.entityName~0~17299~Shutter2~iconUp|iconStop|iconDown`
|
||||||
|
|
||||||
`~delete~~~~~`
|
`~delete~~~~~`
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ The following message can be used to update the content on the cardEntities Page
|
|||||||
|
|
||||||
### popupShutter Page
|
### popupShutter Page
|
||||||
|
|
||||||
`entityUpdateDetail~*ignored*~*sliderPos*~2ndrow~textPosition`
|
`entityUpdateDetail~*ignored*~*sliderPos*~2ndrow~textPosition~icon1~iconUp~iconStop~iconDown`
|
||||||
|
|
||||||
`entityUpdateDetail~1~77`
|
`entityUpdateDetail~1~77`
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -7,7 +7,7 @@ head = sharedhead + """
|
|||||||
""" + navigation
|
""" + navigation
|
||||||
print(head)
|
print(head)
|
||||||
start = 3
|
start = 3
|
||||||
for i in range(1,5):
|
for i in range(1,6):
|
||||||
idxstart = start + (i-1)*6
|
idxstart = start + (i-1)*6
|
||||||
item = f"""
|
item = f"""
|
||||||
// get Type
|
// get Type
|
||||||
@@ -50,28 +50,44 @@ for i in range(1,5):
|
|||||||
vis nNum{i},0
|
vis nNum{i},0
|
||||||
// get Button State (optional Value)
|
// 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,"|",0
|
||||||
if(tTmp.txt=="0")
|
if(tTmp.txt!="")
|
||||||
{{
|
|
||||||
bUp{i}.pco=27501
|
|
||||||
tsw bUp{i},0
|
|
||||||
}}
|
|
||||||
else
|
|
||||||
{{
|
{{
|
||||||
bUp{i}.pco=65535
|
bUp{i}.pco=65535
|
||||||
tsw bUp{i},1
|
tsw bUp{i},1
|
||||||
}}
|
}}
|
||||||
|
else if(tTmp.txt!="disable")
|
||||||
|
{{
|
||||||
|
bUp{i}.pco=27501
|
||||||
|
tsw bUp{i},0
|
||||||
|
}}
|
||||||
|
// stop button
|
||||||
spstr tId.txt,tTmp.txt,"|",1
|
spstr tId.txt,tTmp.txt,"|",1
|
||||||
if(tTmp.txt=="0")
|
if(tTmp.txt!="")
|
||||||
|
{{
|
||||||
|
bStop{i}.pco=65535
|
||||||
|
bStop{i}.txt=tTmp.txt
|
||||||
|
tsw bStop{i},1
|
||||||
|
}}
|
||||||
|
else if(tTmp.txt!="disable")
|
||||||
|
{{
|
||||||
|
bStop{i}.pco=27501
|
||||||
|
tsw bStop{i},0
|
||||||
|
}}
|
||||||
|
// down button
|
||||||
|
spstr tId.txt,tTmp.txt,"|",2
|
||||||
|
if(tTmp.txt!="")
|
||||||
|
{{
|
||||||
|
bDown{i}.pco=65535
|
||||||
|
bDown{i}.txt=tTmp.txt
|
||||||
|
tsw bDown{i},1
|
||||||
|
}}
|
||||||
|
else if(tTmp.txt!="disable")
|
||||||
{{
|
{{
|
||||||
bDown{i}.pco=27501
|
bDown{i}.pco=27501
|
||||||
tsw bDown{i},0
|
tsw bDown{i},0
|
||||||
}}
|
}}
|
||||||
else
|
|
||||||
{{
|
|
||||||
bDown{i}.pco=65535
|
|
||||||
tsw bDown{i},1
|
|
||||||
}}
|
|
||||||
}}
|
}}
|
||||||
if(type{i}.txt=="light")
|
if(type{i}.txt=="light")
|
||||||
{{
|
{{
|
||||||
|
|||||||
1014
HMI/code_gen/pages/out.txt
Normal file
1014
HMI/code_gen/pages/out.txt
Normal file
File diff suppressed because it is too large
Load Diff
BIN
HMI/nspanel.HMI
BIN
HMI/nspanel.HMI
Binary file not shown.
BIN
HMI/nspanel.tft
BIN
HMI/nspanel.tft
Binary file not shown.
@@ -144,13 +144,16 @@ class LuiPagesGen(object):
|
|||||||
name = name if name is not None else entity.attributes.friendly_name
|
name = name if name is not None else entity.attributes.friendly_name
|
||||||
if entityType == "cover":
|
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, 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))
|
pos = int(entity.attributes.get("current_position", 50))
|
||||||
if pos == 100:
|
if pos == 100:
|
||||||
status = "0|1"
|
status = f"disable|{icon_stop}|{icon_down}"
|
||||||
elif pos == 0:
|
elif pos == 0:
|
||||||
status = "1|0"
|
status = f"{icon_up}|{icon_stop}|disable"
|
||||||
else:
|
else:
|
||||||
status = "1|1"
|
status = f"{icon_up}|{icon_stop}|{icon_down}"
|
||||||
return f"~shutter~{entityId}~{icon_id}~17299~{name}~{status}"
|
return f"~shutter~{entityId}~{icon_id}~17299~{name}~{status}"
|
||||||
if entityType in "light":
|
if entityType in "light":
|
||||||
switch_val = 1 if entity.state == "on" else 0
|
switch_val = 1 if entity.state == "on" else 0
|
||||||
@@ -420,11 +423,25 @@ class LuiPagesGen(object):
|
|||||||
|
|
||||||
def generate_shutter_detail_page(self, entity):
|
def generate_shutter_detail_page(self, entity):
|
||||||
entity = self._ha_api.get_entity(entity)
|
entity = self._ha_api.get_entity(entity)
|
||||||
|
icon = entity.iconOverride
|
||||||
|
icon_id = get_icon_id_ha("cover", state=entity.state, overwrite=icon)
|
||||||
|
|
||||||
pos = entity.attributes.get("current_position")
|
pos = entity.attributes.get("current_position")
|
||||||
if pos is None:
|
if pos is None:
|
||||||
pos = entity.state
|
pos_status = entity.state
|
||||||
|
pos = "disable"
|
||||||
|
|
||||||
|
icon_up = get_icon_id("arrow-up")
|
||||||
|
icon_stop = get_icon_id("stop")
|
||||||
|
icon_down = get_icon_id("arrow-down")
|
||||||
|
|
||||||
|
if pos == 100:
|
||||||
|
icon_up = "disable"
|
||||||
|
elif pos == 0:
|
||||||
|
icon_down = "disable"
|
||||||
|
|
||||||
pos_translation = get_translation(self._locale, "position")
|
pos_translation = get_translation(self._locale, "position")
|
||||||
self._send_mqtt_msg(f"entityUpdateDetail~{pos}~{pos_translation}: {pos}~{pos_translation}")
|
self._send_mqtt_msg(f"entityUpdateDetail~{pos}~{pos_translation}: {pos_status}~{pos_translation}~{icon_id}~{icon_up}~{icon_stop}~{icon_down}")
|
||||||
|
|
||||||
def send_message_page(self, id, heading, msg, b1, b2):
|
def send_message_page(self, id, heading, msg, b1, b2):
|
||||||
self._send_mqtt_msg(f"pageType~popupNotify")
|
self._send_mqtt_msg(f"pageType~popupNotify")
|
||||||
|
|||||||
Reference in New Issue
Block a user