Compare commits

...

26 Commits

Author SHA1 Message Date
joBr99
ff96812d26 Merge branch 'main' of github.com:joBr99/nspanel-lovelace-ui (add nextion2text) 2024-01-19 15:23:21 +00:00
joBr99
0359a4b3dc Merge branch 'main' of github.com:joBr99/nspanel-lovelace-ui 2024-01-19 16:20:41 +01:00
joBr99
f75dd3a800 fixes #1146; implements #1144 2024-01-19 16:20:28 +01:00
Armilar
a992dc56c5 Merge pull request #1140 from ticaki/main
siehe Beschreibung
2024-01-19 12:52:22 +01:00
Armilar
576176e1cc Change in cardLChart
Change: yAxisTicks parameter is not required in cardLChart PageItem
2024-01-19 12:44:46 +01:00
Armilar
1d3914ce86 let out_msgs: NSPanel.Payload[] = []; 2024-01-19 12:37:30 +01:00
Armilar
b2f338cad8 Change cardLChart - no yAxisTicks required 2024-01-19 12:33:35 +01:00
Armilar
74a329ca29 Merge pull request #1142 from theknut/patch-1
feat: calculate yAxisTicks based on given values
2024-01-19 12:25:55 +01:00
theknut
29ae1b4034 fix: wrong yAxisTicks logged in debug log 2024-01-19 10:34:50 +01:00
theknut
ae5cab9830 refactor: ensure yAxisTicks are calculated every time if not provided 2024-01-19 10:27:01 +01:00
theknut
a986e588b5 feat: calculate yAxisTicks based on given values
If no yAxisTicks are provided for the signal, try to calculate it based on the given values.
2024-01-19 00:27:10 +01:00
ticaki
8c84c1050f fix pm/am 2024-01-19 00:03:15 +01:00
ticaki
c3ded4d817 buildNSPanelString 2024-01-18 22:15:04 +01:00
ticaki
db32de68e3 add ScreensaverEntityValue to on() 2024-01-17 23:14:54 +01:00
ticaki
f76f2ca393 tweak HandleScreensaverStatusIcons 2024-01-17 17:25:51 +01:00
ticaki
8449257628 fix number/string 2024-01-16 21:39:43 +01:00
ticaki
2bd3d0d290 reduce HandleScreensaverStatusIcons 2024-01-16 20:51:24 +01:00
ticaki
117798a3f5 icon fix 2024-01-16 17:34:09 +01:00
ticaki
01392bcbf8 fix unsubscribePowerSubscriptions 2024-01-16 16:32:38 +01:00
ticaki
5a3478d916 ups :D 2024-01-16 16:06:47 +01:00
ticaki
f3b545fd90 remove commented out code 2024-01-16 16:04:22 +01:00
ticaki
e7a6a05a1b Update Version and Changelog 2024-01-16 15:59:28 +01:00
ticaki
f65ff57a95 HandleScreensaverStatusIcons rewritten
fixed #1098
types: Number of PageItems defined
2024-01-16 15:55:51 +01:00
ticaki
9a8f53e890 Merge branch 'joBr99:main' into main 2024-01-16 13:13:33 +01:00
ticaki
b7fd06413d remove all <type> 2024-01-12 20:42:54 +01:00
ticaki
a2b805f4e1 SendTime - optimated 2024-01-12 20:38:47 +01:00
16 changed files with 1682 additions and 748 deletions

View File

