mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-20 14:37:01 +01:00
implemented navigation on cardEntities Grid and Thermo
This commit is contained in:
@@ -117,7 +117,7 @@ The following message can be used to update the content on the cardEntities Page
|
|||||||
|
|
||||||
### cardThermo Page
|
### cardThermo Page
|
||||||
|
|
||||||
`entityUpd,*internalNameEntiy*,*heading*,*currentTemp*,*destTemp*,*status*,*minTemp*,*maxTemp*,*stepTemp*[[,*iconId*,*activeColor*,*state*,*hvac_action*]]`
|
`entityUpd,*heading*,*navigation*,*internalNameEntiy*,*currentTemp*,*destTemp*,*status*,*minTemp*,*maxTemp*,*stepTemp*[[,*iconId*,*activeColor*,*state*,*hvac_action*]]`
|
||||||
|
|
||||||
`[[]]` are not part of the command, this part repeats 9 times for the buttons
|
`[[]]` are not part of the command, this part repeats 9 times for the buttons
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ head = sharedhead + """
|
|||||||
{
|
{
|
||||||
// command format: entityUpd,heading,navigation,[,type,internalName,iconId,displayName,optionalValue]x4
|
// command format: entityUpd,heading,navigation,[,type,internalName,iconId,displayName,optionalValue]x4
|
||||||
spstr strCommand.txt,tHeading.txt,",",1
|
spstr strCommand.txt,tHeading.txt,",",1
|
||||||
"""
|
""" + navigation
|
||||||
print(head)
|
print(head)
|
||||||
start = 3
|
start = 3
|
||||||
for i in range(1,7):
|
for i in range(1,5):
|
||||||
idxstart = start + (i-1)*6
|
idxstart = start + (i-1)*6
|
||||||
item = f"""
|
item = f"""
|
||||||
// get Type
|
// get Type
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ head = sharedhead + """
|
|||||||
{
|
{
|
||||||
// command format: entityUpd,heading,navigation,[,type,internalName,iconId,iconColor,displayName,optionalValue]x6
|
// command format: entityUpd,heading,navigation,[,type,internalName,iconId,iconColor,displayName,optionalValue]x6
|
||||||
spstr strCommand.txt,tHeading.txt,",",1
|
spstr strCommand.txt,tHeading.txt,",",1
|
||||||
"""
|
""" + navigation
|
||||||
print(head)
|
print(head)
|
||||||
start = 3
|
start = 3
|
||||||
for i in range(1,7):
|
for i in range(1,7):
|
||||||
|
|||||||
67
HMI/code_gen/pages/cardThermo.py
Normal file
67
HMI/code_gen/pages/cardThermo.py
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
from shared import *
|
||||||
|
text = sharedhead + """
|
||||||
|
if(tInstruction.txt=="entityUpd")
|
||||||
|
{
|
||||||
|
//heading
|
||||||
|
spstr strCommand.txt,tHeading.txt,",",1
|
||||||
|
""" + navigation
|
||||||
|
|
||||||
|
text += """
|
||||||
|
//entity name
|
||||||
|
spstr strCommand.txt,entn.txt,",",3
|
||||||
|
//currentTemp
|
||||||
|
spstr strCommand.txt,tTmp.txt,",",4
|
||||||
|
covx tTmp.txt,xTempCurr.val,0,0
|
||||||
|
//dstTemp
|
||||||
|
spstr strCommand.txt,tTmp.txt,",",4
|
||||||
|
covx tTmp.txt,xTempDest.val,0,0
|
||||||
|
//status
|
||||||
|
spstr strCommand.txt,tStatus.txt,",",6
|
||||||
|
//minTemp
|
||||||
|
spstr strCommand.txt,tTmp.txt,",",7
|
||||||
|
covx tTmp.txt,xTempMin.val,0,0
|
||||||
|
//maxTemp
|
||||||
|
spstr strCommand.txt,tTmp.txt,",",8
|
||||||
|
covx tTmp.txt,xTempMax.val,0,0
|
||||||
|
//tempStep
|
||||||
|
spstr strCommand.txt,tTmp.txt,",",9
|
||||||
|
covx tTmp.txt,xTempStep.val,0,0
|
||||||
|
// disable all buttons
|
||||||
|
vis bt0,0
|
||||||
|
vis bt1,0
|
||||||
|
vis bt2,0
|
||||||
|
vis bt3,0
|
||||||
|
vis bt4,0
|
||||||
|
vis bt5,0
|
||||||
|
vis bt6,0
|
||||||
|
vis bt7,0
|
||||||
|
vis bt8,0
|
||||||
|
"""
|
||||||
|
|
||||||
|
start = 10
|
||||||
|
for i in range(0,9):
|
||||||
|
idxstart = start + i*4
|
||||||
|
text += f""" //bt{i}
|
||||||
|
spstr strCommand.txt,tTmp.txt,",",{idxstart}
|
||||||
|
if(tTmp.txt!="")
|
||||||
|
{{
|
||||||
|
// set icon
|
||||||
|
covx tTmp.txt,sys0,0,0
|
||||||
|
substr pageIcons.tIcons.txt,bt{i}.txt,sys0,1
|
||||||
|
// set text color on active state
|
||||||
|
spstr strCommand.txt,tTmp.txt,",",{idxstart+1}
|
||||||
|
covx tTmp.txt,bt{i}.pco2,0,0
|
||||||
|
// set state
|
||||||
|
spstr strCommand.txt,tTmp.txt,",",{idxstart+2}
|
||||||
|
covx tTmp.txt,bt{i}.val,0,0
|
||||||
|
// save action
|
||||||
|
spstr strCommand.txt,va{i}.txt,",",{idxstart+3}
|
||||||
|
//enable
|
||||||
|
vis bt{i},1
|
||||||
|
}}"""
|
||||||
|
|
||||||
|
text += """
|
||||||
|
}
|
||||||
|
""" + sharedfoot
|
||||||
|
print(text)
|
||||||
|
|
||||||
@@ -134,3 +134,33 @@ sharedfoot = """
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
navigation = """
|
||||||
|
// navigation icons
|
||||||
|
spstr strCommand.txt,tId.txt,",",2
|
||||||
|
spstr tId.txt,tTmp.txt,"|",0
|
||||||
|
if(tTmp.txt=="0")
|
||||||
|
{
|
||||||
|
vis bPrev,0
|
||||||
|
}
|
||||||
|
if(tTmp.txt=="1")
|
||||||
|
{
|
||||||
|
vis bPrev,1
|
||||||
|
bPrev.txt=""
|
||||||
|
}
|
||||||
|
if(tTmp.txt=="2")
|
||||||
|
{
|
||||||
|
vis bPrev,1
|
||||||
|
bPrev.txt=""
|
||||||
|
}
|
||||||
|
spstr tId.txt,tTmp.txt,"|",1
|
||||||
|
if(tTmp.txt=="0")
|
||||||
|
{
|
||||||
|
vis bNext,0
|
||||||
|
}
|
||||||
|
if(tTmp.txt=="1")
|
||||||
|
{
|
||||||
|
vis bPrev,1
|
||||||
|
bNext.txt=""
|
||||||
|
}
|
||||||
|
"""
|
||||||
BIN
HMI/nspanel.HMI
BIN
HMI/nspanel.HMI
Binary file not shown.
BIN
HMI/nspanel.tft
BIN
HMI/nspanel.tft
Binary file not shown.
@@ -234,7 +234,7 @@ class LuiPagesGen(object):
|
|||||||
icon_res = ","*4*padding_len + icon_res + ","*4*padding_len
|
icon_res = ","*4*padding_len + icon_res + ","*4*padding_len
|
||||||
# use first 5 icons
|
# use first 5 icons
|
||||||
icon_res = icon_res + ","*4*4
|
icon_res = icon_res + ","*4*4
|
||||||
command = f"entityUpd,{item},{heading},{current_temp},{dest_temp},{status},{min_temp},{max_temp},{step_temp}{icon_res}"
|
command = f"entityUpd,{heading},,{item},{current_temp},{dest_temp},{status},{min_temp},{max_temp},{step_temp}{icon_res}"
|
||||||
self._send_mqtt_msg(command)
|
self._send_mqtt_msg(command)
|
||||||
|
|
||||||
def generate_media_page(self, item):
|
def generate_media_page(self, item):
|
||||||
|
|||||||
Reference in New Issue
Block a user