diff --git a/HMI/README.md b/HMI/README.md index c63f7c98..5604c46c 100644 --- a/HMI/README.md +++ b/HMI/README.md @@ -117,7 +117,7 @@ The following message can be used to update the content on the cardEntities 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 diff --git a/HMI/code_gen/pages/cardEntitiesSerial.py b/HMI/code_gen/pages/cardEntitiesSerial.py index ad79b604..70162a50 100644 --- a/HMI/code_gen/pages/cardEntitiesSerial.py +++ b/HMI/code_gen/pages/cardEntitiesSerial.py @@ -4,10 +4,10 @@ head = sharedhead + """ { // command format: entityUpd,heading,navigation,[,type,internalName,iconId,displayName,optionalValue]x4 spstr strCommand.txt,tHeading.txt,",",1 -""" +""" + navigation print(head) start = 3 -for i in range(1,7): +for i in range(1,5): idxstart = start + (i-1)*6 item = f""" // get Type diff --git a/HMI/code_gen/pages/cardGridSerial.py b/HMI/code_gen/pages/cardGridSerial.py index 196e0c27..cfeed254 100644 --- a/HMI/code_gen/pages/cardGridSerial.py +++ b/HMI/code_gen/pages/cardGridSerial.py @@ -4,7 +4,7 @@ head = sharedhead + """ { // command format: entityUpd,heading,navigation,[,type,internalName,iconId,iconColor,displayName,optionalValue]x6 spstr strCommand.txt,tHeading.txt,",",1 -""" +""" + navigation print(head) start = 3 for i in range(1,7): diff --git a/HMI/code_gen/pages/cardThermo.py b/HMI/code_gen/pages/cardThermo.py new file mode 100644 index 00000000..60cd9d33 --- /dev/null +++ b/HMI/code_gen/pages/cardThermo.py @@ -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) + diff --git a/HMI/code_gen/pages/shared.py b/HMI/code_gen/pages/shared.py index f892130e..e02f9d5a 100644 --- a/HMI/code_gen/pages/shared.py +++ b/HMI/code_gen/pages/shared.py @@ -133,4 +133,34 @@ sharedfoot = """ bufferPos++ } } +""" + +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="" + } """ \ No newline at end of file diff --git a/HMI/nspanel.HMI b/HMI/nspanel.HMI index 9f63e641..90985665 100644 Binary files a/HMI/nspanel.HMI and b/HMI/nspanel.HMI differ diff --git a/HMI/nspanel.tft b/HMI/nspanel.tft index 35d85f33..ed89e4d4 100644 Binary files a/HMI/nspanel.tft and b/HMI/nspanel.tft differ diff --git a/apps/nspanel-lovelace-ui/luibackend/pages.py b/apps/nspanel-lovelace-ui/luibackend/pages.py index 5cec2e1b..4d0d6a79 100644 --- a/apps/nspanel-lovelace-ui/luibackend/pages.py +++ b/apps/nspanel-lovelace-ui/luibackend/pages.py @@ -234,7 +234,7 @@ class LuiPagesGen(object): icon_res = ","*4*padding_len + icon_res + ","*4*padding_len # use first 5 icons 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) def generate_media_page(self, item):