@@ -1,17 +1,5 @@
--- HMI/n2t-out
+++ HMI/US/landscape/n2t-out
├── file list
│ @@ -1,10 +1,9 @@
│ Program.s.txt
│ cardAlarm.txt
│ -cardBurnRec.txt
│ cardChart.txt
│ cardEntities.txt
│ cardGrid.txt
│ cardGrid2.txt
│ cardLChart.txt
│ cardMedia.txt
│ cardPower.txt
│ --- HMI/n2t-out/Program.s.txt
├── +++ HMI/US/landscape/n2t-out/Program.s.txt
│ @@ -13,10 +13,10 @@
@@ -114,6 +102,27 @@
│ crcputs sys0,2
│ crcputs tSend.txt,0
│ //send cmd
│ --- HMI/n2t-out/popupNotify.txt
├── +++ HMI/US/landscape/n2t-out/popupNotify.txt
│ @@ -439,18 +439,14 @@
│ {
│ page cardPower
│ }
│ if(tId.txt=="cardChart")
│ {
│ page cardChart
│ }
│ - if(tId.txt=="cardLChart")
│ - {
│ - page cardLChart
│ - }
│ }
│ // end of user code
│ udelete payloadLength-1
│ bufferPos=0
│ }
│ }
│ }
│ --- HMI/n2t-out/screensaver.txt
├── +++ HMI/US/landscape/n2t-out/screensaver.txt
│ @@ -19,15 +19,14 @@
@@ -221,7 +230,7 @@
│ vis p0,0
│ vis tNotifyHead,0
│ vis tNotifyText,0
│ @@ -41,17 +40,14 @@
│ @@ -41,52 +40,19 @@
│ }
│ tDate.txt=pageIcons.vaDate.txt
│ dim=dimValue
@@ -232,14 +241,81 @@
│ - Postinitialize Event
│ - click m0,1
│ -
│ -Variable (string) entn1
│ - Attributes
│ - Scope : local
│ - Text :
│ - Max. Text Size: 14
│ -
│ -Variable (string) entn2
│ - Attributes
│ - Scope : local
│ - Text :
│ - Max. Text Size: 14
│ -
│ -Variable (string) entn3
│ - Attributes
│ - Scope : local
│ - Text :
│ - Max. Text Size: 14
│ -
│ -Variable (string) entn4
│ - Attributes
│ - Scope : local
│ - Text :
│ - Max. Text Size: 14
│ -
│ -Variable (string) entn5
│ - Attributes
│ - Scope : local
│ - Text :
│ - Max. Text Size: 14
│ -
│ Variable (string) strCommand
│ Attributes
│ Scope : local
│ Text :
Max. Text Size: 1979
- Max. Text Size: 1955
│ + Max. Text Size: 1979
│ Variable (string) strTmp
@@ -376,34 +372,14 @@
Attributes
│ Scope : local
│ Text :
│ Max. Text Size: 2
│ @@ -96,27 +62,27 @@
│ Text :
│ Max. Text Size: 25
│ Variable (string) tInstruction
│ Attributes
│ Scope : local
│ Text :
│ - Max. Text Size: 15
│ + Max. Text Size: 50
│ Variable (string) tSend
│ Attributes
│ Scope : local
│ Text :
│ - Max. Text Size: 30
│ + Max. Text Size: 50
│ Variable (string) tTmp
│ Attributes
│ Scope : local
│ Text :
│ - Max. Text Size: 30
│ + Max. Text Size: 50
│ Variable (int32) vaTap
│ Attributes
│ Scope: local
│ Value: 0
│ Variable (int32) xc1
│ @@ -370,159 +336,50 @@
│ Scope : local
│ Dragging : 0
│ Send Component ID : disabled
@@ -247,6 +323,131 @@
│ Text :
│ Max. Text Size : 4
│ - Events
│ - Touch Press Event
│ - tSend.txt="event,buttonPress2,"+entn1.txt+",button"
│ - //send calc crc
│ - btlen tSend.txt,sys0
│ - crcrest 1,0xffff // reset CRC
│ - crcputh 55 bb
│ - crcputs sys0,2
│ - crcputs tSend.txt,0
│ - //send cmd
│ - printh 55 bb
│ - prints sys0,2
│ - prints tSend.txt,0
│ - prints crcval,2
│ -
│ Text f2Icon
│ Attributes
│ Scope : local
│ Dragging : 0
│ Send Component ID : disabled
│ Associated Keyboard: none
│ Text :
│ Max. Text Size : 4
│ - Events
│ - Touch Press Event
│ - tSend.txt="event,buttonPress2,"+entn2.txt+",button"
│ - //send calc crc
│ - btlen tSend.txt,sys0
│ - crcrest 1,0xffff // reset CRC
│ - crcputh 55 bb
│ - crcputs sys0,2
│ - crcputs tSend.txt,0
│ - //send cmd
│ - printh 55 bb
│ - prints sys0,2
│ - prints tSend.txt,0
│ - prints crcval,2
│ -
│ - Touch Release Event
│ - tSend.txt="event,buttonPress2,"+entn1.txt+",button"
│ - //send calc crc
│ - btlen tSend.txt,sys0
│ - crcrest 1,0xffff // reset CRC
│ - crcputh 55 bb
│ - crcputs sys0,2
│ - crcputs tSend.txt,0
│ - //send cmd
│ - printh 55 bb
│ - prints sys0,2
│ - prints tSend.txt,0
│ - prints crcval,2
│ -
│ Text f3Icon
│ Attributes
│ Scope : local
│ Dragging : 0
│ Send Component ID : disabled
│ Associated Keyboard: none
│ Text :
│ Max. Text Size : 4
│ - Events
│ - Touch Press Event
│ - tSend.txt="event,buttonPress2,"+entn3.txt+",button"
│ - //send calc crc
│ - btlen tSend.txt,sys0
│ - crcrest 1,0xffff // reset CRC
│ - crcputh 55 bb
│ - crcputs sys0,2
│ - crcputs tSend.txt,0
│ - //send cmd
│ - printh 55 bb
│ - prints sys0,2
│ - prints tSend.txt,0
│ - prints crcval,2
│ -
│ Text f4Icon
│ Attributes
│ Scope : local
│ Dragging : 0
│ Send Component ID : disabled
│ Associated Keyboard: none
│ Text :
│ Max. Text Size : 4
│ - Events
│ - Touch Press Event
│ - tSend.txt="event,buttonPress2,"+entn4.txt+",button"
│ - //send calc crc
│ - btlen tSend.txt,sys0
│ - crcrest 1,0xffff // reset CRC
│ - crcputh 55 bb
│ - crcputs sys0,2
│ - crcputs tSend.txt,0
│ - //send cmd
│ - printh 55 bb
│ - prints sys0,2
│ - prints tSend.txt,0
│ - prints crcval,2
│ -
│ Text f5Icon
│ Attributes
│ Scope : local
│ Dragging : 0
│ Send Component ID : disabled
│ Associated Keyboard: none
│ Text :
│ Max. Text Size : 4
│ - Events
│ - Touch Press Event
│ - tSend.txt="event,buttonPress2,"+entn5.txt+",button"
│ - //send calc crc
│ - btlen tSend.txt,sys0
│ - crcrest 1,0xffff // reset CRC
│ - crcputh 55 bb
│ - crcputs sys0,2
│ - crcputs tSend.txt,0
│ - //send cmd
│ - printh 55 bb
│ - prints sys0,2
│ - prints tSend.txt,0
│ - prints crcval,2
│ -
│ -Text m0
│ - Attributes
│ - Scope : local
@@ -274,7 +475,7 @@
│ Send Component ID : disabled
│ Associated Keyboard: none
│ Text : PM
│ @@ -585,15 +561,14 @@
│ @@ -704,15 +561,14 @@
│ if(tTmp.txt!="")
│ {
│ covx tTmp.txt,defaultFontColor,0,0
@@ -290,3 +491,67 @@
│ if(tAMPM.txt=="")
│ {
│ vis tAMPM,0
│ @@ -833,44 +689,34 @@
│ //e6Val
│ spstr strCommand.txt,e6Val.txt,"~",60
│ //f1Icon
│ spstr strCommand.txt,f1Icon.txt,"~",63
│ //f1Icon Color
│ spstr strCommand.txt,tTmp.txt,"~",64
│ covx tTmp.txt,f1Icon.pco,0,0
│ - //f1Icon intNameEntity
│ - spstr strCommand.txt,entn1.txt,"~",62
│ //f2Icon
│ spstr strCommand.txt,f2Icon.txt,"~",69
│ //f2Icon Color
│ spstr strCommand.txt,tTmp.txt,"~",70
│ covx tTmp.txt,f2Icon.pco,0,0
│ - //f2Icon intNameEntity
│ - spstr strCommand.txt,entn2.txt,"~",68
│ //f3Icon
│ spstr strCommand.txt,f3Icon.txt,"~",75
│ //f3Icon Color
│ spstr strCommand.txt,tTmp.txt,"~",76
│ covx tTmp.txt,f3Icon.pco,0,0
│ - //f3Icon intNameEntity
│ - spstr strCommand.txt,entn3.txt,"~",74
│ //f4Icon
│ spstr strCommand.txt,f4Icon.txt,"~",81
│ //f4Icon Color
│ spstr strCommand.txt,tTmp.txt,"~",82
│ covx tTmp.txt,f4Icon.pco,0,0
│ - //f4Icon intNameEntity
│ - spstr strCommand.txt,entn4.txt,"~",80
│ //f5Icon
│ spstr strCommand.txt,f5Icon.txt,"~",87
│ //f5Icon Color
│ spstr strCommand.txt,tTmp.txt,"~",88
│ covx tTmp.txt,f5Icon.pco,0,0
│ - //f5Icon intNameEntity
│ - spstr strCommand.txt,entn5.txt,"~",86
│ }
│ if(tInstruction.txt=="notify")
│ {
│ spstr strCommand.txt,tNotifyHead.txt,"~",1
│ spstr strCommand.txt,tNotifyText.txt,"~",2
│ if(tNotifyHead.txt!=""||tNotifyText.txt!="")
│ {
│ @@ -966,14 +812,18 @@
│ {
│ page cardPower
│ }
│ if(tId.txt=="cardChart")
│ {
│ page cardChart
│ }
│ + if(tId.txt=="cardLChart")
│ + {
│ + page cardLChart
│ + }
│ }
│ if(tInstruction.txt=="timeout")
│ {
│ //set timeout to global var
│ spstr strCommand.txt,tTmp.txt,"~",1
│ covx tTmp.txt,sleepTimeout,0,0
│ }

View File

@@ -1,17 +1,5 @@
--- HMI/n2t-out
+++ HMI/US/portrait/n2t-out
├── file list
│ @@ -1,10 +1,9 @@
│ Program.s.txt
│ cardAlarm.txt
│ -cardBurnRec.txt
│ cardChart.txt
│ cardEntities.txt
│ cardGrid.txt
│ cardGrid2.txt
│ cardLChart.txt
│ cardMedia.txt
│ cardPower.txt
│ --- HMI/n2t-out/Program.s.txt
├── +++ HMI/US/portrait/n2t-out/Program.s.txt
│ @@ -12,11 +12,11 @@
@@ -2016,6 +2004,25 @@
│ }
│ if(tInstruction.txt=="exitPopup")
│ {
│ @@ -439,18 +439,14 @@
│ {
│ page cardPower
│ }
│ if(tId.txt=="cardChart")
│ {
│ page cardChart
│ }
│ - if(tId.txt=="cardLChart")
│ - {
│ - page cardLChart
│ - }
│ }
│ // end of user code
│ udelete payloadLength-1
│ bufferPos=0
│ }
│ }
│ }
│ --- HMI/n2t-out/screensaver.txt
├── +++ HMI/US/portrait/n2t-out/screensaver.txt
│ @@ -7,27 +7,14 @@
@@ -2168,7 +2175,7 @@
│ vis p0,0
│ vis tNotifyHead,0
│ vis tNotifyText,0
│ @@ -41,17 +28,14 @@
│ @@ -41,52 +28,19 @@
│ }
│ tDate.txt=pageIcons.vaDate.txt
│ dim=dimValue
@@ -2179,14 +2186,81 @@
│ - Postinitialize Event
│ - click m0,1
│ -
│ -Variable (string) entn1
│ - Attributes
│ - Scope : local
│ - Text :
│ - Max. Text Size: 14
│ -
│ -Variable (string) entn2
│ - Attributes
│ - Scope : local
│ - Text :
│ - Max. Text Size: 14
│ -
│ -Variable (string) entn3
│ - Attributes
│ - Scope : local
│ - Text :
│ - Max. Text Size: 14
│ -
│ -Variable (string) entn4
│ - Attributes
│ - Scope : local
│ - Text :
│ - Max. Text Size: 14
│ -
│ -Variable (string) entn5
│ - Attributes
│ - Scope : local
│ - Text :
│ - Max. Text Size: 14
│ -
│ Variable (string) strCommand
│ Attributes
│ Scope : local
│ Text :
Max. Text Size: 1979
- Max. Text Size: 1955
│ + Max. Text Size: 1979
│ Variable (string) strTmp
@@ -376,34 +360,14 @@
Attributes
│ Scope : local
│ Text :
│ Max. Text Size: 2
│ @@ -96,27 +50,27 @@
│ Text :
│ Max. Text Size: 25
│ Variable (string) tInstruction
│ Attributes
│ Scope : local
│ Text :
│ - Max. Text Size: 15
│ + Max. Text Size: 50
│ Variable (string) tSend
│ Attributes
│ Scope : local
│ Text :
│ - Max. Text Size: 30
│ + Max. Text Size: 50
│ Variable (string) tTmp
│ Attributes
│ Scope : local
│ Text :
│ - Max. Text Size: 30
│ + Max. Text Size: 50
│ Variable (int32) vaTap
│ Attributes
│ Scope: local
│ Value: 0
│ Variable (int32) xc1
│ @@ -370,159 +324,50 @@
│ Scope : local
│ Dragging : 0
│ Send Component ID : disabled
@@ -2194,6 +2268,131 @@
│ Text :
│ Max. Text Size : 4
│ - Events
│ - Touch Press Event
│ - tSend.txt="event,buttonPress2,"+entn1.txt+",button"
│ - //send calc crc
│ - btlen tSend.txt,sys0
│ - crcrest 1,0xffff // reset CRC
│ - crcputh 55 bb
│ - crcputs sys0,2
│ - crcputs tSend.txt,0
│ - //send cmd
│ - printh 55 bb
│ - prints sys0,2
│ - prints tSend.txt,0
│ - prints crcval,2
│ -
│ Text f2Icon
│ Attributes
│ Scope : local
│ Dragging : 0
│ Send Component ID : disabled
│ Associated Keyboard: none
│ Text :
│ Max. Text Size : 4
│ - Events
│ - Touch Press Event
│ - tSend.txt="event,buttonPress2,"+entn2.txt+",button"
│ - //send calc crc
│ - btlen tSend.txt,sys0
│ - crcrest 1,0xffff // reset CRC
│ - crcputh 55 bb
│ - crcputs sys0,2
│ - crcputs tSend.txt,0
│ - //send cmd
│ - printh 55 bb
│ - prints sys0,2
│ - prints tSend.txt,0
│ - prints crcval,2
│ -
│ - Touch Release Event
│ - tSend.txt="event,buttonPress2,"+entn1.txt+",button"
│ - //send calc crc
│ - btlen tSend.txt,sys0
│ - crcrest 1,0xffff // reset CRC
│ - crcputh 55 bb
│ - crcputs sys0,2
│ - crcputs tSend.txt,0
│ - //send cmd
│ - printh 55 bb
│ - prints sys0,2
│ - prints tSend.txt,0
│ - prints crcval,2
│ -
│ Text f3Icon
│ Attributes
│ Scope : local
│ Dragging : 0
│ Send Component ID : disabled
│ Associated Keyboard: none
│ Text :
│ Max. Text Size : 4
│ - Events
│ - Touch Press Event
│ - tSend.txt="event,buttonPress2,"+entn3.txt+",button"
│ - //send calc crc
│ - btlen tSend.txt,sys0
│ - crcrest 1,0xffff // reset CRC
│ - crcputh 55 bb
│ - crcputs sys0,2
│ - crcputs tSend.txt,0
│ - //send cmd
│ - printh 55 bb
│ - prints sys0,2
│ - prints tSend.txt,0
│ - prints crcval,2
│ -
│ Text f4Icon
│ Attributes
│ Scope : local
│ Dragging : 0
│ Send Component ID : disabled
│ Associated Keyboard: none
│ Text :
│ Max. Text Size : 4
│ - Events
│ - Touch Press Event
│ - tSend.txt="event,buttonPress2,"+entn4.txt+",button"
│ - //send calc crc
│ - btlen tSend.txt,sys0
│ - crcrest 1,0xffff // reset CRC
│ - crcputh 55 bb
│ - crcputs sys0,2
│ - crcputs tSend.txt,0
│ - //send cmd
│ - printh 55 bb
│ - prints sys0,2
│ - prints tSend.txt,0
│ - prints crcval,2
│ -
│ Text f5Icon
│ Attributes
│ Scope : local
│ Dragging : 0
│ Send Component ID : disabled
│ Associated Keyboard: none
│ Text :
│ Max. Text Size : 4
│ - Events
│ - Touch Press Event
│ - tSend.txt="event,buttonPress2,"+entn5.txt+",button"
│ - //send calc crc
│ - btlen tSend.txt,sys0
│ - crcrest 1,0xffff // reset CRC
│ - crcputh 55 bb
│ - crcputs sys0,2
│ - crcputs tSend.txt,0
│ - //send cmd
│ - printh 55 bb
│ - prints sys0,2
│ - prints tSend.txt,0
│ - prints crcval,2
│ -
│ -Text m0
│ - Attributes
│ - Scope : local
@@ -2221,7 +2420,7 @@
│ Send Component ID : disabled
│ Associated Keyboard: none
│ Text : PM
│ @@ -585,15 +549,14 @@
│ @@ -704,15 +549,14 @@
│ if(tTmp.txt!="")
│ {
│ covx tTmp.txt,defaultFontColor,0,0
@@ -2237,3 +2436,67 @@
│ if(tAMPM.txt=="")
│ {
│ vis tAMPM,0
│ @@ -833,44 +677,34 @@
│ //e6Val
│ spstr strCommand.txt,e6Val.txt,"~",60
│ //f1Icon
│ spstr strCommand.txt,f1Icon.txt,"~",63
│ //f1Icon Color
│ spstr strCommand.txt,tTmp.txt,"~",64
│ covx tTmp.txt,f1Icon.pco,0,0
│ - //f1Icon intNameEntity
│ - spstr strCommand.txt,entn1.txt,"~",62
│ //f2Icon
│ spstr strCommand.txt,f2Icon.txt,"~",69
│ //f2Icon Color
│ spstr strCommand.txt,tTmp.txt,"~",70
│ covx tTmp.txt,f2Icon.pco,0,0
│ - //f2Icon intNameEntity
│ - spstr strCommand.txt,entn2.txt,"~",68
│ //f3Icon
│ spstr strCommand.txt,f3Icon.txt,"~",75
│ //f3Icon Color
│ spstr strCommand.txt,tTmp.txt,"~",76
│ covx tTmp.txt,f3Icon.pco,0,0
│ - //f3Icon intNameEntity
│ - spstr strCommand.txt,entn3.txt,"~",74
│ //f4Icon
│ spstr strCommand.txt,f4Icon.txt,"~",81
│ //f4Icon Color
│ spstr strCommand.txt,tTmp.txt,"~",82
│ covx tTmp.txt,f4Icon.pco,0,0
│ - //f4Icon intNameEntity
│ - spstr strCommand.txt,entn4.txt,"~",80
│ //f5Icon
│ spstr strCommand.txt,f5Icon.txt,"~",87
│ //f5Icon Color
│ spstr strCommand.txt,tTmp.txt,"~",88
│ covx tTmp.txt,f5Icon.pco,0,0
│ - //f5Icon intNameEntity
│ - spstr strCommand.txt,entn5.txt,"~",86
│ }
│ if(tInstruction.txt=="notify")
│ {
│ spstr strCommand.txt,tNotifyHead.txt,"~",1
│ spstr strCommand.txt,tNotifyText.txt,"~",2
│ if(tNotifyHead.txt!=""||tNotifyText.txt!="")
│ {
│ @@ -966,14 +800,18 @@
│ {
│ page cardPower
│ }
│ if(tId.txt=="cardChart")
│ {
│ page cardChart
│ }
│ + if(tId.txt=="cardLChart")
│ + {
│ + page cardLChart
│ + }
│ }
│ if(tInstruction.txt=="timeout")
│ {
│ //set timeout to global var
│ spstr strCommand.txt,tTmp.txt,"~",1
│ covx tTmp.txt,sleepTimeout,0,0
│ }

View File

@@ -1,16 +1,4 @@
+++ /dev/fd/62 2023-11-27 23:28:52.512823638 +0000
+le list
+ +1,9 @@
+.s.txt
+rm.txt
+nRec.txt
+rt.txt
+ities.txt
+d.txt
+d2.txt
+art.txt
+ia.txt
+er.txt
+++ /dev/fd/62 2024-01-19 15:23:13.505105687 +0000
+I/n2t-out/Program.s.txt
++ HMI/US/portrait/n2t-out/Program.s.txt
+1 +12,11 @@
@@ -698,13 +686,6 @@
+ covx tTmp.txt,sys0,0,0
+ hSlider6.maxval=sys0
+ }
+ }
+ if(tInstruction.txt=="pageType")
+ {
+ sleepValue=0
+ //command format pageType,specialPageName
+ //write name of speical page to tId
+ spstr strCommand.txt,tId.txt,"~",1
+I/n2t-out/cardGrid.txt
++ HMI/US/portrait/n2t-out/cardGrid.txt
+ +7,14 @@
@@ -958,6 +939,13 @@
+ spstr strCommand.txt,tEntity9.txt,"~",66
+ vis tEntity9,1
+ }
+ }
+ if(tInstruction.txt=="pageType")
+ {
+ sleepValue=0
+ //command format pageType,specialPageName
+ //write name of speical page to tId
+ spstr strCommand.txt,tId.txt,"~",1
+I/n2t-out/cardLChart.txt
++ HMI/US/portrait/n2t-out/cardLChart.txt
+ +7,14 @@
@@ -1558,6 +1546,25 @@
+ }
+ if(tInstruction.txt=="exitPopup")
+ {
+18 +439,14 @@
+ {
+ page cardPower
+ }
+ if(tId.txt=="cardChart")
+ {
+ page cardChart
+ }
+ if(tId.txt=="cardLChart")
+ {
+ page cardLChart
+ }
+ }
+ // end of user code
+ udelete payloadLength-1
+ bufferPos=0
+ }
+ }
+ }
+I/n2t-out/screensaver.txt
++ HMI/US/portrait/n2t-out/screensaver.txt
+ +7,14 @@
@@ -1710,7 +1717,7 @@
+ vis p0,0
+ vis tNotifyHead,0
+ vis tNotifyText,0
+7 +28,14 @@
+2 +28,19 @@
+ }
+ tDate.txt=pageIcons.vaDate.txt
+ dim=dimValue
@@ -1721,14 +1728,81 @@
+ Postinitialize Event
+ click m0,1
+
+e (string) entn1
+ributes
+ Scope : local
+ Text :
+ Max. Text Size: 14
+
+e (string) entn2
+ributes
+ Scope : local
+ Text :
+ Max. Text Size: 14
+
+e (string) entn3
+ributes
+ Scope : local
+ Text :
+ Max. Text Size: 14
+
+e (string) entn4
+ributes
+ Scope : local
+ Text :
+ Max. Text Size: 14
+
+e (string) entn5
+ributes
+ Scope : local
+ Text :
+ Max. Text Size: 14
+
+e (string) strCommand
+ributes
+ Scope : local
+ Text :
+ Max. Text Size: 1955
+ Max. Text Size: 1979
+
+e (string) strTmp
+34 +360,14 @@
+ributes
+ Scope : local
+ Text :
+ Max. Text Size: 2
+
+7 +50,27 @@
+ Text :
+ Max. Text Size: 25
+
+e (string) tInstruction
+ributes
+ Scope : local
+ Text :
+ Max. Text Size: 15
+ Max. Text Size: 50
+
+e (string) tSend
+ributes
+ Scope : local
+ Text :
+ Max. Text Size: 30
+ Max. Text Size: 50
+
+e (string) tTmp
+ributes
+ Scope : local
+ Text :
+ Max. Text Size: 30
+ Max. Text Size: 50
+
+e (int32) vaTap
+ributes
+ Scope: local
+ Value: 0
+
+e (int32) xc1
+159 +324,50 @@
+ Scope : local
+ Dragging : 0
+ Send Component ID : disabled
@@ -1736,6 +1810,131 @@
+ Text :
+ Max. Text Size : 4
+
+nts
+ Touch Press Event
+ tSend.txt="event,buttonPress2,"+entn1.txt+",button"
+ //send calc crc
+ btlen tSend.txt,sys0
+ crcrest 1,0xffff // reset CRC
+ crcputh 55 bb
+ crcputs sys0,2
+ crcputs tSend.txt,0
+ //send cmd
+ printh 55 bb
+ prints sys0,2
+ prints tSend.txt,0
+ prints crcval,2
+
+Icon
+ributes
+ Scope : local
+ Dragging : 0
+ Send Component ID : disabled
+ Associated Keyboard: none
+ Text :
+ Max. Text Size : 4
+
+nts
+ Touch Press Event
+ tSend.txt="event,buttonPress2,"+entn2.txt+",button"
+ //send calc crc
+ btlen tSend.txt,sys0
+ crcrest 1,0xffff // reset CRC
+ crcputh 55 bb
+ crcputs sys0,2
+ crcputs tSend.txt,0
+ //send cmd
+ printh 55 bb
+ prints sys0,2
+ prints tSend.txt,0
+ prints crcval,2
+
+ Touch Release Event
+ tSend.txt="event,buttonPress2,"+entn1.txt+",button"
+ //send calc crc
+ btlen tSend.txt,sys0
+ crcrest 1,0xffff // reset CRC
+ crcputh 55 bb
+ crcputs sys0,2
+ crcputs tSend.txt,0
+ //send cmd
+ printh 55 bb
+ prints sys0,2
+ prints tSend.txt,0
+ prints crcval,2
+
+Icon
+ributes
+ Scope : local
+ Dragging : 0
+ Send Component ID : disabled
+ Associated Keyboard: none
+ Text :
+ Max. Text Size : 4
+
+nts
+ Touch Press Event
+ tSend.txt="event,buttonPress2,"+entn3.txt+",button"
+ //send calc crc
+ btlen tSend.txt,sys0
+ crcrest 1,0xffff // reset CRC
+ crcputh 55 bb
+ crcputs sys0,2
+ crcputs tSend.txt,0
+ //send cmd
+ printh 55 bb
+ prints sys0,2
+ prints tSend.txt,0
+ prints crcval,2
+
+Icon
+ributes
+ Scope : local
+ Dragging : 0
+ Send Component ID : disabled
+ Associated Keyboard: none
+ Text :
+ Max. Text Size : 4
+
+nts
+ Touch Press Event
+ tSend.txt="event,buttonPress2,"+entn4.txt+",button"
+ //send calc crc
+ btlen tSend.txt,sys0
+ crcrest 1,0xffff // reset CRC
+ crcputh 55 bb
+ crcputs sys0,2
+ crcputs tSend.txt,0
+ //send cmd
+ printh 55 bb
+ prints sys0,2
+ prints tSend.txt,0
+ prints crcval,2
+
+Icon
+ributes
+ Scope : local
+ Dragging : 0
+ Send Component ID : disabled
+ Associated Keyboard: none
+ Text :
+ Max. Text Size : 4
+
+nts
+ Touch Press Event
+ tSend.txt="event,buttonPress2,"+entn5.txt+",button"
+ //send calc crc
+ btlen tSend.txt,sys0
+ crcrest 1,0xffff // reset CRC
+ crcputh 55 bb
+ crcputs sys0,2
+ crcputs tSend.txt,0
+ //send cmd
+ printh 55 bb
+ prints sys0,2
+ prints tSend.txt,0
+ prints crcval,2
+
+
+ributes
+ Scope : local
@@ -1779,3 +1978,67 @@
+ if(tAMPM.txt=="")
+ {
+ vis tAMPM,0
+44 +677,34 @@
+ //e6Val
+ spstr strCommand.txt,e6Val.txt,"~",60
+ //f1Icon
+ spstr strCommand.txt,f1Icon.txt,"~",63
+ //f1Icon Color
+ spstr strCommand.txt,tTmp.txt,"~",64
+ covx tTmp.txt,f1Icon.pco,0,0
+ //f1Icon intNameEntity
+ spstr strCommand.txt,entn1.txt,"~",62
+ //f2Icon
+ spstr strCommand.txt,f2Icon.txt,"~",69
+ //f2Icon Color
+ spstr strCommand.txt,tTmp.txt,"~",70
+ covx tTmp.txt,f2Icon.pco,0,0
+ //f2Icon intNameEntity
+ spstr strCommand.txt,entn2.txt,"~",68
+ //f3Icon
+ spstr strCommand.txt,f3Icon.txt,"~",75
+ //f3Icon Color
+ spstr strCommand.txt,tTmp.txt,"~",76
+ covx tTmp.txt,f3Icon.pco,0,0
+ //f3Icon intNameEntity
+ spstr strCommand.txt,entn3.txt,"~",74
+ //f4Icon
+ spstr strCommand.txt,f4Icon.txt,"~",81
+ //f4Icon Color
+ spstr strCommand.txt,tTmp.txt,"~",82
+ covx tTmp.txt,f4Icon.pco,0,0
+ //f4Icon intNameEntity
+ spstr strCommand.txt,entn4.txt,"~",80
+ //f5Icon
+ spstr strCommand.txt,f5Icon.txt,"~",87
+ //f5Icon Color
+ spstr strCommand.txt,tTmp.txt,"~",88
+ covx tTmp.txt,f5Icon.pco,0,0
+ //f5Icon intNameEntity
+ spstr strCommand.txt,entn5.txt,"~",86
+ }
+ if(tInstruction.txt=="notify")
+ {
+ spstr strCommand.txt,tNotifyHead.txt,"~",1
+ spstr strCommand.txt,tNotifyText.txt,"~",2
+ if(tNotifyHead.txt!=""||tNotifyText.txt!="")
+ {
+14 +800,18 @@
+ {
+ page cardPower
+ }
+ if(tId.txt=="cardChart")
+ {
+ page cardChart
+ }
+ if(tId.txt=="cardLChart")
+ {
+ page cardLChart
+ }
+ }
+ if(tInstruction.txt=="timeout")
+ {
+ //set timeout to global var
+ spstr strCommand.txt,tTmp.txt,"~",1
+ covx tTmp.txt,sleepTimeout,0,0
+ }

View File

@@ -1,272 +1,274 @@
from shared import *
head = sharedhead + """
if(tInstruction.txt=="wake")
{
click tc0,1
}
if(tInstruction.txt=="dimmode")
{
// get value
spstr strCommand.txt,tTmp.txt,"~",1
covx tTmp.txt,dimValue,0,0
dim=dimValue
// get value normal
spstr strCommand.txt,tTmp.txt,"~",2
covx tTmp.txt,dimValueNormal,0,0
// get background color
spstr strCommand.txt,tTmp.txt,"~",3
if(tTmp.txt!="")
{
covx tTmp.txt,defaultBcoColor,0,0
}
// get font color
spstr strCommand.txt,tTmp.txt,"~",4
if(tTmp.txt!="")
{
covx tTmp.txt,defaultFontColor,0,0
}
}
if(tInstruction.txt=="time")
{
click m0,1
//get set time to global variable
spstr strCommand.txt,pageIcons.vaTime.txt,"~",1
spstr pageIcons.vaTime.txt,tTime.txt,"?",0
spstr pageIcons.vaTime.txt,tAMPM.txt,"?",1
if(tAMPM.txt=="")
{
vis tAMPM,0
}
spstr strCommand.txt,tTimeAdd.txt,"~",2
ref tIcon1
ref tIcon2
}
if(tInstruction.txt=="date")
{
//get set date to global variable
spstr strCommand.txt,pageIcons.vaDate.txt,"~",1
tDate.txt=pageIcons.vaDate.txt
}
if(tInstruction.txt=="statusUpdate")
{
//statusIcon1
spstr strCommand.txt,tIcon1.txt,"~",1
spstr strCommand.txt,tTmp.txt,"~",2
covx tTmp.txt,tIcon1.pco,0,0
//statusIcon2
spstr strCommand.txt,tIcon2.txt,"~",3
spstr strCommand.txt,tTmp.txt,"~",4
covx tTmp.txt,tIcon2.pco,0,0
spstr strCommand.txt,tTmp.txt,"~",5
if(tTmp.txt!="")
{
tIcon1.font=3
}
spstr strCommand.txt,tTmp.txt,"~",6
if(tTmp.txt!="")
{
tIcon2.font=3
}
}
if(tInstruction.txt=="weatherUpdate"&&tNotifyHead.txt==""&&tNotifyText.txt=="")
{
//tMainIcon
spstr strCommand.txt,tMainIcon.txt,"~",3
//tMainIcon Color
spstr strCommand.txt,tTmp.txt,"~",4
covx tTmp.txt,tMainIcon.pco,0,0
//tMainText
spstr strCommand.txt,tMainText.txt,"~",6
"""
start = 7
for i in range(1,4):
idxstart = start + (i-1)*6
item = f"""
//d{i}Icon
spstr strCommand.txt,d{i}Icon.txt,"~",{idxstart+2}
//d{i}Icon Color
spstr strCommand.txt,tTmp.txt,"~",{idxstart+3}
covx tTmp.txt,d{i}Icon.pco,0,0
//d{i}Val
spstr strCommand.txt,d{i}Val.txt,"~",{idxstart+5}
"""
head = head + item
start = idxstart+6
for i in range(1,7):
idxstart = start + (i-1)*6
item = f"""
//e{i}Name
spstr strCommand.txt,e{i}Name.txt,"~",{idxstart+4}
//e{i}Icon
spstr strCommand.txt,e{i}Icon.txt,"~",{idxstart+2}
//e{i}Icon Color
spstr strCommand.txt,tTmp.txt,"~",{idxstart+3}
covx tTmp.txt,e{i}Icon.pco,0,0
//e{i}Val
spstr strCommand.txt,e{i}Val.txt,"~",{idxstart+5}
"""
head = head + item
start = idxstart+6
for i in range(1,6):
idxstart = start + (i-1)*6
item = f"""
//f{i}Icon
spstr strCommand.txt,f{i}Icon.txt,"~",{idxstart+2}
//f{i}Icon Color
spstr strCommand.txt,tTmp.txt,"~",{idxstart+3}
covx tTmp.txt,f{i}Icon.pco,0,0
"""
head = head + item
head = head + """
}
if(tInstruction.txt=="color"&&tNotifyHead.txt==""&&tNotifyText.txt=="")
{
spstr strCommand.txt,tTmp.txt,"~",1
covx tTmp.txt,tTime.bco,0,0
if(tTime.bco!=screensaver.bco)
{
for(sys0=0;sys0<60;sys0++)
{
if(b[sys0].type==98||b[sys0].type==116||b[sys0].type==54)
{
b[sys0].bco=tTime.bco
}
}
}
spstr strCommand.txt,tTmp.txt,"~",2
covx tTmp.txt,tTime.pco,0,0
spstr strCommand.txt,tTmp.txt,"~",3
covx tTmp.txt,tAMPM.pco,0,0
spstr strCommand.txt,tTmp.txt,"~",4
covx tTmp.txt,tDate.pco,0,0
spstr strCommand.txt,tTmp.txt,"~",5
covx tTmp.txt,tMainText.pco,0,0
//spstr strCommand.txt,tTmp.txt,"~",6
//covx tTmp.txt,tForecast1.pco,0,0
//spstr strCommand.txt,tTmp.txt,"~",7
//covx tTmp.txt,tForecast2.pco,0,0
//spstr strCommand.txt,tTmp.txt,"~",8
//covx tTmp.txt,tForecast3.pco,0,0
//spstr strCommand.txt,tTmp.txt,"~",9
//covx tTmp.txt,tForecast4.pco,0,0
//spstr strCommand.txt,tTmp.txt,"~",10
//covx tTmp.txt,tForecast1Val.pco,0,0
//spstr strCommand.txt,tTmp.txt,"~",11
//covx tTmp.txt,tForecast2Val.pco,0,0
//spstr strCommand.txt,tTmp.txt,"~",12
//covx tTmp.txt,tForecast3Val.pco,0,0
//spstr strCommand.txt,tTmp.txt,"~",13
//covx tTmp.txt,tForecast4Val.pco,0,0
//spstr strCommand.txt,tTmp.txt,"~",14
//covx tTmp.txt,t10.bco,0,0
//spstr strCommand.txt,tTmp.txt,"~",15
//covx tTmp.txt,tMainTextAlt2.pco,0,0
//spstr strCommand.txt,tTmp.txt,"~",16
//covx tTmp.txt,tTimeAdd.pco,0,0
}
if(tInstruction.txt=="notify")
{
spstr strCommand.txt,tNotifyHead.txt,"~",1
spstr strCommand.txt,tNotifyText.txt,"~",2
if(tNotifyHead.txt!=""||tNotifyText.txt!="")
{
vis tNotifyHead,1
vis tNotifyText,1
}else
{
vis tNotifyHead,0
vis tNotifyText,0
}
tNotifyHead.bco=tTime.bco
tNotifyText.bco=tTime.bco
spstr strCommand.txt,tTmp.txt,"~",3
if(tTmp.txt!="")
{
covx tTmp.txt,tNotifyHead.pco,0,0
}
spstr strCommand.txt,tTmp.txt,"~",4
if(tTmp.txt!="")
{
covx tTmp.txt,tNotifyText.pco,0,0
}
"""
print(head)
#start = 23
#for i in range(1,7):
# idxstart = start + (i-1)*6
# item = f"""
# // get Type
# spstr strCommand.txt,type{i}.txt,"~",{idxstart}
# // get internal name
# spstr strCommand.txt,entn{i}.txt,"~",{idxstart+1}
# if(type{i}.txt=="delete"||type{i}.txt=="")
# {{
# vis tEntity{i},0
# vis bEntity{i},0
# }}else
# {{
# // change icon
# spstr strCommand.txt,bEntity{i}.txt,"~",{idxstart+2}
# vis bEntity{i},1
# // change icon color
# spstr strCommand.txt,tTmp.txt,"~",{idxstart+3}
# covx tTmp.txt,sys0,0,0
# bEntity{i}.pco=sys0
# // set name
# spstr strCommand.txt,tEntity{i}.txt,"~",{idxstart+4}
# vis tEntity{i},1
# }}
#"""
# print(item)
foot = """
}
""" + sharedfoot.replace("sleepValue=0", "dim=100").replace("""
if(tInstruction.txt=="time")
{
// get set time to global variable
spstr strCommand.txt,pageIcons.vaTime.txt,"~",1
}
if(tInstruction.txt=="date")
{
// get set date to global variable
spstr strCommand.txt,pageIcons.vaDate.txt,"~",1
}
if(tInstruction.txt=="dimmode")
{
// get value
spstr strCommand.txt,tTmp.txt,"~",1
covx tTmp.txt,dimValue,0,0
// get value normal
spstr strCommand.txt,tTmp.txt,"~",2
covx tTmp.txt,dimValueNormal,0,0
dim=dimValueNormal
// get background color
spstr strCommand.txt,tTmp.txt,"~",3
if(tTmp.txt!="")
{
covx tTmp.txt,defaultBcoColor,0,0
}
// get font color
spstr strCommand.txt,tTmp.txt,"~",4
if(tTmp.txt!="")
{
covx tTmp.txt,defaultFontColor,0,0
}
}""","")
print(foot)
from shared import *
head = sharedhead + """
if(tInstruction.txt=="wake")
{
click tc0,1
}
if(tInstruction.txt=="dimmode")
{
// get value
spstr strCommand.txt,tTmp.txt,"~",1
covx tTmp.txt,dimValue,0,0
dim=dimValue
// get value normal
spstr strCommand.txt,tTmp.txt,"~",2
covx tTmp.txt,dimValueNormal,0,0
// get background color
spstr strCommand.txt,tTmp.txt,"~",3
if(tTmp.txt!="")
{
covx tTmp.txt,defaultBcoColor,0,0
}
// get font color
spstr strCommand.txt,tTmp.txt,"~",4
if(tTmp.txt!="")
{
covx tTmp.txt,defaultFontColor,0,0
}
}
if(tInstruction.txt=="time")
{
click m0,1
//get set time to global variable
spstr strCommand.txt,pageIcons.vaTime.txt,"~",1
spstr pageIcons.vaTime.txt,tTime.txt,"?",0
spstr pageIcons.vaTime.txt,tAMPM.txt,"?",1
if(tAMPM.txt=="")
{
vis tAMPM,0
}
spstr strCommand.txt,tTimeAdd.txt,"~",2
ref tIcon1
ref tIcon2
}
if(tInstruction.txt=="date")
{
//get set date to global variable
spstr strCommand.txt,pageIcons.vaDate.txt,"~",1
tDate.txt=pageIcons.vaDate.txt
}
if(tInstruction.txt=="statusUpdate")
{
//statusIcon1
spstr strCommand.txt,tIcon1.txt,"~",1
spstr strCommand.txt,tTmp.txt,"~",2
covx tTmp.txt,tIcon1.pco,0,0
//statusIcon2
spstr strCommand.txt,tIcon2.txt,"~",3
spstr strCommand.txt,tTmp.txt,"~",4
covx tTmp.txt,tIcon2.pco,0,0
spstr strCommand.txt,tTmp.txt,"~",5
if(tTmp.txt!="")
{
tIcon1.font=3
}
spstr strCommand.txt,tTmp.txt,"~",6
if(tTmp.txt!="")
{
tIcon2.font=3
}
}
if(tInstruction.txt=="weatherUpdate"&&tNotifyHead.txt==""&&tNotifyText.txt=="")
{
//tMainIcon
spstr strCommand.txt,tMainIcon.txt,"~",3
//tMainIcon Color
spstr strCommand.txt,tTmp.txt,"~",4
covx tTmp.txt,tMainIcon.pco,0,0
//tMainText
spstr strCommand.txt,tMainText.txt,"~",6
"""
start = 7
for i in range(1,4):
idxstart = start + (i-1)*6
item = f"""
//d{i}Icon
spstr strCommand.txt,d{i}Icon.txt,"~",{idxstart+2}
//d{i}Icon Color
spstr strCommand.txt,tTmp.txt,"~",{idxstart+3}
covx tTmp.txt,d{i}Icon.pco,0,0
//d{i}Val
spstr strCommand.txt,d{i}Val.txt,"~",{idxstart+5}
"""
head = head + item
start = idxstart+6
for i in range(1,7):
idxstart = start + (i-1)*6
item = f"""
//e{i}Name
spstr strCommand.txt,e{i}Name.txt,"~",{idxstart+4}
//e{i}Icon
spstr strCommand.txt,e{i}Icon.txt,"~",{idxstart+2}
//e{i}Icon Color
spstr strCommand.txt,tTmp.txt,"~",{idxstart+3}
covx tTmp.txt,e{i}Icon.pco,0,0
//e{i}Val
spstr strCommand.txt,e{i}Val.txt,"~",{idxstart+5}
"""
head = head + item
start = idxstart+6
for i in range(1,6):
idxstart = start + (i-1)*6
item = f"""
//f{i}Icon
spstr strCommand.txt,f{i}Icon.txt,"~",{idxstart+2}
//f{i}Icon Color
spstr strCommand.txt,tTmp.txt,"~",{idxstart+3}
covx tTmp.txt,f{i}Icon.pco,0,0
//f{i}Icon intNameEntity
spstr strCommand.txt,entn{i}.txt,"~",{idxstart+1}
"""
head = head + item
head = head + """
}
if(tInstruction.txt=="color"&&tNotifyHead.txt==""&&tNotifyText.txt=="")
{
spstr strCommand.txt,tTmp.txt,"~",1
covx tTmp.txt,tTime.bco,0,0
if(tTime.bco!=screensaver.bco)
{
for(sys0=0;sys0<60;sys0++)
{
if(b[sys0].type==98||b[sys0].type==116||b[sys0].type==54)
{
b[sys0].bco=tTime.bco
}
}
}
spstr strCommand.txt,tTmp.txt,"~",2
covx tTmp.txt,tTime.pco,0,0
spstr strCommand.txt,tTmp.txt,"~",3
covx tTmp.txt,tAMPM.pco,0,0
spstr strCommand.txt,tTmp.txt,"~",4
covx tTmp.txt,tDate.pco,0,0
spstr strCommand.txt,tTmp.txt,"~",5
covx tTmp.txt,tMainText.pco,0,0
//spstr strCommand.txt,tTmp.txt,"~",6
//covx tTmp.txt,tForecast1.pco,0,0
//spstr strCommand.txt,tTmp.txt,"~",7
//covx tTmp.txt,tForecast2.pco,0,0
//spstr strCommand.txt,tTmp.txt,"~",8
//covx tTmp.txt,tForecast3.pco,0,0
//spstr strCommand.txt,tTmp.txt,"~",9
//covx tTmp.txt,tForecast4.pco,0,0
//spstr strCommand.txt,tTmp.txt,"~",10
//covx tTmp.txt,tForecast1Val.pco,0,0
//spstr strCommand.txt,tTmp.txt,"~",11
//covx tTmp.txt,tForecast2Val.pco,0,0
//spstr strCommand.txt,tTmp.txt,"~",12
//covx tTmp.txt,tForecast3Val.pco,0,0
//spstr strCommand.txt,tTmp.txt,"~",13
//covx tTmp.txt,tForecast4Val.pco,0,0
//spstr strCommand.txt,tTmp.txt,"~",14
//covx tTmp.txt,t10.bco,0,0
//spstr strCommand.txt,tTmp.txt,"~",15
//covx tTmp.txt,tMainTextAlt2.pco,0,0
//spstr strCommand.txt,tTmp.txt,"~",16
//covx tTmp.txt,tTimeAdd.pco,0,0
}
if(tInstruction.txt=="notify")
{
spstr strCommand.txt,tNotifyHead.txt,"~",1
spstr strCommand.txt,tNotifyText.txt,"~",2
if(tNotifyHead.txt!=""||tNotifyText.txt!="")
{
vis tNotifyHead,1
vis tNotifyText,1
}else
{
vis tNotifyHead,0
vis tNotifyText,0
}
tNotifyHead.bco=tTime.bco
tNotifyText.bco=tTime.bco
spstr strCommand.txt,tTmp.txt,"~",3
if(tTmp.txt!="")
{
covx tTmp.txt,tNotifyHead.pco,0,0
}
spstr strCommand.txt,tTmp.txt,"~",4
if(tTmp.txt!="")
{
covx tTmp.txt,tNotifyText.pco,0,0
}
"""
print(head)
#start = 23
#for i in range(1,7):
# idxstart = start + (i-1)*6
# item = f"""
# // get Type
# spstr strCommand.txt,type{i}.txt,"~",{idxstart}
# // get internal name
# spstr strCommand.txt,entn{i}.txt,"~",{idxstart+1}
# if(type{i}.txt=="delete"||type{i}.txt=="")
# {{
# vis tEntity{i},0
# vis bEntity{i},0
# }}else
# {{
# // change icon
# spstr strCommand.txt,bEntity{i}.txt,"~",{idxstart+2}
# vis bEntity{i},1
# // change icon color
# spstr strCommand.txt,tTmp.txt,"~",{idxstart+3}
# covx tTmp.txt,sys0,0,0
# bEntity{i}.pco=sys0
# // set name
# spstr strCommand.txt,tEntity{i}.txt,"~",{idxstart+4}
# vis tEntity{i},1
# }}
#"""
# print(item)
foot = """
}
""" + sharedfoot.replace("sleepValue=0", "dim=100").replace("""
if(tInstruction.txt=="time")
{
// get set time to global variable
spstr strCommand.txt,pageIcons.vaTime.txt,"~",1
}
if(tInstruction.txt=="date")
{
// get set date to global variable
spstr strCommand.txt,pageIcons.vaDate.txt,"~",1
}
if(tInstruction.txt=="dimmode")
{
// get value
spstr strCommand.txt,tTmp.txt,"~",1
covx tTmp.txt,dimValue,0,0
// get value normal
spstr strCommand.txt,tTmp.txt,"~",2
covx tTmp.txt,dimValueNormal,0,0
dim=dimValueNormal
// get background color
spstr strCommand.txt,tTmp.txt,"~",3
if(tTmp.txt!="")
{
covx tTmp.txt,defaultBcoColor,0,0
}
// get font color
spstr strCommand.txt,tTmp.txt,"~",4
if(tTmp.txt!="")
{
covx tTmp.txt,defaultFontColor,0,0
}
}""","")
print(foot)

View File

@@ -1,63 +0,0 @@
Page cardBurnRec
Attributes
ID : 0
Scope : local
Dragging : 0
Send Component ID : disabled
Opacity : 127
Width : 480
Effect : load
Effect Priority : 0
Effect Time : 300
Locked : no
Swide up page ID : disabled
Swide down page ID : disabled
Swide left page ID : disabled
Swide right page ID: disabled
Fill : solid color
Back. Color : 65535
Timer tm0
Attributes
ID : 1
Scope : local
Period (ms): 1001
Enabled : yes
Events
Timer Event
dim=100
sys0=0
sys1=0
if(sys2==WHITE)
{
sys2=BLACK
}else
{
sys2=WHITE
}
sya1=sys2
while(sys0<8)
{
sya0=sys0%2
if(sya1==WHITE)
{
sya1=BLACK
}else
{
sya1=WHITE
}
fill 0,40*sys0,480,40,sya1
sys0++
}
TouchCap tc0
Attributes
ID : 2
Scope: local
Value: 0
Events
Touch Press Event
page pageStartup

View File

@@ -6,10 +6,14 @@ pageIcons
7 Component(s)
0 Line(s) of event code
0 Unique line(s) of event code
cardBurnRec
3 Component(s)
25 Line(s) of event code
21 Unique line(s) of event code
pageTest
25 Component(s)
68 Line(s) of event code
66 Unique line(s) of event code
popupNotify
19 Component(s)
271 Line(s) of event code
174 Unique line(s) of event code
popupFan
27 Component(s)
355 Line(s) of event code
@@ -26,14 +30,6 @@ popupLightNew
23 Component(s)
412 Line(s) of event code
209 Unique line(s) of event code
popupNotify
19 Component(s)
267 Line(s) of event code
172 Unique line(s) of event code
pageTest
26 Component(s)
69 Line(s) of event code
67 Unique line(s) of event code
cardGrid2
52 Component(s)
703 Line(s) of event code
@@ -46,6 +42,10 @@ cardChart
33 Component(s)
447 Line(s) of event code
297 Unique line(s) of event code
cardGrid
44 Component(s)
593 Line(s) of event code
333 Unique line(s) of event code
cardQR
34 Component(s)
420 Line(s) of event code
@@ -66,10 +66,6 @@ cardThermo
57 Component(s)
550 Line(s) of event code
320 Unique line(s) of event code
cardGrid
44 Component(s)
593 Line(s) of event code
333 Unique line(s) of event code
popupInSel
34 Component(s)
621 Line(s) of event code
@@ -91,16 +87,16 @@ popupThermo
523 Line(s) of event code
276 Unique line(s) of event code
screensaver2
59 Component(s)
373 Line(s) of event code
256 Unique line(s) of event code
64 Component(s)
434 Line(s) of event code
264 Unique line(s) of event code
cardEntities
67 Component(s)
1205 Line(s) of event code
536 Unique line(s) of event code
Total
24 Page(s)
880 Component(s)
10740 Line(s) of event code
2475 Unique line(s) of event code
23 Page(s)
881 Component(s)
10779 Line(s) of event code
2466 Unique line(s) of event code

View File

@@ -335,41 +335,6 @@ Button b13
Touch Press Event
showqq
Button b14
Attributes
ID : 25
Scope : local
Dragging : 0
Send Component ID : disabled
Opacity : 127
x coordinate : 229
y coordinate : 188
Width : 106
Height : 40
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : 3D auto
Font ID : 1
Back. Color : 50712
Back. Picture ID (Pressed): 65535
Back. Color (Pressed) : 1024
Font Color (Unpressed) : 0
Font Color (Pressed) : 65535
Horizontal Alignment : center
Vertical Alignment : center
State : unpressed
Text : burntest
Max. Text Size : 10
Word wrap : disabled
Horizontal Spacing : 0
Vertical Spacing : 0
Events
Touch Press Event
page cardBurnRec
Button b15
Attributes
ID : 21

View File

@@ -672,6 +672,10 @@ Timer tmSerial
{
page cardChart
}
if(tId.txt=="cardLChart")
{
page cardLChart
}
}
// end of user code
udelete payloadLength-1

View File

@@ -56,12 +56,47 @@ Page screensaver2
Postinitialize Event
click m0,1
Variable (string) entn1
Attributes
ID : 59
Scope : local
Text :
Max. Text Size: 14
Variable (string) entn2
Attributes
ID : 60
Scope : local
Text :
Max. Text Size: 14
Variable (string) entn3
Attributes
ID : 61
Scope : local
Text :
Max. Text Size: 14
Variable (string) entn4
Attributes
ID : 62
Scope : local
Text :
Max. Text Size: 14
Variable (string) entn5
Attributes
ID : 63
Scope : local
Text :
Max. Text Size: 14
Variable (string) strCommand
Attributes
ID : 4
Scope : local
Text :
Max. Text Size: 1979
Max. Text Size: 1955
Variable (string) strTmp
Attributes
@@ -82,21 +117,21 @@ Variable (string) tInstruction
ID : 18
Scope : local
Text :
Max. Text Size: 50
Max. Text Size: 15
Variable (string) tSend
Attributes
ID : 20
Scope : local
Text :
Max. Text Size: 50
Max. Text Size: 30
Variable (string) tTmp
Attributes
ID : 19
Scope : local
Text :
Max. Text Size: 50
Max. Text Size: 30
Variable (int32) vaTap
Attributes
@@ -865,6 +900,21 @@ Text f1Icon
Horizontal Spacing : 0
Vertical Spacing : 0
Events
Touch Press Event
tSend.txt="event,buttonPress2,"+entn1.txt+",button"
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,2
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Text f2Icon
Attributes
ID : 54
@@ -894,6 +944,35 @@ Text f2Icon
Horizontal Spacing : 0
Vertical Spacing : 0
Events
Touch Press Event
tSend.txt="event,buttonPress2,"+entn2.txt+",button"
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,2
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Touch Release Event
tSend.txt="event,buttonPress2,"+entn1.txt+",button"
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,2
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Text f3Icon
Attributes
ID : 55
@@ -923,6 +1002,21 @@ Text f3Icon
Horizontal Spacing : 0
Vertical Spacing : 0
Events
Touch Press Event
tSend.txt="event,buttonPress2,"+entn3.txt+",button"
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,2
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Text f4Icon
Attributes
ID : 53
@@ -952,6 +1046,21 @@ Text f4Icon
Horizontal Spacing : 0
Vertical Spacing : 0
Events
Touch Press Event
tSend.txt="event,buttonPress2,"+entn4.txt+",button"
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,2
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Text f5Icon
Attributes
ID : 52
@@ -981,6 +1090,21 @@ Text f5Icon
Horizontal Spacing : 0
Vertical Spacing : 0
Events
Touch Press Event
tSend.txt="event,buttonPress2,"+entn5.txt+",button"
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,2
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Text m0
Attributes
ID : 32
@@ -1551,26 +1675,36 @@ Timer tmSerial
//f1Icon Color
spstr strCommand.txt,tTmp.txt,"~",64
covx tTmp.txt,f1Icon.pco,0,0
//f1Icon intNameEntity
spstr strCommand.txt,entn1.txt,"~",62
//f2Icon
spstr strCommand.txt,f2Icon.txt,"~",69
//f2Icon Color
spstr strCommand.txt,tTmp.txt,"~",70
covx tTmp.txt,f2Icon.pco,0,0
//f2Icon intNameEntity
spstr strCommand.txt,entn2.txt,"~",68
//f3Icon
spstr strCommand.txt,f3Icon.txt,"~",75
//f3Icon Color
spstr strCommand.txt,tTmp.txt,"~",76
covx tTmp.txt,f3Icon.pco,0,0
//f3Icon intNameEntity
spstr strCommand.txt,entn3.txt,"~",74
//f4Icon
spstr strCommand.txt,f4Icon.txt,"~",81
//f4Icon Color
spstr strCommand.txt,tTmp.txt,"~",82
covx tTmp.txt,f4Icon.pco,0,0
//f4Icon intNameEntity
spstr strCommand.txt,entn4.txt,"~",80
//f5Icon
spstr strCommand.txt,f5Icon.txt,"~",87
//f5Icon Color
spstr strCommand.txt,tTmp.txt,"~",88
covx tTmp.txt,f5Icon.pco,0,0
//f5Icon intNameEntity
spstr strCommand.txt,entn5.txt,"~",86
}
if(tInstruction.txt=="notify")
{
@@ -1674,10 +1808,6 @@ Timer tmSerial
{
page cardChart
}
if(tId.txt=="cardLChart")
{
page cardLChart
}
}
if(tInstruction.txt=="timeout")
{

View File

@@ -1,53 +0,0 @@
Page cardBurnRec
Attributes
Scope : local
Dragging : 0
Send Component ID : disabled
Locked : no
Swide up page ID : disabled
Swide down page ID : disabled
Swide left page ID : disabled
Swide right page ID: disabled
Timer tm0
Attributes
Scope : local
Period (ms): 1001
Enabled : yes
Events
Timer Event
dim=100
sys0=0
sys1=0
if(sys2==WHITE)
{
sys2=BLACK
}else
{
sys2=WHITE
}
sya1=sys2
while(sys0<8)
{
sya0=sys0%2
if(sya1==WHITE)
{
sya1=BLACK
}else
{
sya1=WHITE
}
fill 0,40*sys0,480,40,sya1
sys0++
}
TouchCap tc0
Attributes
Scope: local
Value: 0
Events
Touch Press Event
page pageStartup

View File

@@ -141,19 +141,6 @@ Button b13
Touch Press Event
showqq
Button b14
Attributes
Scope : local
Dragging : 0
Send Component ID: disabled
State : unpressed
Text : burntest
Max. Text Size : 10
Events
Touch Press Event
page cardBurnRec
Button b15
Attributes
Scope : local

View File

@@ -443,6 +443,10 @@ Timer tmSerial
{
page cardChart
}
if(tId.txt=="cardLChart")
{
page cardLChart
}
}
// end of user code
udelete payloadLength-1

View File

@@ -48,11 +48,41 @@ Page screensaver2
Postinitialize Event
click m0,1
Variable (string) entn1
Attributes
Scope : local
Text :
Max. Text Size: 14
Variable (string) entn2
Attributes
Scope : local
Text :
Max. Text Size: 14
Variable (string) entn3
Attributes
Scope : local
Text :
Max. Text Size: 14
Variable (string) entn4
Attributes
Scope : local
Text :
Max. Text Size: 14
Variable (string) entn5
Attributes
Scope : local
Text :
Max. Text Size: 14
Variable (string) strCommand
Attributes
Scope : local
Text :
Max. Text Size: 1979
Max. Text Size: 1955
Variable (string) strTmp
Attributes
@@ -70,19 +100,19 @@ Variable (string) tInstruction
Attributes
Scope : local
Text :
Max. Text Size: 50
Max. Text Size: 15
Variable (string) tSend
Attributes
Scope : local
Text :
Max. Text Size: 50
Max. Text Size: 30
Variable (string) tTmp
Attributes
Scope : local
Text :
Max. Text Size: 50
Max. Text Size: 30
Variable (int32) vaTap
Attributes
@@ -344,6 +374,21 @@ Text f1Icon
Text :
Max. Text Size : 4
Events
Touch Press Event
tSend.txt="event,buttonPress2,"+entn1.txt+",button"
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,2
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Text f2Icon
Attributes
Scope : local
@@ -353,6 +398,35 @@ Text f2Icon
Text :
Max. Text Size : 4
Events
Touch Press Event
tSend.txt="event,buttonPress2,"+entn2.txt+",button"
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,2
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Touch Release Event
tSend.txt="event,buttonPress2,"+entn1.txt+",button"
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,2
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Text f3Icon
Attributes
Scope : local
@@ -362,6 +436,21 @@ Text f3Icon
Text :
Max. Text Size : 4
Events
Touch Press Event
tSend.txt="event,buttonPress2,"+entn3.txt+",button"
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,2
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Text f4Icon
Attributes
Scope : local
@@ -371,6 +460,21 @@ Text f4Icon
Text :
Max. Text Size : 4
Events
Touch Press Event
tSend.txt="event,buttonPress2,"+entn4.txt+",button"
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,2
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Text f5Icon
Attributes
Scope : local
@@ -380,6 +484,21 @@ Text f5Icon
Text :
Max. Text Size : 4
Events
Touch Press Event
tSend.txt="event,buttonPress2,"+entn5.txt+",button"
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,2
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Text m0
Attributes
Scope : local
@@ -718,26 +837,36 @@ Timer tmSerial
//f1Icon Color
spstr strCommand.txt,tTmp.txt,"~",64
covx tTmp.txt,f1Icon.pco,0,0
//f1Icon intNameEntity
spstr strCommand.txt,entn1.txt,"~",62
//f2Icon
spstr strCommand.txt,f2Icon.txt,"~",69
//f2Icon Color
spstr strCommand.txt,tTmp.txt,"~",70
covx tTmp.txt,f2Icon.pco,0,0
//f2Icon intNameEntity
spstr strCommand.txt,entn2.txt,"~",68
//f3Icon
spstr strCommand.txt,f3Icon.txt,"~",75
//f3Icon Color
spstr strCommand.txt,tTmp.txt,"~",76
covx tTmp.txt,f3Icon.pco,0,0
//f3Icon intNameEntity
spstr strCommand.txt,entn3.txt,"~",74
//f4Icon
spstr strCommand.txt,f4Icon.txt,"~",81
//f4Icon Color
spstr strCommand.txt,tTmp.txt,"~",82
covx tTmp.txt,f4Icon.pco,0,0
//f4Icon intNameEntity
spstr strCommand.txt,entn4.txt,"~",80
//f5Icon
spstr strCommand.txt,f5Icon.txt,"~",87
//f5Icon Color
spstr strCommand.txt,tTmp.txt,"~",88
covx tTmp.txt,f5Icon.pco,0,0
//f5Icon intNameEntity
spstr strCommand.txt,entn5.txt,"~",86
}
if(tInstruction.txt=="notify")
{
@@ -841,10 +970,6 @@ Timer tmSerial
{
page cardChart
}
if(tId.txt=="cardLChart")
{
page cardLChart
}
}
if(tInstruction.txt=="timeout")
{

Binary file not shown.

Binary file not shown.

View File

@@ -1,5 +1,5 @@
/*-----------------------------------------------------------------------
TypeScript v4.3.3.37 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @TT-Tom / @ticaki / @Britzelpuf / @Sternmiere / @ravenS0ne
TypeScript v4.3.3.38 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @TT-Tom / @ticaki / @Britzelpuf / @Sternmiere / @ravenS0ne
- abgestimmt auf TFT 53 / v4.3.3 / BerryDriver 9 / Tasmota 13.3.0
@joBr99 Projekt: https://github.com/joBr99/nspanel-lovelace-ui/tree/main/ioBroker
NsPanelTs.ts (dieses TypeScript in ioBroker) Stable: https://github.com/joBr99/nspanel-lovelace-ui/blob/main/ioBroker/NsPanelTs.ts
@@ -98,7 +98,13 @@ ReleaseNotes:
- 09.01.2024 - v4.3.3.36 Fix: schedule SendTime
- 09.01.2024 - v4.3.3.36 Fix: Function _schedule SummerTime/WinterTime
- 15.01.2024 - v4.3.3.37 Change: Allow data points to be flushed for popUpNotify. Activate screensaver with one click.
- 16.01.2024 - v4.3.3.38 Fix: joBr99#1098
- 16.01.2024 - v4.3.3.38 Types: Number of PageItems defined & HandleScreensaverStatusIcons rewritten
- 16.01.2024 - v4.3.3.38 Optimate: function SendTime()
- 17.01.2024 - v4.3.3.38 Add: ScreensaverEntityIconSelect for MRIcons is like common.states for states.
- 17.01.2024 - v4.3.3.38 Add: Changing the ScreensaverEntityValue value updates the screensaver.
- 19.01.2024 - v4.3.3.38 Change: yAxisTicks parameter is not required in cardLChart PageItem
Todo:
- XX.XX.XXXX - v5.0.0 Change the bottomScreensaverEntity (rolling) if more than 6 entries are defined
@@ -964,7 +970,7 @@ export const config: Config = {
// _________________________________ DE: Ab hier keine Konfiguration mehr _____________________________________
// _________________________________ EN: No more configuration from here _____________________________________
const scriptVersion: string = 'v4.3.3.37';
const scriptVersion: string = 'v4.3.3.38';
const tft_version: string = 'v4.3.3';
const desired_display_firmware_version = 53;
const berry_driver_version = 9;
@@ -1045,7 +1051,7 @@ async function CheckConfigParameters() {
const i = n.shift();
if (a === 'mqtt' && !isNaN(Number(i))) {
sendTo(`${a}.${i}`, 'sendMessage2Client', {topic: n.join('/'), message: 'time~12:00'});
sendTo(`${a}.${i}`, 'sendMessage2Client', {topic: n.join('/'), message: buildNSPanelString('time', '12:00')});
await sleep(500);
}
if (await existsObjectAsync(config.panelSendTopic) == false) {
@@ -1428,7 +1434,7 @@ Init_Screensaver_Backckground_Color_Switch();
on({id: NSPanel_Path + 'ScreensaverInfo.bgColorIndicator', change: "ne"}, async function (obj) {
try {
bgColorScrSaver = obj.state.val;
if (bgColorScrSaver < 4) {
if (bgColorScrSaver < 6) {
HandleScreensaverUpdate();
}
} catch (err: any) {
@@ -1784,9 +1790,11 @@ on({id: [String(NSPanel_Path) + 'Relay.1',String(NSPanel_Path) + 'Relay.2'], cha
async function SubscribeMRIcons () {
try {
if (config.mrIcon1ScreensaverEntity.ScreensaverEntity != null) {
on({id: config.mrIcon1ScreensaverEntity.ScreensaverEntity, change: "ne"}, async function (obj) {
if (obj.id!.substring(0,4) == 'mqtt') {
let arr = config.mrIcon1ScreensaverEntity.ScreensaverEntity != null ? [config.mrIcon1ScreensaverEntity.ScreensaverEntity] : [];
arr = config.mrIcon1ScreensaverEntity.ScreensaverEntityValue != null ? [...arr, config.mrIcon1ScreensaverEntity.ScreensaverEntityValue] : arr;
if (arr.length > 0) {
on({id: arr, change: "ne"}, async function (obj) {
if (obj.id!.substring(0,4) == 'mqtt') {
let Button = obj.id!.split('.');
if (getState(NSPanel_Path + 'Relay.' + Button[Button.length - 1].substring(5,6)).val != obj.state.val) {
await setStateAsync(NSPanel_Path + 'Relay.' + Button[Button.length - 1].substring(5,6), obj.state.val == 'ON' ? true : false);
@@ -1796,8 +1804,10 @@ async function SubscribeMRIcons () {
}
});
}
if (config.mrIcon2ScreensaverEntity.ScreensaverEntity != null) {
on({id: config.mrIcon2ScreensaverEntity.ScreensaverEntity, change: "ne"}, async function (obj) {
arr = config.mrIcon2ScreensaverEntity.ScreensaverEntity != null ? [config.mrIcon2ScreensaverEntity.ScreensaverEntity] : [];
arr = config.mrIcon2ScreensaverEntity.ScreensaverEntityValue != null ? [...arr, config.mrIcon2ScreensaverEntity.ScreensaverEntityValue] : arr;
if (arr.length > 0) {
on({id: arr, change: "ne"}, async function (obj) {
if (obj.id!.substring(0,4) == 'mqtt') {
let Button = obj.id!.split('.');
if (getState(NSPanel_Path + 'Relay.' + Button[Button.length - 1].substring(5,6)).val != obj.state.val) {
@@ -3053,7 +3063,7 @@ on({ id: NSPanel_Alarm_Path + 'Alarm.AlarmState', change: 'ne' }, async (obj) =>
}
});
function HandleMessage(typ: string, method: NSPanel.EventMethod, page: number | undefined, words: Array<string> | undefined): void {
function HandleMessage(typ: string, method: NSPanel.EventMethod, page: number | undefined, words: string[] | undefined): void {
try {
if (typ == 'event') {
switch (method as NSPanel.EventMethod) {
@@ -3154,9 +3164,9 @@ function findPageItem(searching: String): PageItem {
function GeneratePage(page: PageType): void {
try {
activePage = page;
setIfExists(NSPanel_Path + 'ActivePage.type', activePage!.type);
setIfExists(NSPanel_Path + 'ActivePage.heading', activePage!.heading);
setIfExists(NSPanel_Path + 'ActivePage.id0', activePage!.items[0].id);
setIfExists(NSPanel_Path + 'ActivePage.type', activePage.type);
setIfExists(NSPanel_Path + 'ActivePage.heading', activePage.heading);
setIfExists(NSPanel_Path + 'ActivePage.id0', activePage.items[0] !== undefined ? activePage.items[0].id : '');
switch (page.type) {
case 'cardEntities':
SendToPanel(GenerateEntitiesPage(page));
@@ -3258,7 +3268,7 @@ function SendDate(): void {
const options: any = { weekday: dpWeekday, year: 'numeric', month: dpMonth, day: 'numeric' };
const _SendDate = dpCustomFormat != '' ? dayjs().format(dpCustomFormat) : date.toLocaleDateString(getState(NSPanel_Path + 'Config.locale').val, options);
SendToPanel(<NSPanel.Payload>{ payload: 'date~' + _SendDate });
SendToPanel({ payload: 'date~' + _SendDate });
}
} catch (err: any) {
if (err.message = 'Cannot convert undefined or null to object') {
@@ -3271,11 +3281,12 @@ function SendDate(): void {
function SendTime(): void {
try {
const d = new Date();
/*const d = new Date();
const hr = (d.getHours() < 10 ? '0' : '') + d.getHours();
const min = (d.getMinutes() < 10 ? '0' : '') + d.getMinutes();
SendToPanel(<NSPanel.Payload>{ payload: 'time~' + hr + ':' + min });
SendToPanel({ payload: 'time~' + hr + ':' + min });*/
SendToPanel({ payload: `time~${new Date().toLocaleTimeString('de-DE', { hour: "2-digit", minute: "2-digit" })}`, });
} catch (err: any) {
log('error at function SendTime: ' + err.message, 'warn');
}
@@ -3283,7 +3294,7 @@ function SendTime(): void {
function GenerateEntitiesPage(page: NSPanel.PageEntities): NSPanel.Payload[] {
try {
let out_msgs: Array<NSPanel.Payload>;
let out_msgs: NSPanel.Payload[];
out_msgs = [{ payload: 'pageType~cardEntities' }]
out_msgs.push({ payload: GeneratePageElements(page) });
return out_msgs
@@ -3295,7 +3306,7 @@ function GenerateEntitiesPage(page: NSPanel.PageEntities): NSPanel.Payload[] {
function GenerateGridPage(page: NSPanel.PageGrid): NSPanel.Payload[] {
try {
let out_msgs: Array<NSPanel.Payload> = [{ payload: 'pageType~cardGrid' }];
let out_msgs: NSPanel.Payload[] = [{ payload: 'pageType~cardGrid' }];
out_msgs.push({ payload: GeneratePageElements(page) });
return out_msgs;
} catch (err: any) {
@@ -3306,7 +3317,7 @@ function GenerateGridPage(page: NSPanel.PageGrid): NSPanel.Payload[] {
function GenerateGridPage2(page: NSPanel.PageGrid2): NSPanel.Payload[] {
try {
let out_msgs: Array<NSPanel.Payload> = [{ payload: 'pageType~cardGrid2' }];
let out_msgs: NSPanel.Payload[] = [{ payload: 'pageType~cardGrid2' }];
out_msgs.push({ payload: GeneratePageElements(page) });
return out_msgs;
} catch (err: any) {
@@ -4314,7 +4325,7 @@ function GenerateThermoPage(page: NSPanel.PageThermo): NSPanel.Payload[] {
try {
UnsubscribeWatcher();
let id = page.items[0].id
let out_msgs: Array<NSPanel.Payload> = [];
let out_msgs: NSPanel.Payload[] = [];
out_msgs.push({ payload: 'pageType~cardThermo' });
// ioBroker
@@ -4695,8 +4706,9 @@ function GenerateThermoPage(page: NSPanel.PageThermo): NSPanel.Payload[] {
function unsubscribeMediaSubscriptions(): void {
for (let i = 0; i < config.pages.length; i++) {
if (config.pages[i].type == 'cardMedia') {
let mediaID = config.pages[i].items[0].id;
const page: NSPanel.PageType = config.pages[i];
if (isPageMedia(page)) {
let mediaID = page.items[0].id;
unsubscribe(mediaID + '.STATE');
unsubscribe(mediaID + '.ARTIST');
unsubscribe(mediaID + '.TITLE');
@@ -4710,8 +4722,9 @@ function unsubscribeMediaSubscriptions(): void {
}
}
for (let i = 0; i < config.subPages.length; i++) {
if (config.subPages[i].type == 'cardMedia') {
let mediaID = config.subPages[i].items[0].id;
const page: NSPanel.PageType = config.subPages[i];
if (isPageMedia(page)) {
let mediaID = page.items[0].id;
unsubscribe(mediaID + '.STATE');
unsubscribe(mediaID + '.ARTIST');
unsubscribe(mediaID + '.TITLE');
@@ -5050,7 +5063,7 @@ function GenerateMediaPage(page: NSPanel.PageMedia): NSPanel.Payload[] {
if (!page.items[0].id) throw new Error ('Missing page id for cardMedia!');
let id = page.items[0].id;
let out_msgs: Array<NSPanel.Payload> = [];
let out_msgs: NSPanel.Payload[] = [];
if (!page.items[0].adapterPlayerInstance!) throw new Error('page.items[0].adapterPlayerInstance is undefined!')
let vInstance = page.items[0].adapterPlayerInstance!;
@@ -5338,7 +5351,7 @@ function GenerateMediaPage(page: NSPanel.PageMedia): NSPanel.Payload[] {
//-------------------------------------------------------------------------------------------------------------
// All Alexa devices (the online / player and commands directory is available) are listed and linked below
// If the constant alexaSpeakerList contains at least one entry, the constant is used - otherwise all devices from the Alexa adapter
let speakerListArray: Array<string> = [];
let speakerListArray: string[] = [];
if (page.items[0].speakerList && page.items[0].speakerList.length > 0) {
for (let i_index in page.items[0].speakerList) {
speakerListArray.push(page.items[0].speakerList[i_index]);
@@ -5669,7 +5682,7 @@ function GenerateAlarmPage(page: NSPanel.PageAlarm): NSPanel.Payload[] {
let id = page.items[0].id
let name = page.heading;
let out_msgs: Array<NSPanel.Payload> = [];
let out_msgs: NSPanel.Payload[] = [];
out_msgs.push({ payload: 'pageType~cardAlarm' });
let nsPath = NSPanel_Alarm_Path + 'Alarm';
@@ -5827,7 +5840,7 @@ function GenerateUnlockPage(page: NSPanel.PageUnlock): NSPanel.Payload[] {
let id = page.items[0].id
let name = page.heading;
let out_msgs: Array<NSPanel.Payload> = [];
let out_msgs: NSPanel.Payload[] = [];
out_msgs.push({ payload: 'pageType~cardAlarm' });
let dpPath : string = ''
@@ -5908,7 +5921,7 @@ function GenerateQRPage(page: NSPanel.PageQR): NSPanel.Payload[] {
activePage = page;
if (!page.items[0].id) throw new Error ('Missing pageItem.id for cardQRPage!');
let id = page.items[0].id;
let out_msgs: Array<NSPanel.Payload> = [];
let out_msgs: NSPanel.Payload[] = [];
out_msgs.push({ payload: 'pageType~cardQR' });
let dpPath : string = ''
@@ -5998,14 +6011,16 @@ function GenerateQRPage(page: NSPanel.PageQR): NSPanel.Payload[] {
function unsubscribePowerSubscriptions(): void {
for (let i = 0; i < config.pages.length; i++) {
if (config.pages[i].type == 'cardPower') {
let powerID = config.pages[i].items[0].id;
const page: NSPanel.PageType = config.pages[i];
if (isPagePower(page)) {
let powerID = page.items[0].id;
unsubscribe(powerID + '.ACTUAL');
}
}
for (let i = 0; i < config.subPages.length; i++) {
if (config.subPages[i].type == 'cardPower') {
let powerID = config.subPages[i].items[0].id;
const page: NSPanel.PageType = config.subPages[i];
if (isPagePower(page)) {
let powerID = page.items[0].id;
unsubscribe(powerID + '.ACTUAL');
}
}
@@ -6049,7 +6064,7 @@ function GeneratePowerPage(page: NSPanel.PagePower): NSPanel.Payload[] {
obj = JSON.parse((getState(page.items[0].id + '.ACTUAL').val));
}
let out_msgs: Array<NSPanel.Payload> = [];
let out_msgs: NSPanel.Payload[] = [];
// Leave the display on if the alwaysOnDisplay parameter is specified (true)
if (page.type == 'cardPower' && pageCounter == 0 && page.items[0].alwaysOnDisplay != undefined) {
@@ -6143,26 +6158,52 @@ function GeneratePowerPage(page: NSPanel.PagePower): NSPanel.Payload[] {
}
}
const timeValueRegEx = /\~\d+:(\d+)/g;
function GenerateChartPage(page: NSPanel.PageChart): NSPanel.Payload[] {
try {
activePage = page;
let id = page.items[0].id;
let out_msgs: Array<NSPanel.Payload> = [];
let out_msgs: NSPanel.Payload[] = [];
out_msgs.push({ payload: 'pageType~' + page.type });
let heading = page.heading !== undefined ? page.heading : "Chart...";
let txt = getState(id + '.ACTUAL').val;
if (!page.items[0].yAxisTicks) {
throw new Error (`Page item ${id} yAxisTicks is undefined!`)
const txt = getState(id + '.ACTUAL')?.val;
if (!txt) {
throw new Error(`Unable to get the state of ${id}.ACTUAL`)
}
let yAxisTicks : number[] = [];
if (!page.items[0].yAxisTicks) {
const sorted = [...txt.matchAll(timeValueRegEx)].map(x => Number(x[1])).sort((x, y) => x < y ? -1 : 1);
if (sorted.length === 0) {
throw new Error (`Page item ${id} yAxisTicks is undefined and unable to be calculated!`)
}
const minValue = sorted[0];
const maxValue = sorted[sorted.length - 1];
const tick = Math.max(Number(((maxValue - minValue) / 5).toFixed()), 10);
let currentTick = minValue - tick;
while(currentTick < (maxValue + tick)) {
yAxisTicks.push(currentTick);
currentTick += tick;
}
if (Debug) {
log(`Calculated yAxisTicks for ${id} (Min: ${minValue}, Max: ${maxValue}, Tick: ${tick}): ${yAxisTicks}`);
}
} else {
yAxisTicks = typeof page.items[0].yAxisTicks === 'string'
? JSON.parse(getState(page.items[0].yAxisTicks).val)
: page.items[0].yAxisTicks;
}
if (!page.items[0].onColor) {
throw new Error (`Page item ${id} onColor is undefined!`)
}
let yAxisTicks = (typeof page.items[0].yAxisTicks == 'object') ? page.items[0].yAxisTicks : JSON.parse(getState(page.items[0].yAxisTicks).val);
out_msgs.push({
payload: 'entityUpd~' + //entityUpd
heading + '~' + //heading
@@ -6175,7 +6216,6 @@ function GenerateChartPage(page: NSPanel.PageChart): NSPanel.Payload[] {
if (Debug) log('GenerateChartPage payload: ' + JSON.stringify(out_msgs), 'info');
return out_msgs;
} catch (err: any) {
log('error at function GenerateChartPage: ' + err.message, 'warn');
return [];
@@ -7412,7 +7452,7 @@ function GetNavigationString(pageId: number): string {
function GenerateDetailPage(type: NSPanel.PopupType, optional: NSPanel.mediaOptional | undefined, pageItem: PageItem, placeId: number | undefined): NSPanel.Payload[] {
if (Debug) log('GenerateDetailPage Übergabe Type: ' + type + ' - optional: ' + optional + ' - pageItem.id: ' + pageItem.id, 'info');
try {
let out_msgs: Array<NSPanel.Payload> = [];
let out_msgs: NSPanel.Payload[] = [];
let id = pageItem.id;
if (id && existsObject(id)) {
@@ -8214,7 +8254,7 @@ function GenerateDetailPage(type: NSPanel.PopupType, optional: NSPanel.mediaOpti
// Playlist browsing not supported by squeezeboxrpc adapter. But Favorites can be used
actualState = ''; // Not supported by squeezeboxrpc adapter
let tempPlayList: string[] = [];
let pathParts: Array<string> = pageItem.adapterPlayerInstance!.split('.');
let pathParts: string[] = pageItem.adapterPlayerInstance!.split('.');
for (let favorite_index = 0; favorite_index < 45; favorite_index++) {
let favorite_name_selector: string = [pathParts[0], pathParts[1], 'Favorites', favorite_index, 'Name'].join('.');
if (!existsObject(favorite_name_selector)) {
@@ -8816,7 +8856,7 @@ function HandleScreensaverUpdate(): void {
}
if (Debug) log('HandleScreensaverUpdate payload: weatherUpdate~' + payloadString, 'info');
SendToPanel(<NSPanel.Payload>{ payload: 'weatherUpdate~' + payloadString });
SendToPanel({ payload: 'weatherUpdate~' + payloadString });
HandleScreensaverStatusIcons();
}
@@ -8843,162 +8883,133 @@ function RegisterScreensaverEntityWatcher(id: string): void {
function HandleScreensaverStatusIcons() : void {
try {
let payloadString = '';
let hwBtn1Col: any = config.mrIcon1ScreensaverEntity.ScreensaverEntityOffColor;
if (config.mrIcon1ScreensaverEntity.ScreensaverEntity != null) {
// Prüfung ob ScreensaverEntity vom Typ String ist
if (typeof (getState(config.mrIcon1ScreensaverEntity.ScreensaverEntity).val) == 'string') {
if (Debug) log('Entity ist String', 'info')
let hwBtn1: string = getState(config.mrIcon1ScreensaverEntity.ScreensaverEntity).val;
if (hwBtn1 == 'ON') {
hwBtn1Col = config.mrIcon1ScreensaverEntity.ScreensaverEntityOnColor;
const iconData: Record<'mrIcon1' | 'mrIcon2', NSPanel.ScreenSaverMRDataElement> = {
mrIcon1: {
ScreensaverEntity: config.mrIcon1ScreensaverEntity.ScreensaverEntity != null
&& existsState(config.mrIcon1ScreensaverEntity.ScreensaverEntity)
? getState(config.mrIcon1ScreensaverEntity.ScreensaverEntity).val
: null,
ScreensaverEntityIconOn: config.mrIcon1ScreensaverEntity.ScreensaverEntityIconOn
? Icons.GetIcon(config.mrIcon1ScreensaverEntity.ScreensaverEntityIconOn)
: '',
ScreensaverEntityIconOff: config.mrIcon1ScreensaverEntity.ScreensaverEntityIconOff
? Icons.GetIcon(config.mrIcon1ScreensaverEntity.ScreensaverEntityIconOff)
: '',
ScreensaverEntityOnColor: config.mrIcon1ScreensaverEntity.ScreensaverEntityOnColor,
ScreensaverEntityOffColor: config.mrIcon1ScreensaverEntity.ScreensaverEntityOffColor,
ScreensaverEntityValue: config.mrIcon1ScreensaverEntity.ScreensaverEntityValue === null
? null
: getState(config.mrIcon1ScreensaverEntity.ScreensaverEntityValue).val,
ScreensaverEntityValueDecimalPlace: config.mrIcon1ScreensaverEntity.ScreensaverEntityValueDecimalPlace,
ScreensaverEntityValueUnit: config.mrIcon1ScreensaverEntity.ScreensaverEntityValueUnit,
ScreensaverEntityIconSelect: config.mrIcon1ScreensaverEntity.ScreensaverEntityIconSelect
&& typeof config.mrIcon1ScreensaverEntity.ScreensaverEntityIconSelect === 'object'
? config.mrIcon1ScreensaverEntity.ScreensaverEntityIconSelect
: null,
},
mrIcon2: {
ScreensaverEntity: config.mrIcon2ScreensaverEntity.ScreensaverEntity != null
&& existsState(config.mrIcon2ScreensaverEntity.ScreensaverEntity)
? getState(config.mrIcon2ScreensaverEntity.ScreensaverEntity).val
: null,
ScreensaverEntityIconOn: config.mrIcon2ScreensaverEntity.ScreensaverEntityIconOn
? Icons.GetIcon(config.mrIcon2ScreensaverEntity.ScreensaverEntityIconOn)
: '',
ScreensaverEntityIconOff: config.mrIcon2ScreensaverEntity.ScreensaverEntityIconOff
? Icons.GetIcon(config.mrIcon2ScreensaverEntity.ScreensaverEntityIconOff)
: '',
ScreensaverEntityOnColor: config.mrIcon2ScreensaverEntity.ScreensaverEntityOnColor,
ScreensaverEntityOffColor: config.mrIcon2ScreensaverEntity.ScreensaverEntityOffColor,
ScreensaverEntityValue: config.mrIcon2ScreensaverEntity.ScreensaverEntityValue === null
? null
: getState(config.mrIcon2ScreensaverEntity.ScreensaverEntityValue).val,
ScreensaverEntityValueDecimalPlace: config.mrIcon2ScreensaverEntity.ScreensaverEntityValueDecimalPlace,
ScreensaverEntityValueUnit: config.mrIcon2ScreensaverEntity.ScreensaverEntityValueUnit,
ScreensaverEntityIconSelect: config.mrIcon2ScreensaverEntity.ScreensaverEntityIconSelect
&& typeof config.mrIcon2ScreensaverEntity.ScreensaverEntityIconSelect === 'object'
? config.mrIcon2ScreensaverEntity.ScreensaverEntityIconSelect
: null,
}
}
for (const a in iconData) {
if (iconData[a].ScreensaverEntityValue !== null) {
switch (typeof iconData[a].ScreensaverEntityValue) {
case "string":
if (iconData[a].ScreensaverEntityValue === '' || isNaN(iconData[a].ScreensaverEntityValue)) break;
case "number":
case "bigint":
iconData[a].ScreensaverEntityValue = Number(iconData[a].ScreensaverEntityValue).toFixed(iconData[a].ScreensaverEntityValueDecimalPlace);
break;
case "boolean":
break;
case "symbol":
case "undefined":
case "object":
case "function":
iconData[a].ScreensaverEntityValue = null;
}
}
let hwBtn1Col: RGB = iconData[a].ScreensaverEntityOffColor;
if (iconData[a].ScreensaverEntity != null || iconData[a].ScreensaverEntityValue != null) {
// Prüfung ob ScreensaverEntity vom Typ String ist
if (iconData[a].ScreensaverEntity != null) {
if (typeof (iconData[a].ScreensaverEntity) == 'string') {
if (Debug) log('Entity ist String', 'info')
switch (String(iconData[a].ScreensaverEntity).toUpperCase()) {
case 'ON':
case 'OK':
case 'AN':
case 'YES':
case 'TRUE':
case 'ONLINE':
hwBtn1Col = iconData[a].ScreensaverEntityOnColor;
break;
default:
}
if (Debug) log('Value: ' + iconData[a].ScreensaverEntity + ' Color: ' + JSON.stringify(hwBtn1Col), 'info')
// Alles was kein String ist in Boolean umwandeln
} else {
if (Debug) log('Entity ist kein String', 'info')
if (!!iconData[a].ScreensaverEntity) {
hwBtn1Col = iconData[a].ScreensaverEntityOnColor;
}
}
}
if (Debug) log('Value: ' + hwBtn1 + ' Color: ' + JSON.stringify(hwBtn1Col), 'info')
// Icon ermitteln
if (getState(config.mrIcon1ScreensaverEntity.ScreensaverEntity).val) {
payloadString += Icons.GetIcon(config.mrIcon1ScreensaverEntity.ScreensaverEntityIconOn);
if (iconData[a].ScreensaverEntityIconSelect && iconData[a].ScreensaverEntity != null) {
const icon = iconData[a].ScreensaverEntityIconSelect[iconData[a].ScreensaverEntity];
if (icon !== undefined) {
payloadString += Icons.GetIcon(icon);
if (Debug) log('SelectIcon: '+payloadString, 'info')
}
} else if (iconData[a].ScreensaverEntity) {
payloadString += iconData[a].ScreensaverEntityIconOn;
if (Debug) log('Icon if true '+payloadString, 'info')
} else {
if (config.mrIcon1ScreensaverEntity.ScreensaverEntityIconOff != null) {
payloadString += Icons.GetIcon(config.mrIcon1ScreensaverEntity.ScreensaverEntityIconOff);
if (Debug) log('Icon else true '+payloadString, 'info')
if (iconData[a].ScreensaverEntityIconOff) {
payloadString += iconData[a].ScreensaverEntityIconOff;
if (Debug) log('Icon1 else true '+payloadString, 'info')
} else {
payloadString += Icons.GetIcon(config.mrIcon1ScreensaverEntity.ScreensaverEntityIconOn);
if (Debug) log('Icon else false '+payloadString, 'info')
payloadString += iconData[a].ScreensaverEntityIconOn;
if (Debug) log('Icon1 else false '+payloadString, 'info')
}
}
if (config.mrIcon1ScreensaverEntity.ScreensaverEntityValue != null) {
if (isNaN(getState(config.mrIcon1ScreensaverEntity.ScreensaverEntityValue).val) == false) {
payloadString += (getState(config.mrIcon1ScreensaverEntity.ScreensaverEntityValue).val).toFixed(config.mrIcon1ScreensaverEntity.ScreensaverEntityValueDecimalPlace);
payloadString += (config.mrIcon1ScreensaverEntity.ScreensaverEntityValueUnit == null) ? '' : config.mrIcon1ScreensaverEntity.ScreensaverEntityValueUnit;
if (Debug) log('Value ist eine Zahl ' + payloadString, 'info')
} else {
payloadString += getState(config.mrIcon1ScreensaverEntity.ScreensaverEntityValue).val
if (Debug) log('Value ist keine Zahl ' + payloadString, 'info')
}
}
payloadString += '~' + rgb_dec565(hwBtn1Col) + '~';
} else if (typeof (getState(config.mrIcon1ScreensaverEntity.ScreensaverEntity).val) == 'boolean') {
let hwBtn1: boolean = getState(config.mrIcon1ScreensaverEntity.ScreensaverEntity).val;
if (hwBtn1) {
hwBtn1Col = config.mrIcon1ScreensaverEntity.ScreensaverEntityOnColor;
}
if (getState(config.mrIcon1ScreensaverEntity.ScreensaverEntity).val) {
payloadString += Icons.GetIcon(config.mrIcon1ScreensaverEntity.ScreensaverEntityIconOn);
} else {
if (config.mrIcon1ScreensaverEntity.ScreensaverEntityIconOff != null) {
payloadString += Icons.GetIcon(config.mrIcon1ScreensaverEntity.ScreensaverEntityIconOff);
} else {
payloadString += Icons.GetIcon(config.mrIcon1ScreensaverEntity.ScreensaverEntityIconOn);
}
}
if (config.mrIcon1ScreensaverEntity.ScreensaverEntityValue != null) {
if (isNaN(getState(config.mrIcon1ScreensaverEntity.ScreensaverEntityValue).val) == false) {
payloadString += (getState(config.mrIcon1ScreensaverEntity.ScreensaverEntityValue).val).toFixed(config.mrIcon1ScreensaverEntity.ScreensaverEntityValueDecimalPlace);
payloadString += (config.mrIcon1ScreensaverEntity.ScreensaverEntityValueUnit == null) ? '' : config.mrIcon1ScreensaverEntity.ScreensaverEntityValueUnit;
} else {
payloadString += getState(config.mrIcon1ScreensaverEntity.ScreensaverEntityValue).val
}
}
if (iconData[a].ScreensaverEntityValue != null) {
payloadString += iconData[a].ScreensaverEntityValue;
payloadString += (iconData[a].ScreensaverEntityValueUnit == null) ? '' : iconData[a].ScreensaverEntityValueUnit;
}
payloadString += '~' + rgb_dec565(hwBtn1Col) + '~';
} else {
hwBtn1Col = Black;
payloadString += '~~';
}
} else if (config.mrIcon1ScreensaverEntity.ScreensaverEntity == null && config.mrIcon1ScreensaverEntity.ScreensaverEntityValue != null){
if(config.mrIcon1ScreensaverEntity.ScreensaverEntityOnColor != null){
hwBtn1Col = config.mrIcon1ScreensaverEntity.ScreensaverEntityOnColor;
}
if(config.mrIcon1ScreensaverEntity.ScreensaverEntityIconOn != null){
payloadString += Icons.GetIcon(config.mrIcon1ScreensaverEntity.ScreensaverEntityIconOn);
}
if (config.mrIcon1ScreensaverEntity.ScreensaverEntityValue != null) {
if (isNaN(getState(config.mrIcon1ScreensaverEntity.ScreensaverEntityValue).val) == false) {
payloadString += (getState(config.mrIcon1ScreensaverEntity.ScreensaverEntityValue).val).toFixed(config.mrIcon1ScreensaverEntity.ScreensaverEntityValueDecimalPlace);
payloadString += (config.mrIcon1ScreensaverEntity.ScreensaverEntityValueUnit == null) ? '' : config.mrIcon1ScreensaverEntity.ScreensaverEntityValueUnit;
} else {
payloadString += getState(config.mrIcon1ScreensaverEntity.ScreensaverEntityValue).val
}
}
payloadString += '~' + rgb_dec565(hwBtn1Col) + '~';
}
else {
hwBtn1Col = Black;
payloadString += '~~';
}
let hwBtn2Col: any = config.mrIcon2ScreensaverEntity.ScreensaverEntityOffColor;
if (config.mrIcon2ScreensaverEntity.ScreensaverEntity != null) {
if (typeof (getState(config.mrIcon2ScreensaverEntity.ScreensaverEntity).val) == 'string') {
let hwBtn2: string = getState(config.mrIcon2ScreensaverEntity.ScreensaverEntity).val;
if (hwBtn2 == 'ON') {
hwBtn2Col = config.mrIcon2ScreensaverEntity.ScreensaverEntityOnColor;
}
if (getState(config.mrIcon2ScreensaverEntity.ScreensaverEntity).val) {
payloadString += Icons.GetIcon(config.mrIcon2ScreensaverEntity.ScreensaverEntityIconOn);
} else {
if (config.mrIcon2ScreensaverEntity.ScreensaverEntityIconOff != null) {
payloadString += Icons.GetIcon(config.mrIcon2ScreensaverEntity.ScreensaverEntityIconOff);
} else {
payloadString += Icons.GetIcon(config.mrIcon2ScreensaverEntity.ScreensaverEntityIconOn);
}
}
if (config.mrIcon2ScreensaverEntity.ScreensaverEntityValue != null) {
if (isNaN(getState(config.mrIcon2ScreensaverEntity.ScreensaverEntityValue).val) == false) {
payloadString += (getState(config.mrIcon2ScreensaverEntity.ScreensaverEntityValue).val).toFixed(config.mrIcon2ScreensaverEntity.ScreensaverEntityValueDecimalPlace);
payloadString += (config.mrIcon2ScreensaverEntity.ScreensaverEntityValueUnit == null) ? '' : config.mrIcon2ScreensaverEntity.ScreensaverEntityValueUnit;
} else {
payloadString += getState(config.mrIcon2ScreensaverEntity.ScreensaverEntityValue).val
}
}
payloadString += '~' + rgb_dec565(hwBtn2Col) + '~';
} else if (typeof (getState(config.mrIcon2ScreensaverEntity.ScreensaverEntity).val) == 'boolean') {
let hwBtn2: boolean = getState(config.mrIcon2ScreensaverEntity.ScreensaverEntity).val;
if (hwBtn2) {
hwBtn2Col = config.mrIcon2ScreensaverEntity.ScreensaverEntityOnColor;
}
if (getState(config.mrIcon2ScreensaverEntity.ScreensaverEntity).val) {
payloadString += Icons.GetIcon(config.mrIcon2ScreensaverEntity.ScreensaverEntityIconOn);
} else {
if (config.mrIcon2ScreensaverEntity.ScreensaverEntityIconOff != null) {
payloadString += Icons.GetIcon(config.mrIcon2ScreensaverEntity.ScreensaverEntityIconOff);
} else {
payloadString += Icons.GetIcon(config.mrIcon2ScreensaverEntity.ScreensaverEntityIconOn);
}
}
if (config.mrIcon2ScreensaverEntity.ScreensaverEntityValue != null) {
if (isNaN(getState(config.mrIcon2ScreensaverEntity.ScreensaverEntityValue).val) == false) {
payloadString += (getState(config.mrIcon2ScreensaverEntity.ScreensaverEntityValue).val).toFixed(config.mrIcon2ScreensaverEntity.ScreensaverEntityValueDecimalPlace);
payloadString += (config.mrIcon2ScreensaverEntity.ScreensaverEntityValueUnit == null) ? '' : config.mrIcon2ScreensaverEntity.ScreensaverEntityValueUnit;
} else {
payloadString += getState(config.mrIcon2ScreensaverEntity.ScreensaverEntityValue).val
}
}
payloadString += '~' + rgb_dec565(hwBtn2Col) + '~';
}
} else if (config.mrIcon2ScreensaverEntity.ScreensaverEntity == null && config.mrIcon2ScreensaverEntity.ScreensaverEntityValue != null){
if(config.mrIcon2ScreensaverEntity.ScreensaverEntityOnColor != null){
hwBtn2Col = config.mrIcon2ScreensaverEntity.ScreensaverEntityOnColor;
}
if(config.mrIcon2ScreensaverEntity.ScreensaverEntityIconOn != null){
payloadString += Icons.GetIcon(config.mrIcon2ScreensaverEntity.ScreensaverEntityIconOn);
}
if (config.mrIcon2ScreensaverEntity.ScreensaverEntityValue != null) {
if (isNaN(getState(config.mrIcon2ScreensaverEntity.ScreensaverEntityValue).val) == false) {
payloadString += (getState(config.mrIcon2ScreensaverEntity.ScreensaverEntityValue).val).toFixed(config.mrIcon2ScreensaverEntity.ScreensaverEntityValueDecimalPlace);
payloadString += (config.mrIcon2ScreensaverEntity.ScreensaverEntityValueUnit == null) ? '' : config.mrIcon2ScreensaverEntity.ScreensaverEntityValueUnit;
} else {
payloadString += getState(config.mrIcon2ScreensaverEntity.ScreensaverEntityValue).val
}
}
payloadString += '~' + rgb_dec565(hwBtn2Col) + '~';
} else {
hwBtn2Col = Black;
payloadString += '~~';
}
let alternateScreensaverMFRIcon1Size = getState(NSPanel_Path + 'Config.MRIcons.alternateMRIconSize.1').val
let alternateScreensaverMFRIcon2Size = getState(NSPanel_Path + 'Config.MRIcons.alternateMRIconSize.2').val
//Alternate MRIcon Size
@@ -9013,7 +9024,7 @@ function HandleScreensaverStatusIcons() : void {
payloadString += '~';
}
SendToPanel(<NSPanel.Payload>{ payload: 'statusUpdate~' + payloadString });
SendToPanel({ payload: 'statusUpdate~' + payloadString });
} catch (err: any) {
log('error at function HandleScreensaverStatusIcons: ' + err.message, 'warn');
@@ -9090,25 +9101,27 @@ function HandleScreensaverColors(): void {
scrSvrBGCol = rgb_dec565({ red: 100, green: 0, blue: 0 });
}
let payloadString = 'color' + '~' +
scrSvrBGCol + '~' + //background
rgb_dec565(sctime) + '~' + //time
rgb_dec565(sctimeAMPM) + '~' + //timeAMPM~
rgb_dec565(scdate) + '~' + //date~
rgb_dec565(sctMainText) + '~' + //tMainText~
rgb_dec565(sctForecast1) + '~' + //tForecast1~
rgb_dec565(sctForecast2) + '~' + //tForecast2~
rgb_dec565(sctForecast3) + '~' + //tForecast3~
rgb_dec565(sctForecast4) + '~' + //tForecast4~
rgb_dec565(sctForecast1Val) + '~' + //tForecast1Val~
rgb_dec565(sctForecast2Val) + '~' + //tForecast2Val~
rgb_dec565(sctForecast3Val) + '~' + //tForecast3Val~
rgb_dec565(sctForecast4Val) + '~' + //tForecast4Val~
rgb_dec565(scbar) + '~' + //bar~
rgb_dec565(sctMainTextAlt) + '~' + //tMainTextAlt
rgb_dec565(sctTimeAdd); //tTimeAdd
let payloadString = buildNSPanelString(
'color' ,
scrSvrBGCol , //background
rgb_dec565(sctime) , //time
rgb_dec565(sctimeAMPM) , //timeAMPM~
rgb_dec565(scdate) , //date~
rgb_dec565(sctMainText) , //tMainText~
rgb_dec565(sctForecast1) , //tForecast1~
rgb_dec565(sctForecast2) , //tForecast2~
rgb_dec565(sctForecast3) , //tForecast3~
rgb_dec565(sctForecast4) , //tForecast4~
rgb_dec565(sctForecast1Val) , //tForecast1Val~
rgb_dec565(sctForecast2Val) , //tForecast2Val~
rgb_dec565(sctForecast3Val) , //tForecast3Val~
rgb_dec565(sctForecast4Val) , //tForecast4Val~
rgb_dec565(scbar) , //bar~
rgb_dec565(sctMainTextAlt) , //tMainTextAlt
rgb_dec565(sctTimeAdd) //tTimeAdd
);
SendToPanel(<NSPanel.Payload>{ payload: payloadString });
SendToPanel({ payload: payloadString });
} catch (err: any) {
log('error at function HandleScreensaverColors: '+ err.message, 'warn');
}
@@ -9542,7 +9555,7 @@ function Interpolate(color1: RGB, color2: RGB, fraction: number): RGB {
let r: number = InterpolateNum(color1.red, color2.red, fraction);
let g: number = InterpolateNum(color1.green, color2.green, fraction);
let b: number = InterpolateNum(color1.blue, color2.blue, fraction);
return <RGB>{ red: Math.round(r), green: Math.round(g), blue: Math.round(b) };
return { red: Math.round(r), green: Math.round(g), blue: Math.round(b) };
}
function InterpolateNum(d1: number, d2: number, fraction: number): number {
@@ -9679,6 +9692,14 @@ function spotifyGetDeviceID(vDeviceString: string): string {
let strDevID = arrayDeviceListIds[indexPos];
return strDevID;
}
/**
* Join arguments with ~ and return the string;
* @param tokens unlimited numbers of strings
* @returns
*/
function buildNSPanelString(...tokens: (string|number)[]): string {
return tokens.join('~');
}
type RGB = NSPanel.RGB;
type PageItem = NSPanel.PageItem;
@@ -9810,12 +9831,24 @@ function isPageThermoItem(F: PageItem | NSPanel.PageThermoItem):F is NSPanel.Pag
return 'popupThermoMode1' in F;
}
function isPageMedia(F: NSPanel.PageType | NSPanel.PageMedia):F is NSPanel.PageMedia {
return F.type == 'cardMedia';
}
function isPagePower(F: NSPanel.PageType | NSPanel.PagePower):F is NSPanel.PagePower {
return F.type == 'cardPower';
}
namespace NSPanel {
export type PopupType = 'popupFan' | 'popupInSel' | 'popupLight' | 'popupLightNew' | 'popupNotify' | 'popupShutter' | 'popupThermo' | 'popupTimer'
export type EventMethod = 'startup' | 'sleepReached' | 'pageOpenDetail' | 'buttonPress2' | 'renderCurrentPage' | 'button1' | 'button2'
export type panelRecvType = {
event: 'event';
method: EventMethod
}
export type SerialType = 'button' | 'light' | 'shutter' | 'text' | 'input_sel' | 'timer' | 'number' | 'fan'
@@ -9869,48 +9902,49 @@ namespace NSPanel {
export type PageEntities = {
type: 'cardEntities',
items: PageItem[],
items: [PageItem?, PageItem?, PageItem?, PageItem?, PageItem?],
} & PageBaseType
export type PageGrid = {
type: 'cardGrid',
items: PageItem[],
items: [PageItem?, PageItem?, PageItem?, PageItem?, PageItem?, PageItem?],
} & PageBaseType
export type PageGrid2 = {
type: 'cardGrid2',
items: PageItem[],
items: [PageItem?, PageItem?, PageItem?, PageItem?, PageItem?, PageItem?, PageItem?, PageItem?],
} & PageBaseType
export type PageThermo = {
type: 'cardThermo',
items: PageThermoItem[],
items: [PageThermoItem],
} & Omit<PageBaseType, 'useColor'>
export type PageMedia = {
type: 'cardMedia',
items: PageMediaItem[],
items: [PageMediaItem],
} & Omit<PageBaseType, 'useColor' | 'autoCreateAlias'>
export type PageAlarm = {
type: 'cardAlarm',
items: PageItem[],
items: [PageItem],
} & Omit<PageBaseType, 'useColor'>
export type PageUnlock = {
type: 'cardUnlock',
items: PageItem[],
items: [PageItem],
} & Omit<PageBaseType, 'useColor'> & Partial<Pick<PageBaseType, 'useColor'>>
export type PageQR = {
type: 'cardQR',
items: PageItem[],
items: [PageItem],
} & Omit<PageBaseType, 'useColor'>
export type PagePower = {
type: 'cardPower',
items: PageItem[],
items: [PageItem],
} & Omit<PageBaseType, 'useColor'>
export type PageChart = {
@@ -10052,6 +10086,7 @@ namespace NSPanel {
export type ScreenSaverMRElement = {
ScreensaverEntity: string | null,
ScreensaverEntityIconOn: string | null,
ScreensaverEntityIconSelect?: {[key: string]: string} | null | undefined,
ScreensaverEntityIconOff: string | null,
ScreensaverEntityValue: string | null,
ScreensaverEntityValueDecimalPlace: number | null,
@@ -10059,6 +10094,17 @@ namespace NSPanel {
ScreensaverEntityOnColor: RGB,
ScreensaverEntityOffColor: RGB
}
export type ScreenSaverMRDataElement = {
ScreensaverEntity: string | number | boolean | null,
ScreensaverEntityIconOn: string | null,
ScreensaverEntityIconOff: string | null,
ScreensaverEntityValue: string | number | boolean | null,
ScreensaverEntityValueDecimalPlace: number | null,
ScreensaverEntityValueUnit: string | null,
ScreensaverEntityOnColor: RGB,
ScreensaverEntityOffColor: RGB
ScreensaverEntityIconSelect: {[key: string]: string} | null,
}
export type IconScaleElement = {
val_min:number,