From f020aa28b97e0f242c5c705a90597a0e48d77933 Mon Sep 17 00:00:00 2001 From: joBr99 Date: Wed, 19 Apr 2023 16:16:31 +0000 Subject: [PATCH 01/12] add draw cooldown (add nextion2text) --- HMI/US/landscape/diff-eu-version.txt | 69 +++++++++++++++++++--------- HMI/US/portrait/diff-eu-version.txt | 69 +++++++++++++++++++--------- HMI/US/portrait/diff-filtered.txt | 69 +++++++++++++++++++--------- HMI/n2t-out-visual/nspanel_Stats.txt | 12 ++--- HMI/n2t-out-visual/popupLight.txt | 46 +++++++++++-------- HMI/n2t-out/popupLight.txt | 45 ++++++++++-------- 6 files changed, 205 insertions(+), 105 deletions(-) diff --git a/HMI/US/landscape/diff-eu-version.txt b/HMI/US/landscape/diff-eu-version.txt index 3c21fd22..fefae546 100644 --- a/HMI/US/landscape/diff-eu-version.txt +++ b/HMI/US/landscape/diff-eu-version.txt @@ -1302,7 +1302,46 @@ │ tSend.txt="event,buttonPress2,"+entn.txt+","+"OnOff," │ covx btOnOff1.val,tTmp.txt,0,0 │ tSend.txt+=tTmp.txt -│ @@ -401,63 +473,48 @@ +│ @@ -345,38 +417,14 @@ +│ Period (ms): 100 +│ Enabled : no +│ +│ Events +│ Timer Event +│ tmCooldown.en=0 +│ +│ -Timer tmDrawCooldown +│ - Attributes +│ - Scope : local +│ - Period (ms): 500 +│ - Enabled : no +│ - +│ - Events +│ - Timer Event +│ - //draw black background +│ - fill hBrightness.x,hBrightness.y,100,hBrightness.val*-25/10+250,8484 +│ - //draw draw colored bar at the position of the current brightness value +│ - fill hBrightness.x,hBrightness.val*-25/10+314,100,hBrightness.val*25/10,col.val +│ - if(hBrightness.val>7) +│ - { +│ - //draw cursor +│ - fill hBrightness.x+25,hBrightness.val*-25/10+322,50,4,WHITE +│ - //paint corner +│ - xstr hBrightness.x,hBrightness.val*-25/10+314,100,hBrightness.h,7,8484,0,0,0,3,"a" +│ - } +│ - //paint corners +│ - xstr hBrightness.x,hBrightness.y,100,hBrightness.h,7,defaultBcoColor,0,0,0,3,"a" +│ - xstr hBrightness.x,hBrightness.y+hBrightness.h-15,100,hBrightness.h,7,defaultBcoColor,0,0,0,3,"b" +│ - tmDrawCooldown.en=0 +│ - +│ Timer tmSerial +│ Attributes +│ Scope : local +│ Period (ms): 50 +│ Enabled : yes +│ +│ Events +│ @@ -425,48 +473,48 @@ │ // write instruction to tInstuction (debug output, but used as variable here, ui elements will be disabled by default) │ spstr strCommand.txt,tInstruction.txt,"~",0 │ spstr strCommand.txt,tTmp.txt,"~",1 @@ -1339,25 +1378,13 @@ │ + vis t2,1 │ vis hBrightness,1 │ covx tTmp.txt,sys0,0,0 -│ - if(tmCooldown.en==0&&hBrightness.val!=sys0) +│ - hBrightness.val=sys0 +│ - tmDrawCooldown.en=1 +│ - tmDrawCooldown.tim=500 │ + if(tmCooldown.en==0) -│ { -│ hBrightness.val=sys0 -│ - //draw black background -│ - fill hBrightness.x,hBrightness.y,100,hBrightness.val*-25/10+250,8484 -│ - //draw draw colored bar at the position of the current brightness value -│ - fill hBrightness.x,hBrightness.val*-25/10+314,100,hBrightness.val*25/10,col.val -│ - if(hBrightness.val>7) -│ - { -│ - //draw cursor -│ - fill hBrightness.x+25,hBrightness.val*-25/10+322,50,4,WHITE -│ - //paint corner -│ - xstr hBrightness.x,hBrightness.val*-25/10+314,100,hBrightness.h,7,8484,0,0,0,3,"a" -│ - } -│ - //paint corners -│ - xstr hBrightness.x,hBrightness.y,100,hBrightness.h,7,defaultBcoColor,0,0,0,3,"a" -│ - xstr hBrightness.x,hBrightness.y+hBrightness.h-15,100,hBrightness.h,7,defaultBcoColor,0,0,0,3,"b" -│ } +│ + { +│ + hBrightness.val=sys0 +│ + } │ } │ // get ColorTemp value │ spstr strCommand.txt,tTmp.txt,"~",6 @@ -1375,7 +1402,7 @@ │ // switch mode │ click bColor,1 │ click bColor,0 -│ @@ -472,16 +529,16 @@ +│ @@ -481,16 +529,16 @@ │ click bColor,1 │ click bColor,0 │ } @@ -1394,7 +1421,7 @@ │ } │ // mode == 0 is rgb controls currently shown │ if(mode.val==0) -│ @@ -492,36 +549,36 @@ +│ @@ -501,36 +549,36 @@ │ } │ } │ // get Color value diff --git a/HMI/US/portrait/diff-eu-version.txt b/HMI/US/portrait/diff-eu-version.txt index 451cad84..7b72722c 100644 --- a/HMI/US/portrait/diff-eu-version.txt +++ b/HMI/US/portrait/diff-eu-version.txt @@ -2677,7 +2677,46 @@ │ tSend.txt="event,buttonPress2,"+entn.txt+","+"OnOff," │ covx btOnOff1.val,tTmp.txt,0,0 │ tSend.txt+=tTmp.txt -│ @@ -401,63 +473,48 @@ +│ @@ -345,38 +417,14 @@ +│ Period (ms): 100 +│ Enabled : no +│ +│ Events +│ Timer Event +│ tmCooldown.en=0 +│ +│ -Timer tmDrawCooldown +│ - Attributes +│ - Scope : local +│ - Period (ms): 500 +│ - Enabled : no +│ - +│ - Events +│ - Timer Event +│ - //draw black background +│ - fill hBrightness.x,hBrightness.y,100,hBrightness.val*-25/10+250,8484 +│ - //draw draw colored bar at the position of the current brightness value +│ - fill hBrightness.x,hBrightness.val*-25/10+314,100,hBrightness.val*25/10,col.val +│ - if(hBrightness.val>7) +│ - { +│ - //draw cursor +│ - fill hBrightness.x+25,hBrightness.val*-25/10+322,50,4,WHITE +│ - //paint corner +│ - xstr hBrightness.x,hBrightness.val*-25/10+314,100,hBrightness.h,7,8484,0,0,0,3,"a" +│ - } +│ - //paint corners +│ - xstr hBrightness.x,hBrightness.y,100,hBrightness.h,7,defaultBcoColor,0,0,0,3,"a" +│ - xstr hBrightness.x,hBrightness.y+hBrightness.h-15,100,hBrightness.h,7,defaultBcoColor,0,0,0,3,"b" +│ - tmDrawCooldown.en=0 +│ - +│ Timer tmSerial +│ Attributes +│ Scope : local +│ Period (ms): 50 +│ Enabled : yes +│ +│ Events +│ @@ -425,48 +473,48 @@ │ // write instruction to tInstuction (debug output, but used as variable here, ui elements will be disabled by default) │ spstr strCommand.txt,tInstruction.txt,"~",0 │ spstr strCommand.txt,tTmp.txt,"~",1 @@ -2714,25 +2753,13 @@ │ + vis t2,1 │ vis hBrightness,1 │ covx tTmp.txt,sys0,0,0 -│ - if(tmCooldown.en==0&&hBrightness.val!=sys0) +│ - hBrightness.val=sys0 +│ - tmDrawCooldown.en=1 +│ - tmDrawCooldown.tim=500 │ + if(tmCooldown.en==0) -│ { -│ hBrightness.val=sys0 -│ - //draw black background -│ - fill hBrightness.x,hBrightness.y,100,hBrightness.val*-25/10+250,8484 -│ - //draw draw colored bar at the position of the current brightness value -│ - fill hBrightness.x,hBrightness.val*-25/10+314,100,hBrightness.val*25/10,col.val -│ - if(hBrightness.val>7) -│ - { -│ - //draw cursor -│ - fill hBrightness.x+25,hBrightness.val*-25/10+322,50,4,WHITE -│ - //paint corner -│ - xstr hBrightness.x,hBrightness.val*-25/10+314,100,hBrightness.h,7,8484,0,0,0,3,"a" -│ - } -│ - //paint corners -│ - xstr hBrightness.x,hBrightness.y,100,hBrightness.h,7,defaultBcoColor,0,0,0,3,"a" -│ - xstr hBrightness.x,hBrightness.y+hBrightness.h-15,100,hBrightness.h,7,defaultBcoColor,0,0,0,3,"b" -│ } +│ + { +│ + hBrightness.val=sys0 +│ + } │ } │ // get ColorTemp value │ spstr strCommand.txt,tTmp.txt,"~",6 @@ -2750,7 +2777,7 @@ │ // switch mode │ click bColor,1 │ click bColor,0 -│ @@ -472,16 +529,16 @@ +│ @@ -481,16 +529,16 @@ │ click bColor,1 │ click bColor,0 │ } @@ -2769,7 +2796,7 @@ │ } │ // mode == 0 is rgb controls currently shown │ if(mode.val==0) -│ @@ -492,36 +549,36 @@ +│ @@ -501,36 +549,36 @@ │ } │ } │ // get Color value diff --git a/HMI/US/portrait/diff-filtered.txt b/HMI/US/portrait/diff-filtered.txt index 063af9f8..3091b496 100644 --- a/HMI/US/portrait/diff-filtered.txt +++ b/HMI/US/portrait/diff-filtered.txt @@ -1,4 +1,4 @@ -+++ /dev/fd/62 2023-04-18 22:17:40.643093312 +0000 ++++ /dev/fd/62 2023-04-19 16:16:22.100652931 +0000 +I/n2t-out/Program.s.txt ++ HMI/US/portrait/n2t-out/Program.s.txt +1 +10,10 @@ @@ -57,13 +57,13 @@ +ributes + Scope : local + Text : -+ Max. Text Size: 80 + Max. Text Size: 40 + +e (string) nent2 +ributes + Scope : local + Text : ++ Max. Text Size: 80 + Max. Text Size: 40 +14 +186,26 @@ +e (string) type6 @@ -1483,9 +1483,6 @@ + Associated Keyboard: none + Text : newtxt + Max. Text Size : 100 -+ Scope : local -+ Dragging : 0 -+ Disable release event after dragging: 0 + Send Component ID : disabled + Associated Keyboard : none + Text : newtxt @@ -1541,6 +1538,9 @@ + State : unpressed + Text : startup + Max. Text Size : 10 ++ Scope : local ++ Dragging : 0 ++ Disable release event after dragging: 0 + Send Component ID : disabled + State : unpressed + Text : startup @@ -2067,7 +2067,46 @@ + tSend.txt="event,buttonPress2,"+entn.txt+","+"OnOff," + covx btOnOff1.val,tTmp.txt,0,0 + tSend.txt+=tTmp.txt -+63 +473,48 @@ ++38 +417,14 @@ ++ Period (ms): 100 ++ Enabled : no ++ ++nts ++ Timer Event ++ tmCooldown.en=0 ++ ++mDrawCooldown ++ributes ++ Scope : local ++ Period (ms): 500 ++ Enabled : no ++ ++nts ++ Timer Event ++ //draw black background ++ fill hBrightness.x,hBrightness.y,100,hBrightness.val*-25/10+250,8484 ++ //draw draw colored bar at the position of the current brightness value ++ fill hBrightness.x,hBrightness.val*-25/10+314,100,hBrightness.val*25/10,col.val ++ if(hBrightness.val>7) ++ { ++ //draw cursor ++ fill hBrightness.x+25,hBrightness.val*-25/10+322,50,4,WHITE ++ //paint corner ++ xstr hBrightness.x,hBrightness.val*-25/10+314,100,hBrightness.h,7,8484,0,0,0,3,"a" ++ } ++ //paint corners ++ xstr hBrightness.x,hBrightness.y,100,hBrightness.h,7,defaultBcoColor,0,0,0,3,"a" ++ xstr hBrightness.x,hBrightness.y+hBrightness.h-15,100,hBrightness.h,7,defaultBcoColor,0,0,0,3,"b" ++ tmDrawCooldown.en=0 ++ ++mSerial ++ributes ++ Scope : local ++ Period (ms): 50 ++ Enabled : yes ++ ++nts ++48 +473,48 @@ + // write instruction to tInstuction (debug output, but used as variable here, ui elements will be disabled by default) + spstr strCommand.txt,tInstruction.txt,"~",0 + spstr strCommand.txt,tTmp.txt,"~",1 @@ -2104,24 +2143,12 @@ + vis t2,1 + vis hBrightness,1 + covx tTmp.txt,sys0,0,0 -+ if(tmCooldown.en==0&&hBrightness.val!=sys0) ++ hBrightness.val=sys0 ++ tmDrawCooldown.en=1 ++ tmDrawCooldown.tim=500 + if(tmCooldown.en==0) + { + hBrightness.val=sys0 -+ //draw black background -+ fill hBrightness.x,hBrightness.y,100,hBrightness.val*-25/10+250,8484 -+ //draw draw colored bar at the position of the current brightness value -+ fill hBrightness.x,hBrightness.val*-25/10+314,100,hBrightness.val*25/10,col.val -+ if(hBrightness.val>7) -+ { -+ //draw cursor -+ fill hBrightness.x+25,hBrightness.val*-25/10+322,50,4,WHITE -+ //paint corner -+ xstr hBrightness.x,hBrightness.val*-25/10+314,100,hBrightness.h,7,8484,0,0,0,3,"a" -+ } -+ //paint corners -+ xstr hBrightness.x,hBrightness.y,100,hBrightness.h,7,defaultBcoColor,0,0,0,3,"a" -+ xstr hBrightness.x,hBrightness.y+hBrightness.h-15,100,hBrightness.h,7,defaultBcoColor,0,0,0,3,"b" + } + } + // get ColorTemp value diff --git a/HMI/n2t-out-visual/nspanel_Stats.txt b/HMI/n2t-out-visual/nspanel_Stats.txt index 9c7fb7b7..28f54c57 100644 --- a/HMI/n2t-out-visual/nspanel_Stats.txt +++ b/HMI/n2t-out-visual/nspanel_Stats.txt @@ -10,10 +10,6 @@ pageTest 27 Component(s) 68 Line(s) of event code 66 Unique line(s) of event code -popupLight - 22 Component(s) - 406 Line(s) of event code - 214 Unique line(s) of event code popupNotify 19 Component(s) 263 Line(s) of event code @@ -34,6 +30,10 @@ screensaver2 59 Component(s) 354 Line(s) of event code 251 Unique line(s) of event code +popupLight + 23 Component(s) + 406 Line(s) of event code + 207 Unique line(s) of event code cardChart 33 Component(s) 433 Line(s) of event code @@ -89,6 +89,6 @@ cardEntities Total 21 Page(s) - 799 Component(s) + 800 Component(s) 9262 Line(s) of event code - 2348 Unique line(s) of event code + 2343 Unique line(s) of event code diff --git a/HMI/n2t-out-visual/popupLight.txt b/HMI/n2t-out-visual/popupLight.txt index 474796ee..264f1357 100644 --- a/HMI/n2t-out-visual/popupLight.txt +++ b/HMI/n2t-out-visual/popupLight.txt @@ -511,6 +511,31 @@ Timer tmCooldown Timer Event tmCooldown.en=0 +Timer tmDrawCooldown + Attributes + ID : 22 + Scope : local + Period (ms): 500 + Enabled : no + + Events + Timer Event + //draw black background + fill hBrightness.x,hBrightness.y,100,hBrightness.val*-25/10+250,8484 + //draw draw colored bar at the position of the current brightness value + fill hBrightness.x,hBrightness.val*-25/10+314,100,hBrightness.val*25/10,col.val + if(hBrightness.val>7) + { + //draw cursor + fill hBrightness.x+25,hBrightness.val*-25/10+322,50,4,WHITE + //paint corner + xstr hBrightness.x,hBrightness.val*-25/10+314,100,hBrightness.h,7,8484,0,0,0,3,"a" + } + //paint corners + xstr hBrightness.x,hBrightness.y,100,hBrightness.h,7,defaultBcoColor,0,0,0,3,"a" + xstr hBrightness.x,hBrightness.y+hBrightness.h-15,100,hBrightness.h,7,defaultBcoColor,0,0,0,3,"b" + tmDrawCooldown.en=0 + Timer tmSerial Attributes ID : 8 @@ -591,24 +616,9 @@ Timer tmSerial //vis t2,1 vis hBrightness,1 covx tTmp.txt,sys0,0,0 - if(tmCooldown.en==0&&hBrightness.val!=sys0) - { - hBrightness.val=sys0 - //draw black background - fill hBrightness.x,hBrightness.y,100,hBrightness.val*-25/10+250,8484 - //draw draw colored bar at the position of the current brightness value - fill hBrightness.x,hBrightness.val*-25/10+314,100,hBrightness.val*25/10,col.val - if(hBrightness.val>7) - { - //draw cursor - fill hBrightness.x+25,hBrightness.val*-25/10+322,50,4,WHITE - //paint corner - xstr hBrightness.x,hBrightness.val*-25/10+314,100,hBrightness.h,7,8484,0,0,0,3,"a" - } - //paint corners - xstr hBrightness.x,hBrightness.y,100,hBrightness.h,7,defaultBcoColor,0,0,0,3,"a" - xstr hBrightness.x,hBrightness.y+hBrightness.h-15,100,hBrightness.h,7,defaultBcoColor,0,0,0,3,"b" - } + hBrightness.val=sys0 + tmDrawCooldown.en=1 + tmDrawCooldown.tim=500 } // get ColorTemp value spstr strCommand.txt,tTmp.txt,"~",6 diff --git a/HMI/n2t-out/popupLight.txt b/HMI/n2t-out/popupLight.txt index 520fd095..59e30822 100644 --- a/HMI/n2t-out/popupLight.txt +++ b/HMI/n2t-out/popupLight.txt @@ -349,6 +349,30 @@ Timer tmCooldown Timer Event tmCooldown.en=0 +Timer tmDrawCooldown + Attributes + Scope : local + Period (ms): 500 + Enabled : no + + Events + Timer Event + //draw black background + fill hBrightness.x,hBrightness.y,100,hBrightness.val*-25/10+250,8484 + //draw draw colored bar at the position of the current brightness value + fill hBrightness.x,hBrightness.val*-25/10+314,100,hBrightness.val*25/10,col.val + if(hBrightness.val>7) + { + //draw cursor + fill hBrightness.x+25,hBrightness.val*-25/10+322,50,4,WHITE + //paint corner + xstr hBrightness.x,hBrightness.val*-25/10+314,100,hBrightness.h,7,8484,0,0,0,3,"a" + } + //paint corners + xstr hBrightness.x,hBrightness.y,100,hBrightness.h,7,defaultBcoColor,0,0,0,3,"a" + xstr hBrightness.x,hBrightness.y+hBrightness.h-15,100,hBrightness.h,7,defaultBcoColor,0,0,0,3,"b" + tmDrawCooldown.en=0 + Timer tmSerial Attributes Scope : local @@ -428,24 +452,9 @@ Timer tmSerial //vis t2,1 vis hBrightness,1 covx tTmp.txt,sys0,0,0 - if(tmCooldown.en==0&&hBrightness.val!=sys0) - { - hBrightness.val=sys0 - //draw black background - fill hBrightness.x,hBrightness.y,100,hBrightness.val*-25/10+250,8484 - //draw draw colored bar at the position of the current brightness value - fill hBrightness.x,hBrightness.val*-25/10+314,100,hBrightness.val*25/10,col.val - if(hBrightness.val>7) - { - //draw cursor - fill hBrightness.x+25,hBrightness.val*-25/10+322,50,4,WHITE - //paint corner - xstr hBrightness.x,hBrightness.val*-25/10+314,100,hBrightness.h,7,8484,0,0,0,3,"a" - } - //paint corners - xstr hBrightness.x,hBrightness.y,100,hBrightness.h,7,defaultBcoColor,0,0,0,3,"a" - xstr hBrightness.x,hBrightness.y+hBrightness.h-15,100,hBrightness.h,7,defaultBcoColor,0,0,0,3,"b" - } + hBrightness.val=sys0 + tmDrawCooldown.en=1 + tmDrawCooldown.tim=500 } // get ColorTemp value spstr strCommand.txt,tTmp.txt,"~",6 From 94295495de58d0f08fb68edd7442c235e0c82e7f Mon Sep 17 00:00:00 2001 From: Johannes <29555657+joBr99@users.noreply.github.com> Date: Thu, 20 Apr 2023 12:03:12 +0200 Subject: [PATCH 02/12] fix --- apps/nspanel-lovelace-ui/luibackend/icon_mapping.py | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/nspanel-lovelace-ui/luibackend/icon_mapping.py b/apps/nspanel-lovelace-ui/luibackend/icon_mapping.py index 65f63eb7..cea537a8 100644 --- a/apps/nspanel-lovelace-ui/luibackend/icon_mapping.py +++ b/apps/nspanel-lovelace-ui/luibackend/icon_mapping.py @@ -6898,6 +6898,7 @@ icons = { } import apis +import re def get_icon_id(ma_name): if isinstance(ma_name, re.Match): From da9734ef1df76be12d9caab87b75f6138a6320f2 Mon Sep 17 00:00:00 2001 From: Thomas <101348966+tt-tom17@users.noreply.github.com> Date: Thu, 20 Apr 2023 23:23:22 +0200 Subject: [PATCH 03/12] v4.0.5.8 Fix Layout Update message for TFT, Berry-Driver and Tasmota MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Funktion check_updates überarbeitet - diverse Debug Meldungen erstellt und erweitert - Kommentare angepasst --- ioBroker/NsPanelTs.ts | 152 ++++++++++++----------- ioBroker/NsPanelTs_without_Examples.ts | 163 +++++++++++++------------ 2 files changed, 161 insertions(+), 154 deletions(-) diff --git a/ioBroker/NsPanelTs.ts b/ioBroker/NsPanelTs.ts index 3052da06..c09c1bb7 100644 --- a/ioBroker/NsPanelTs.ts +++ b/ioBroker/NsPanelTs.ts @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------- -TypeScript v4.0.5.7 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @Sternmiere / @Britzelpuf / @ravenS0ne / @TT-Tom +TypeScript v4.0.5.8 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @Sternmiere / @Britzelpuf / @ravenS0ne / @TT-Tom - abgestimmt auf TFT 50 / v4.0.5 / BerryDriver 8 / Tasmota 12.4.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 @@ -131,6 +131,7 @@ ReleaseNotes: - 09.04.2023 - v4.0.5.5 Fix trigger popupNotifypage - 11.04.2023 - v4.0.5.6 Fix function InitDimmode - 18.04.2023 - v4.0.5.7 Fix Function check_updates + - 20.04.2023 - v4.0.5.8 Fix Layout Update message for TFT, Berry-Driver and Tasmota *********************************************************************************************************** * Für die Erstellung der Aliase durch das Skript, muss in der JavaScript Instanz "setObect" gesetzt sein! * @@ -1128,7 +1129,7 @@ export const config = { ScreensaverEntityUnitText: '°', ScreensaverEntityIconColor: White }, - // bottomScreensaverEntity 5 (only Advanced Screensaver) + // bottomScreensaverEntity 5 (for Alternative and Advanced Screensaver) { ScreensaverEntity: 'accuweather.0.Current.RelativeHumidity', ScreensaverEntityFactor: 1, @@ -2116,10 +2117,10 @@ async function InitPopupNotify() { let notification: string; let v_popupNotifyHeadingColor = (getState(popupNotifyHeadingColor).val != null) ? getState(popupNotifyHeadingColor).val : '65504'// Farbe Headline - gelb 65504 - let v_popupNotifyButton1TextColor = (getState(popupNotifyButton1TextColor).val != null) ? getState(popupNotifyButton1TextColor).val : '63488'// Farbe Headline - gelb 65504 - let v_popupNotifyButton2TextColor = (getState(popupNotifyButton2TextColor).val != null) ? getState(popupNotifyButton2TextColor).val : '2016'// Farbe Headline - gelb 65504 - let v_popupNotifyTextColor = (getState(popupNotifyTextColor).val != null) ? getState(popupNotifyTextColor).val : '65535'// Farbe Headline - gelb 65504 - let v_popupNotifyIconColor = (getState(popupNotifyIconColor).val != null) ? getState(popupNotifyIconColor).val : '65535'// Farbe Headline - gelb 65504 + let v_popupNotifyButton1TextColor = (getState(popupNotifyButton1TextColor).val != null) ? getState(popupNotifyButton1TextColor).val : '63488'// Farbe Button 1 - rot 63488 + let v_popupNotifyButton2TextColor = (getState(popupNotifyButton2TextColor).val != null) ? getState(popupNotifyButton2TextColor).val : '2016'// Farbe Button 2 - grün 2016 + let v_popupNotifyTextColor = (getState(popupNotifyTextColor).val != null) ? getState(popupNotifyTextColor).val : '65535'// Farbe Text - weiss 65535 + let v_popupNotifyIconColor = (getState(popupNotifyIconColor).val != null) ? getState(popupNotifyIconColor).val : '65535'// Farbe Icon - weiss 65535 let v_popupNotifyFontIdText = (getState(popupNotifyFontIdText).val != null) ? getState(popupNotifyFontIdText).val : '1' let v_popupNotifyIcon = (getState(popupNotifyIcon).val != null) ? getState(popupNotifyIcon).val : 'alert' @@ -2286,9 +2287,22 @@ function get_locales() { async function check_updates() { try { - if (Debug) { - console.log('Check-Updates'); - } + if (Debug) console.log('Check-Updates'); + + let Update: boolean = false; + + let InternalName: string = ''; + let Headline: string = ''; + let Text: string = ''; + + const HeadlineColor: string = '63488'; // Farbe Rot + const Button1: string = 'Nein'; + const Button1Color: string = '63488'; // Farbe Rot + const Button2: string = 'Ja'; + const Button2Color: string = '2016'; // Farbe Grün + const Timeout: number = 0; + const Layout: number = 1; + // Tasmota-Firmware-Vergleich if (existsObject(NSPanel_Path + 'Tasmota_Firmware.currentVersion') && existsObject(NSPanel_Path + 'Tasmota_Firmware.onlineVersion')) { let splitTasmotaVersion = (getState(NSPanel_Path + 'Tasmota_Firmware.currentVersion').val).split('.'); @@ -2296,9 +2310,9 @@ async function check_updates() { if (shortTasmoataVersion !== getState(NSPanel_Path + 'Tasmota_Firmware.onlineVersion').val) { if (existsState(NSPanel_Path + 'NSPanel_autoUpdate')) { if (getState(NSPanel_Path + 'NSPanel_autoUpdate').val) { - if (Debug) { - console.log('Auto-Updates eingeschaltet - Update wird durchgeführt'); - } + + if (Debug) console.log('Auto-Updates eingeschaltet - Update Tasmota wird durchgeführt'); + // Tasmota Upgrade durchführen update_tasmota_firmware(); // Aktuelle Tasmota Version = Online Tasmota Version @@ -2306,29 +2320,16 @@ async function check_updates() { await setStateAsync(NSPanel_Path + 'Tasmota_Firmware.currentVersion', { val: getState(NSPanel_Path + 'Tasmota_Firmware.onlineVersion').val, ack: true }); } else { // Auf Tasmota-Updates hinweisen - if (Debug) { - console.log('Automatische Updates aus'); - } + if (Debug) console.log('Tasmota-Firmware => Automatische Updates aus, manuelles Update nötig'); - const InternalName = 'TasmotaFirmwareUpdate'; - const Headline = 'Tasmota-Firmware Update'; - const Text = ['Es ist eine neue Version der Tasmota-Firmware', '\r\n', 'verfügbar', '\r\n', '\r\n', 'Installierte Version: ' + String(getState((String(NSPanel_Path) + 'Tasmota_Firmware.currentVersion')).val), '\r\n', 'Verfügbare Version: ' + String(getState((String(NSPanel_Path) + 'Tasmota_Firmware.onlineVersion')).val), '\r\n', '\r\n', 'Upgrade durchführen?'].join(''); - const Button1 = 'Nein'; - const Button2 = 'Ja'; - const Timeout = 0; - - await setStateAsync(popupNotifyHeading, { val: Headline, ack: false }); - await setStateAsync(popupNotifyButton1Text, { val: Button1, ack: false }); - await setStateAsync(popupNotifyButton2Text, { val: Button2, ack: false }); - await setStateAsync(popupNotifySleepTimeout, { val: Timeout, ack: false }); - await setStateAsync(popupNotifyInternalName, { val: InternalName, ack: false }); - await setStateAsync(popupNotifyText, { val: [formatDate(getDateObject((new Date().getTime())), 'TT.MM.JJJJ SS:mm:ss'), '\r\n', '\r\n', Text].join(''), ack: false }); + InternalName = 'TasmotaFirmwareUpdate'; + Headline = 'Tasmota-Firmware Update'; + Text = ['Es ist eine neue Version der Tasmota-Firmware', '\r\n', 'verfügbar', '\r\n', '\r\n', 'Installierte Version: ' + String(getState((String(NSPanel_Path) + 'Tasmota_Firmware.currentVersion')).val), '\r\n', 'Verfügbare Version: ' + String(getState((String(NSPanel_Path) + 'Tasmota_Firmware.onlineVersion')).val), '\r\n', '\r\n', 'Upgrade durchführen?'].join(''); + Update = true; } } } else { - if (Debug) { - console.log('Tasmota-Version auf NSPanel aktuell'); - } + if (Debug) console.log('Tasmota-Version auf NSPanel aktuell'); } } @@ -2337,39 +2338,28 @@ async function check_updates() { if (parseFloat(getState(NSPanel_Path + 'Berry_Driver.currentVersion').val) < berry_driver_version) { if (existsState(NSPanel_Path + 'NSPanel_autoUpdate')) { if (getState(NSPanel_Path + 'NSPanel_autoUpdate').val) { + + if (Debug) console.log('Auto-Updates eingeschaltet - Update Berry-Driver wird durchgeführt'); + // Tasmota Berry-Driver Update durchführen update_berry_driver_version(); // Aktuelle Berry-Driver Version = Online Berry-Driver Version await setStateAsync(NSPanel_Path + 'Berry_Driver.currentVersion', { val: getState(NSPanel_Path + 'Berry_Driver.onlineVersion').val, ack: true }); - if (Debug) { - console.log('Berry-Driver automatisch aktualisiert'); - } + if (Debug) console.log('Berry-Driver automatisch aktualisiert'); + } else { //Auf BerryDriver-Update hinweisen - if (Debug) { - console.log('Automatische Updates aus'); - } + if (Debug) console.log('Berry-Driver => Automatische Updates aus, manuelles Update nötig'); - const InternalName = 'BerryDriverUpdate'; - const Headline = 'Berry-Driver Update'; - const Text = ['Es ist eine neue Version des Berry-Drivers', '\r\n', '(Tasmota) verfügbar', '\r\n', '\r\n', 'Installierte Version: ' + String(getState((String(NSPanel_Path) + 'Berry_Driver.currentVersion')).val), '\r\n', 'Verfügbare Version: ' + String(berry_driver_version), '\r\n', '\r\n', 'Upgrade durchführen?'].join(''); - const Button1 = 'Nein'; - const Button2 = 'Ja'; - const Timeout = 0; - - await setStateAsync(popupNotifyHeading, { val: Headline, ack: false }); - await setStateAsync(popupNotifyButton1Text, { val: Button1, ack: false }); - await setStateAsync(popupNotifyButton2Text, { val: Button2, ack: false }); - await setStateAsync(popupNotifySleepTimeout, { val: Timeout, ack: false }); - await setStateAsync(popupNotifyInternalName, { val: InternalName, ack: false }); - await setStateAsync(popupNotifyText, { val: [formatDate(getDateObject((new Date().getTime())), 'TT.MM.JJJJ SS:mm:ss'), '\r\n', '\r\n', Text].join(''), ack: false }); + InternalName = 'BerryDriverUpdate'; + Headline = 'Berry-Driver Update'; + Text = ['Es ist eine neue Version des Berry-Drivers', '\r\n', '(Tasmota) verfügbar', '\r\n', '\r\n', 'Installierte Version: ' + String(getState((String(NSPanel_Path) + 'Berry_Driver.currentVersion')).val), '\r\n', 'Verfügbare Version: ' + String(berry_driver_version), '\r\n', '\r\n', 'Upgrade durchführen?'].join(''); + Update = true; } } } else { - if (Debug) { - console.log('Berry-Driver auf NSPanel aktuell'); - } + if (Debug) console.log('Berry-Driver auf NSPanel aktuell'); } } @@ -2378,41 +2368,43 @@ async function check_updates() { if (parseInt(getState(NSPanel_Path + 'Display_Firmware.currentVersion').val) < desired_display_firmware_version) { if (existsState(NSPanel_Path + 'NSPanel_autoUpdate')) { if (getState(NSPanel_Path + 'NSPanel_autoUpdate').val) { + + if (Debug) console.log('Auto-Updates eingeschaltet - Update TFT-Firmware wird durchgeführt'); + // TFT-Firmware Update durchführen update_tft_firmware(); // Aktuelle TFT-Firmware Version = Online TFT-Firmware Version await setStateAsync(NSPanel_Path + 'Display_Firmware.currentVersion', { val: getState(NSPanel_Path + 'Display_Firmware.onlineVersion').val, ack: true }); - if (Debug) { - console.log('Display_Firmware automatisch aktualisiert'); - } + if (Debug) console.log('Display_Firmware automatisch aktualisiert'); + } else { // Auf TFT-Firmware hinweisen - if (Debug) { - console.log('Automatische Updates aus'); - } + if (Debug) console.log('Display-Firmware => Automatische Updates aus, manuelles Update nötig'); - const InternalName = 'TFTFirmwareUpdate'; - const Headline = 'TFT-Firmware Update'; - const Text = ['Es ist eine neue Version der TFT-Firmware', '\r\n', 'verfügbar', '\r\n', '\r\n', 'Installierte Version: ' + String(getState((String(NSPanel_Path) + 'Display_Firmware.currentVersion')).val), '\r\n', 'Verfügbare Version: ' + String(desired_display_firmware_version), '\r\n', '\r\n', 'Upgrade durchführen?'].join(''); - const Button1 = 'Nein'; - const Button2 = 'Ja'; - const Timeout = 0; - - await setStateAsync(popupNotifyHeading, { val: Headline, ack: false }); - await setStateAsync(popupNotifyButton1Text, { val: Button1, ack: false }); - await setStateAsync(popupNotifyButton2Text, { val: Button2, ack: false }); - await setStateAsync(popupNotifySleepTimeout, { val: Timeout, ack: false }); - await setStateAsync(popupNotifyInternalName, { val: InternalName, ack: false }); - await setStateAsync(popupNotifyText, { val: [formatDate(getDateObject((new Date().getTime())), 'TT.MM.JJJJ SS:mm:ss'), '\r\n', '\r\n', Text].join(''), ack: false }); + InternalName = 'TFTFirmwareUpdate'; + Headline = 'TFT-Firmware Update'; + Text = ['Es ist eine neue Version der TFT-Firmware', '\r\n', 'verfügbar', '\r\n', '\r\n', 'Installierte Version: ' + String(getState((String(NSPanel_Path) + 'Display_Firmware.currentVersion')).val), '\r\n', 'Verfügbare Version: ' + String(desired_display_firmware_version), '\r\n', '\r\n', 'Upgrade durchführen?'].join(''); + Update = true; } } } else { - if (Debug) { - console.log('Display_Firmware auf NSPanel aktuell'); - } + if (Debug) console.log('Display_Firmware auf NSPanel aktuell'); } } + if (Update) { + await setStateAsync(popupNotifyHeading, { val: Headline, ack: false }); + await setStateAsync(popupNotifyHeadingColor, { val: HeadlineColor, ack: false }); + await setStateAsync(popupNotifyButton1Text, { val: Button1, ack: false }); + await setStateAsync(popupNotifyButton1TextColor, { val: Button1Color, ack: false }); + await setStateAsync(popupNotifyButton2Text, { val: Button2, ack: false }); + await setStateAsync(popupNotifyButton2TextColor, { val: Button2Color, ack: false }); + await setStateAsync(popupNotifySleepTimeout, { val: Timeout, ack: false }); + await setStateAsync(popupNotifyInternalName, { val: InternalName, ack: false }); + await setStateAsync(popupNotifyLayout, { val: Layout, ack: false }); + await setStateAsync(popupNotifyText, { val: [formatDate(getDateObject((new Date().getTime())), 'TT.MM.JJJJ SS:mm:ss'), '\r\n', '\r\n', Text].join(''), ack: false }); + } + } catch (err) { console.warn('error at function check_updates: ' + err.message); } @@ -2505,6 +2497,7 @@ function get_online_tasmota_firmware_version() { setObject(AliasPath + 'Tasmota_Firmware.onlineVersion', {type: 'channel', common: {role: 'info', name:'onlineVersion'}, native: {}}); await createAliasAsync(AliasPath + 'Tasmota_Firmware.onlineVersion.ACTUAL', NSPanel_Path + 'Tasmota_Firmware.onlineVersion', true, { type: 'string', role: 'state', name: 'ACTUAL' }); await setStateAsync(NSPanel_Path + 'Tasmota_Firmware.onlineVersion', { val: TasmotaVersionOnline, ack: true }); + if (Debug) console.log('online tasmota firmware version => ' + TasmotaVersionOnline); } catch (err) { console.warn('error result in function get_online_tasmota_firmware_version: ' + err.message); } @@ -2533,12 +2526,14 @@ function get_current_berry_driver_version() { } }, async (error, response, result) => { try { + const BerryDriverVersionCurrent: string = JSON.parse(result).nlui_driver_version; await createStateAsync(NSPanel_Path + 'Berry_Driver.currentVersion', { type: 'string' }); await setStateAsync(NSPanel_Path + 'Berry_Driver.currentVersion', { val: JSON.parse(result).nlui_driver_version, ack: true }); if (autoCreateAlias) { setObject(AliasPath + 'Display.BerryDriver', {type: 'channel', common: {role: 'info', name: 'Berry Driver'}, native: {}}); await createAliasAsync(AliasPath + 'Display.BerryDriver.ACTUAL', NSPanel_Path + 'Berry_Driver.currentVersion', true, { type: 'string', role: 'state', name: 'ACTUAL' }); } + if (Debug) console.log('current berry driver version => ' + BerryDriverVersionCurrent); } catch (err) { console.warn('error result in function get_current_berry_driver_version: ' + err.message); } @@ -2595,6 +2590,7 @@ function get_tasmota_status0() { await setStateAsync(NSPanel_Path + 'Tasmota.Wifi.RSSI', { val: Tasmota_JSON.StatusSTS.Wifi.RSSI, ack: true }); await setStateAsync(NSPanel_Path + 'Tasmota.Wifi.Signal', { val: Tasmota_JSON.StatusSTS.Wifi.Signal, ack: true }); await setStateAsync(NSPanel_Path + 'Tasmota.Product', { val: 'SONOFF NSPanel', ack: true }); + if (Debug) console.log('current tasmota firmware version => ' + tasmoVersion); } catch (err) { console.warn('error setState in function get_tasmota_status0' + err.message); } @@ -2647,6 +2643,7 @@ function get_online_berry_driver_version() { setObject(AliasPath + 'Berry_Driver.onlineVersion', {type: 'channel', common: {role: 'info', name:'onlineVersion'}, native: {}}); await createAliasAsync(AliasPath + 'Berry_Driver.onlineVersion.ACTUAL', NSPanel_Path + 'Berry_Driver.onlineVersion', true, { type: 'string', role: 'state', name: 'ACTUAL' }); await setStateAsync(NSPanel_Path + 'Berry_Driver.onlineVersion', { val: BerryDriverVersionOnline, ack: true }); + if (Debug) console.log('online berry driver version => ' + BerryDriverVersionOnline); } catch (err) { console.warn('error result in function get_online_berry_driver_version' + err.message); } @@ -2677,6 +2674,7 @@ function check_version_tft_firmware() { await createStateAsync(NSPanel_Path + 'TFT_Firmware.onlineVersion', { type: 'string' }); await setStateAsync(NSPanel_Path + 'TFT_Firmware.onlineVersion', { val: NSPanelVersion, ack: true }); + if (Debug) console.log('online TFT firmware version => ' + NSPanelVersion); } catch (err) { console.warn('error result in function check_version_tft_firmware: ' + err.message); } @@ -2704,6 +2702,7 @@ function check_online_display_firmware() { await createStateAsync(NSPanel_Path + 'Display_Firmware.onlineVersion', { type: 'string' }); await setStateAsync(NSPanel_Path + 'Display_Firmware.onlineVersion', { val: desired_display_firmware_version, ack: true }); + if (Debug) console.log('online display firmware version => ' + desired_display_firmware_version); } catch (err) { console.warn('error result in function check_online_display_firmware' + err.message); } @@ -2842,7 +2841,7 @@ on({ id: config.panelRecvTopic.substring(0, config.panelRecvTopic.length - 'RESU } else { console.log('Tasmota upgrade complete. New Version: ' + Tasmota_JSON.Info1.Version); get_tasmota_status0(); - check_updates(); + //check_updates(); } } } catch (err) { @@ -5092,7 +5091,6 @@ function GeneratePowerPage(page: PagePower): Payload[] { power_string = power_string + array_powerspeed[i+1] + '~'; // speed~ if (Debug) console.log(power_string); - console.log(power_string); } power_string = power_string.substring(0, power_string.length - 1); diff --git a/ioBroker/NsPanelTs_without_Examples.ts b/ioBroker/NsPanelTs_without_Examples.ts index b99edf6a..3d27d15e 100644 --- a/ioBroker/NsPanelTs_without_Examples.ts +++ b/ioBroker/NsPanelTs_without_Examples.ts @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------- -TypeScript v4.0.5.7 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @Sternmiere / @Britzelpuf / @ravenS0ne / @TT-Tom +TypeScript v4.0.5.8 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @Sternmiere / @Britzelpuf / @ravenS0ne / @TT-Tom - abgestimmt auf TFT 50 / v4.0.5 / BerryDriver 8 / Tasmota 12.4.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 @@ -131,6 +131,7 @@ ReleaseNotes: - 09.04.2023 - v4.0.5.5 Fix trigger popupNotifypage - 11.04.2023 - v4.0.5.6 Fix function InitDimmode - 18.04.2023 - v4.0.5.7 Fix Function check_updates + - 20.04.2023 - v4.0.5.8 Fix Layout Update message for TFT, Berry-Driver and Tasmota *********************************************************************************************************** * Für die Erstellung der Aliase durch das Skript, muss in der JavaScript Instanz "setObect" gesetzt sein! * @@ -716,7 +717,18 @@ export const config = { ScreensaverEntityUnitText: '°', ScreensaverEntityIconColor: White }, - // Examples for Advanced-Screensaver: https://github.com/joBr99/nspanel-lovelace-ui/wiki/ioBroker-Config-Screensaver#entity-status-icons-ab-v400 + // bottomScreensaverEntity 5 (for Alternative and Advanced Screensaver) + { + ScreensaverEntity: 'accuweather.0.Current.RelativeHumidity', + ScreensaverEntityFactor: 1, + ScreensaverEntityDecimalPlaces: 1, + ScreensaverEntityIconOn: 'water-percent', + ScreensaverEntityIconOff: null, + ScreensaverEntityText: 'Feuchte', + ScreensaverEntityUnitText: '%', + ScreensaverEntityIconColor: {'val_min': 0, 'val_max': 100, 'val_best': 65} + }, + // Examples for Advanced-Screensaver: https://github.com/joBr99/nspanel-lovelace-ui/wiki/ioBroker-Config-Screensaver#entity-status-icons-ab-v400 ], indicatorScreensaverEntity: @@ -1606,10 +1618,10 @@ async function InitPopupNotify() { let notification: string; let v_popupNotifyHeadingColor = (getState(popupNotifyHeadingColor).val != null) ? getState(popupNotifyHeadingColor).val : '65504'// Farbe Headline - gelb 65504 - let v_popupNotifyButton1TextColor = (getState(popupNotifyButton1TextColor).val != null) ? getState(popupNotifyButton1TextColor).val : '63488'// Farbe Headline - gelb 65504 - let v_popupNotifyButton2TextColor = (getState(popupNotifyButton2TextColor).val != null) ? getState(popupNotifyButton2TextColor).val : '2016'// Farbe Headline - gelb 65504 - let v_popupNotifyTextColor = (getState(popupNotifyTextColor).val != null) ? getState(popupNotifyTextColor).val : '65535'// Farbe Headline - gelb 65504 - let v_popupNotifyIconColor = (getState(popupNotifyIconColor).val != null) ? getState(popupNotifyIconColor).val : '65535'// Farbe Headline - gelb 65504 + let v_popupNotifyButton1TextColor = (getState(popupNotifyButton1TextColor).val != null) ? getState(popupNotifyButton1TextColor).val : '63488'// Farbe Button 1 - rot 63488 + let v_popupNotifyButton2TextColor = (getState(popupNotifyButton2TextColor).val != null) ? getState(popupNotifyButton2TextColor).val : '2016'// Farbe Button 2 - grün 2016 + let v_popupNotifyTextColor = (getState(popupNotifyTextColor).val != null) ? getState(popupNotifyTextColor).val : '65535'// Farbe Text - weiss 65535 + let v_popupNotifyIconColor = (getState(popupNotifyIconColor).val != null) ? getState(popupNotifyIconColor).val : '65535'// Farbe Icon - weiss 65535 let v_popupNotifyFontIdText = (getState(popupNotifyFontIdText).val != null) ? getState(popupNotifyFontIdText).val : '1' let v_popupNotifyIcon = (getState(popupNotifyIcon).val != null) ? getState(popupNotifyIcon).val : 'alert' @@ -1776,9 +1788,22 @@ function get_locales() { async function check_updates() { try { - if (Debug) { - console.log('Check-Updates'); - } + if (Debug) console.log('Check-Updates'); + + let Update: boolean = false; + + let InternalName: string = ''; + let Headline: string = ''; + let Text: string = ''; + + const HeadlineColor: string = '63488'; // Farbe Rot + const Button1: string = 'Nein'; + const Button1Color: string = '63488'; // Farbe Rot + const Button2: string = 'Ja'; + const Button2Color: string = '2016'; // Farbe Grün + const Timeout: number = 0; + const Layout: number = 1; + // Tasmota-Firmware-Vergleich if (existsObject(NSPanel_Path + 'Tasmota_Firmware.currentVersion') && existsObject(NSPanel_Path + 'Tasmota_Firmware.onlineVersion')) { let splitTasmotaVersion = (getState(NSPanel_Path + 'Tasmota_Firmware.currentVersion').val).split('.'); @@ -1786,9 +1811,9 @@ async function check_updates() { if (shortTasmoataVersion !== getState(NSPanel_Path + 'Tasmota_Firmware.onlineVersion').val) { if (existsState(NSPanel_Path + 'NSPanel_autoUpdate')) { if (getState(NSPanel_Path + 'NSPanel_autoUpdate').val) { - if (Debug) { - console.log('Auto-Updates eingeschaltet - Update wird durchgeführt'); - } + + if (Debug) console.log('Auto-Updates eingeschaltet - Update Tasmota wird durchgeführt'); + // Tasmota Upgrade durchführen update_tasmota_firmware(); // Aktuelle Tasmota Version = Online Tasmota Version @@ -1796,29 +1821,16 @@ async function check_updates() { await setStateAsync(NSPanel_Path + 'Tasmota_Firmware.currentVersion', { val: getState(NSPanel_Path + 'Tasmota_Firmware.onlineVersion').val, ack: true }); } else { // Auf Tasmota-Updates hinweisen - if (Debug) { - console.log('Automatische Updates aus'); - } + if (Debug) console.log('Tasmota-Firmware => Automatische Updates aus, manuelles Update nötig'); - const InternalName = 'TasmotaFirmwareUpdate'; - const Headline = 'Tasmota-Firmware Update'; - const Text = ['Es ist eine neue Version der Tasmota-Firmware', '\r\n', 'verfügbar', '\r\n', '\r\n', 'Installierte Version: ' + String(getState((String(NSPanel_Path) + 'Tasmota_Firmware.currentVersion')).val), '\r\n', 'Verfügbare Version: ' + String(getState((String(NSPanel_Path) + 'Tasmota_Firmware.onlineVersion')).val), '\r\n', '\r\n', 'Upgrade durchführen?'].join(''); - const Button1 = 'Nein'; - const Button2 = 'Ja'; - const Timeout = 0; - - await setStateAsync(popupNotifyHeading, { val: Headline, ack: false }); - await setStateAsync(popupNotifyButton1Text, { val: Button1, ack: false }); - await setStateAsync(popupNotifyButton2Text, { val: Button2, ack: false }); - await setStateAsync(popupNotifySleepTimeout, { val: Timeout, ack: false }); - await setStateAsync(popupNotifyInternalName, { val: InternalName, ack: false }); - await setStateAsync(popupNotifyText, { val: [formatDate(getDateObject((new Date().getTime())), 'TT.MM.JJJJ SS:mm:ss'), '\r\n', '\r\n', Text].join(''), ack: false }); + InternalName = 'TasmotaFirmwareUpdate'; + Headline = 'Tasmota-Firmware Update'; + Text = ['Es ist eine neue Version der Tasmota-Firmware', '\r\n', 'verfügbar', '\r\n', '\r\n', 'Installierte Version: ' + String(getState((String(NSPanel_Path) + 'Tasmota_Firmware.currentVersion')).val), '\r\n', 'Verfügbare Version: ' + String(getState((String(NSPanel_Path) + 'Tasmota_Firmware.onlineVersion')).val), '\r\n', '\r\n', 'Upgrade durchführen?'].join(''); + Update = true; } } } else { - if (Debug) { - console.log('Tasmota-Version auf NSPanel aktuell'); - } + if (Debug) console.log('Tasmota-Version auf NSPanel aktuell'); } } @@ -1827,39 +1839,28 @@ async function check_updates() { if (parseFloat(getState(NSPanel_Path + 'Berry_Driver.currentVersion').val) < berry_driver_version) { if (existsState(NSPanel_Path + 'NSPanel_autoUpdate')) { if (getState(NSPanel_Path + 'NSPanel_autoUpdate').val) { + + if (Debug) console.log('Auto-Updates eingeschaltet - Update Berry-Driver wird durchgeführt'); + // Tasmota Berry-Driver Update durchführen update_berry_driver_version(); // Aktuelle Berry-Driver Version = Online Berry-Driver Version await setStateAsync(NSPanel_Path + 'Berry_Driver.currentVersion', { val: getState(NSPanel_Path + 'Berry_Driver.onlineVersion').val, ack: true }); - if (Debug) { - console.log('Berry-Driver automatisch aktualisiert'); - } + if (Debug) console.log('Berry-Driver automatisch aktualisiert'); + } else { //Auf BerryDriver-Update hinweisen - if (Debug) { - console.log('Automatische Updates aus'); - } + if (Debug) console.log('Berry-Driver => Automatische Updates aus, manuelles Update nötig'); - const InternalName = 'BerryDriverUpdate'; - const Headline = 'Berry-Driver Update'; - const Text = ['Es ist eine neue Version des Berry-Drivers', '\r\n', '(Tasmota) verfügbar', '\r\n', '\r\n', 'Installierte Version: ' + String(getState((String(NSPanel_Path) + 'Berry_Driver.currentVersion')).val), '\r\n', 'Verfügbare Version: ' + String(berry_driver_version), '\r\n', '\r\n', 'Upgrade durchführen?'].join(''); - const Button1 = 'Nein'; - const Button2 = 'Ja'; - const Timeout = 0; - - await setStateAsync(popupNotifyHeading, { val: Headline, ack: false }); - await setStateAsync(popupNotifyButton1Text, { val: Button1, ack: false }); - await setStateAsync(popupNotifyButton2Text, { val: Button2, ack: false }); - await setStateAsync(popupNotifySleepTimeout, { val: Timeout, ack: false }); - await setStateAsync(popupNotifyInternalName, { val: InternalName, ack: false }); - await setStateAsync(popupNotifyText, { val: [formatDate(getDateObject((new Date().getTime())), 'TT.MM.JJJJ SS:mm:ss'), '\r\n', '\r\n', Text].join(''), ack: false }); + InternalName = 'BerryDriverUpdate'; + Headline = 'Berry-Driver Update'; + Text = ['Es ist eine neue Version des Berry-Drivers', '\r\n', '(Tasmota) verfügbar', '\r\n', '\r\n', 'Installierte Version: ' + String(getState((String(NSPanel_Path) + 'Berry_Driver.currentVersion')).val), '\r\n', 'Verfügbare Version: ' + String(berry_driver_version), '\r\n', '\r\n', 'Upgrade durchführen?'].join(''); + Update = true; } } } else { - if (Debug) { - console.log('Berry-Driver auf NSPanel aktuell'); - } + if (Debug) console.log('Berry-Driver auf NSPanel aktuell'); } } @@ -1868,41 +1869,43 @@ async function check_updates() { if (parseInt(getState(NSPanel_Path + 'Display_Firmware.currentVersion').val) < desired_display_firmware_version) { if (existsState(NSPanel_Path + 'NSPanel_autoUpdate')) { if (getState(NSPanel_Path + 'NSPanel_autoUpdate').val) { + + if (Debug) console.log('Auto-Updates eingeschaltet - Update TFT-Firmware wird durchgeführt'); + // TFT-Firmware Update durchführen update_tft_firmware(); // Aktuelle TFT-Firmware Version = Online TFT-Firmware Version await setStateAsync(NSPanel_Path + 'Display_Firmware.currentVersion', { val: getState(NSPanel_Path + 'Display_Firmware.onlineVersion').val, ack: true }); - if (Debug) { - console.log('Display_Firmware automatisch aktualisiert'); - } + if (Debug) console.log('Display_Firmware automatisch aktualisiert'); + } else { // Auf TFT-Firmware hinweisen - if (Debug) { - console.log('Automatische Updates aus'); - } + if (Debug) console.log('Display-Firmware => Automatische Updates aus, manuelles Update nötig'); - const InternalName = 'TFTFirmwareUpdate'; - const Headline = 'TFT-Firmware Update'; - const Text = ['Es ist eine neue Version der TFT-Firmware', '\r\n', 'verfügbar', '\r\n', '\r\n', 'Installierte Version: ' + String(getState((String(NSPanel_Path) + 'Display_Firmware.currentVersion')).val), '\r\n', 'Verfügbare Version: ' + String(desired_display_firmware_version), '\r\n', '\r\n', 'Upgrade durchführen?'].join(''); - const Button1 = 'Nein'; - const Button2 = 'Ja'; - const Timeout = 0; - - await setStateAsync(popupNotifyHeading, { val: Headline, ack: false }); - await setStateAsync(popupNotifyButton1Text, { val: Button1, ack: false }); - await setStateAsync(popupNotifyButton2Text, { val: Button2, ack: false }); - await setStateAsync(popupNotifySleepTimeout, { val: Timeout, ack: false }); - await setStateAsync(popupNotifyInternalName, { val: InternalName, ack: false }); - await setStateAsync(popupNotifyText, { val: [formatDate(getDateObject((new Date().getTime())), 'TT.MM.JJJJ SS:mm:ss'), '\r\n', '\r\n', Text].join(''), ack: false }); + InternalName = 'TFTFirmwareUpdate'; + Headline = 'TFT-Firmware Update'; + Text = ['Es ist eine neue Version der TFT-Firmware', '\r\n', 'verfügbar', '\r\n', '\r\n', 'Installierte Version: ' + String(getState((String(NSPanel_Path) + 'Display_Firmware.currentVersion')).val), '\r\n', 'Verfügbare Version: ' + String(desired_display_firmware_version), '\r\n', '\r\n', 'Upgrade durchführen?'].join(''); + Update = true; } } } else { - if (Debug) { - console.log('Display_Firmware auf NSPanel aktuell'); - } + if (Debug) console.log('Display_Firmware auf NSPanel aktuell'); } } + if (Update) { + await setStateAsync(popupNotifyHeading, { val: Headline, ack: false }); + await setStateAsync(popupNotifyHeadingColor, { val: HeadlineColor, ack: false }); + await setStateAsync(popupNotifyButton1Text, { val: Button1, ack: false }); + await setStateAsync(popupNotifyButton1TextColor, { val: Button1Color, ack: false }); + await setStateAsync(popupNotifyButton2Text, { val: Button2, ack: false }); + await setStateAsync(popupNotifyButton2TextColor, { val: Button2Color, ack: false }); + await setStateAsync(popupNotifySleepTimeout, { val: Timeout, ack: false }); + await setStateAsync(popupNotifyInternalName, { val: InternalName, ack: false }); + await setStateAsync(popupNotifyLayout, { val: Layout, ack: false }); + await setStateAsync(popupNotifyText, { val: [formatDate(getDateObject((new Date().getTime())), 'TT.MM.JJJJ SS:mm:ss'), '\r\n', '\r\n', Text].join(''), ack: false }); + } + } catch (err) { console.warn('error at function check_updates: ' + err.message); } @@ -1995,6 +1998,7 @@ function get_online_tasmota_firmware_version() { setObject(AliasPath + 'Tasmota_Firmware.onlineVersion', {type: 'channel', common: {role: 'info', name:'onlineVersion'}, native: {}}); await createAliasAsync(AliasPath + 'Tasmota_Firmware.onlineVersion.ACTUAL', NSPanel_Path + 'Tasmota_Firmware.onlineVersion', true, { type: 'string', role: 'state', name: 'ACTUAL' }); await setStateAsync(NSPanel_Path + 'Tasmota_Firmware.onlineVersion', { val: TasmotaVersionOnline, ack: true }); + if (Debug) console.log('online tasmota firmware version => ' + TasmotaVersionOnline); } catch (err) { console.warn('error result in function get_online_tasmota_firmware_version: ' + err.message); } @@ -2023,12 +2027,14 @@ function get_current_berry_driver_version() { } }, async (error, response, result) => { try { + const BerryDriverVersionCurrent: string = JSON.parse(result).nlui_driver_version; await createStateAsync(NSPanel_Path + 'Berry_Driver.currentVersion', { type: 'string' }); await setStateAsync(NSPanel_Path + 'Berry_Driver.currentVersion', { val: JSON.parse(result).nlui_driver_version, ack: true }); if (autoCreateAlias) { setObject(AliasPath + 'Display.BerryDriver', {type: 'channel', common: {role: 'info', name: 'Berry Driver'}, native: {}}); await createAliasAsync(AliasPath + 'Display.BerryDriver.ACTUAL', NSPanel_Path + 'Berry_Driver.currentVersion', true, { type: 'string', role: 'state', name: 'ACTUAL' }); } + if (Debug) console.log('current berry driver version => ' + BerryDriverVersionCurrent); } catch (err) { console.warn('error result in function get_current_berry_driver_version: ' + err.message); } @@ -2085,6 +2091,7 @@ function get_tasmota_status0() { await setStateAsync(NSPanel_Path + 'Tasmota.Wifi.RSSI', { val: Tasmota_JSON.StatusSTS.Wifi.RSSI, ack: true }); await setStateAsync(NSPanel_Path + 'Tasmota.Wifi.Signal', { val: Tasmota_JSON.StatusSTS.Wifi.Signal, ack: true }); await setStateAsync(NSPanel_Path + 'Tasmota.Product', { val: 'SONOFF NSPanel', ack: true }); + if (Debug) console.log('current tasmota firmware version => ' + tasmoVersion); } catch (err) { console.warn('error setState in function get_tasmota_status0' + err.message); } @@ -2137,6 +2144,7 @@ function get_online_berry_driver_version() { setObject(AliasPath + 'Berry_Driver.onlineVersion', {type: 'channel', common: {role: 'info', name:'onlineVersion'}, native: {}}); await createAliasAsync(AliasPath + 'Berry_Driver.onlineVersion.ACTUAL', NSPanel_Path + 'Berry_Driver.onlineVersion', true, { type: 'string', role: 'state', name: 'ACTUAL' }); await setStateAsync(NSPanel_Path + 'Berry_Driver.onlineVersion', { val: BerryDriverVersionOnline, ack: true }); + if (Debug) console.log('online berry driver version => ' + BerryDriverVersionOnline); } catch (err) { console.warn('error result in function get_online_berry_driver_version' + err.message); } @@ -2167,6 +2175,7 @@ function check_version_tft_firmware() { await createStateAsync(NSPanel_Path + 'TFT_Firmware.onlineVersion', { type: 'string' }); await setStateAsync(NSPanel_Path + 'TFT_Firmware.onlineVersion', { val: NSPanelVersion, ack: true }); + if (Debug) console.log('online TFT firmware version => ' + NSPanelVersion); } catch (err) { console.warn('error result in function check_version_tft_firmware: ' + err.message); } @@ -2194,6 +2203,7 @@ function check_online_display_firmware() { await createStateAsync(NSPanel_Path + 'Display_Firmware.onlineVersion', { type: 'string' }); await setStateAsync(NSPanel_Path + 'Display_Firmware.onlineVersion', { val: desired_display_firmware_version, ack: true }); + if (Debug) console.log('online display firmware version => ' + desired_display_firmware_version); } catch (err) { console.warn('error result in function check_online_display_firmware' + err.message); } @@ -2332,7 +2342,7 @@ on({ id: config.panelRecvTopic.substring(0, config.panelRecvTopic.length - 'RESU } else { console.log('Tasmota upgrade complete. New Version: ' + Tasmota_JSON.Info1.Version); get_tasmota_status0(); - check_updates(); + //check_updates(); } } } catch (err) { @@ -4582,7 +4592,6 @@ function GeneratePowerPage(page: PagePower): Payload[] { power_string = power_string + array_powerspeed[i+1] + '~'; // speed~ if (Debug) console.log(power_string); - console.log(power_string); } power_string = power_string.substring(0, power_string.length - 1); From f980830f2806556ea4e2d219a6fb9f10314090cb Mon Sep 17 00:00:00 2001 From: Armilar <102996011+Armilar@users.noreply.github.com> Date: Fri, 21 Apr 2023 11:29:49 +0200 Subject: [PATCH 04/12] v4.0.5.9 Add Parameter pageitem id0 to ActivePages (0_userdata) --- ioBroker/NsPanelTs_without_Examples.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ioBroker/NsPanelTs_without_Examples.ts b/ioBroker/NsPanelTs_without_Examples.ts index 3d27d15e..9ac08eed 100644 --- a/ioBroker/NsPanelTs_without_Examples.ts +++ b/ioBroker/NsPanelTs_without_Examples.ts @@ -1,6 +1,6 @@ /*----------------------------------------------------------------------- -TypeScript v4.0.5.8 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @Sternmiere / @Britzelpuf / @ravenS0ne / @TT-Tom -- abgestimmt auf TFT 50 / v4.0.5 / BerryDriver 8 / Tasmota 12.4.0 +TypeScript v4.0.5.9 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @Sternmiere / @Britzelpuf / @ravenS0ne / @TT-Tom +- abgestimmt auf TFT 50 / v4.0.5 / BerryDriver 8 / Tasmota 12.5.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 icon_mapping.ts: https://github.com/joBr99/nspanel-lovelace-ui/blob/main/ioBroker/icon_mapping.ts (TypeScript muss in global liegen) @@ -132,6 +132,7 @@ ReleaseNotes: - 11.04.2023 - v4.0.5.6 Fix function InitDimmode - 18.04.2023 - v4.0.5.7 Fix Function check_updates - 20.04.2023 - v4.0.5.8 Fix Layout Update message for TFT, Berry-Driver and Tasmota + - 21.04.2023 - v4.0.5.9 Add Parameter pageitem id0 to ActivePages (0_userdata) *********************************************************************************************************** * Für die Erstellung der Aliase durch das Skript, muss in der JavaScript Instanz "setObect" gesetzt sein! * @@ -224,6 +225,7 @@ Upgrades in Konsole: TFT EU STABLE Version : FlashNextion http://nspanel.pky.eu/lovelace-ui/github/nspanel-v4.0.5.tft --------------------------------------------------------------------------------------- */ + let Icons = new IconsSelector(); let timeoutSlider: any; let vwIconColor = []; @@ -803,7 +805,6 @@ export const config = { } }; - // _________________________________ Ab hier keine Konfiguration mehr _____________________________________ const request = require('request'); @@ -1029,6 +1030,9 @@ async function Init_ActivePageData() { if (existsState(NSPanel_Path + 'ActivePage.type') == false ) { await createStateAsync(NSPanel_Path + 'ActivePage.type', '', true, { type: 'string' }); } + if (existsState(NSPanel_Path + 'ActivePage.id0') == false ) { + await createStateAsync(NSPanel_Path + 'ActivePage.id0', '', true, { type: 'string' }); + } } catch (err) { console.warn('error at function Init_ActivePageData: ' + err.message); } @@ -2485,6 +2489,7 @@ function GeneratePage(page: Page): void { 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); switch (page.type) { case 'cardEntities': SendToPanel(GenerateEntitiesPage(page)); @@ -6366,6 +6371,7 @@ function UnsubscribeWatcher(): void { function HandleScreensaver(): void { setIfExists(NSPanel_Path + 'ActivePage.type', 'screensaver'); + setIfExists(NSPanel_Path + 'ActivePage.id0', 'screensaver'); setIfExists(NSPanel_Path + 'ActivePage.heading', 'Screensaver'); if (existsObject(NSPanel_Path + 'Config.Screensaver.ScreensaverAdvanced')) { if (getState(NSPanel_Path + 'Config.Screensaver.ScreensaverAdvanced').val) { From 3b20acc7038219305c188fe4aa21165a6c3b3678 Mon Sep 17 00:00:00 2001 From: Armilar <102996011+Armilar@users.noreply.github.com> Date: Fri, 21 Apr 2023 11:29:55 +0200 Subject: [PATCH 05/12] v4.0.5.9 Add Parameter pageitem id0 to ActivePages (0_userdata) --- ioBroker/NsPanelTs.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ioBroker/NsPanelTs.ts b/ioBroker/NsPanelTs.ts index c09c1bb7..3a28f00f 100644 --- a/ioBroker/NsPanelTs.ts +++ b/ioBroker/NsPanelTs.ts @@ -1,6 +1,6 @@ /*----------------------------------------------------------------------- -TypeScript v4.0.5.8 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @Sternmiere / @Britzelpuf / @ravenS0ne / @TT-Tom -- abgestimmt auf TFT 50 / v4.0.5 / BerryDriver 8 / Tasmota 12.4.0 +TypeScript v4.0.5.9 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @Sternmiere / @Britzelpuf / @ravenS0ne / @TT-Tom +- abgestimmt auf TFT 50 / v4.0.5 / BerryDriver 8 / Tasmota 12.5.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 icon_mapping.ts: https://github.com/joBr99/nspanel-lovelace-ui/blob/main/ioBroker/icon_mapping.ts (TypeScript muss in global liegen) @@ -132,6 +132,7 @@ ReleaseNotes: - 11.04.2023 - v4.0.5.6 Fix function InitDimmode - 18.04.2023 - v4.0.5.7 Fix Function check_updates - 20.04.2023 - v4.0.5.8 Fix Layout Update message for TFT, Berry-Driver and Tasmota + - 21.04.2023 - v4.0.5.9 Add Parameter pageitem id0 to ActivePages (0_userdata) *********************************************************************************************************** * Für die Erstellung der Aliase durch das Skript, muss in der JavaScript Instanz "setObect" gesetzt sein! * @@ -224,6 +225,7 @@ Upgrades in Konsole: TFT EU STABLE Version : FlashNextion http://nspanel.pky.eu/lovelace-ui/github/nspanel-v4.0.5.tft --------------------------------------------------------------------------------------- */ + let Icons = new IconsSelector(); let timeoutSlider: any; let vwIconColor = []; @@ -1302,7 +1304,6 @@ export const config = { } }; - // _________________________________ Ab hier keine Konfiguration mehr _____________________________________ const request = require('request'); @@ -1528,6 +1529,9 @@ async function Init_ActivePageData() { if (existsState(NSPanel_Path + 'ActivePage.type') == false ) { await createStateAsync(NSPanel_Path + 'ActivePage.type', '', true, { type: 'string' }); } + if (existsState(NSPanel_Path + 'ActivePage.id0') == false ) { + await createStateAsync(NSPanel_Path + 'ActivePage.id0', '', true, { type: 'string' }); + } } catch (err) { console.warn('error at function Init_ActivePageData: ' + err.message); } @@ -2984,6 +2988,7 @@ function GeneratePage(page: Page): void { 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); switch (page.type) { case 'cardEntities': SendToPanel(GenerateEntitiesPage(page)); @@ -6865,6 +6870,7 @@ function UnsubscribeWatcher(): void { function HandleScreensaver(): void { setIfExists(NSPanel_Path + 'ActivePage.type', 'screensaver'); + setIfExists(NSPanel_Path + 'ActivePage.id0', 'screensaver'); setIfExists(NSPanel_Path + 'ActivePage.heading', 'Screensaver'); if (existsObject(NSPanel_Path + 'Config.Screensaver.ScreensaverAdvanced')) { if (getState(NSPanel_Path + 'Config.Screensaver.ScreensaverAdvanced').val) { From a60bff301e3e65dfbb166619988e96d0414d1016 Mon Sep 17 00:00:00 2001 From: fre4242 Date: Sun, 23 Apr 2023 11:49:24 +0200 Subject: [PATCH 06/12] Fixed error wrong icon index in GeneratePowerPage --- ioBroker/NsPanelTs.ts | 8 ++++---- ioBroker/NsPanelTs_without_Examples.ts | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ioBroker/NsPanelTs.ts b/ioBroker/NsPanelTs.ts index 3a28f00f..2ddab54e 100644 --- a/ioBroker/NsPanelTs.ts +++ b/ioBroker/NsPanelTs.ts @@ -5071,17 +5071,17 @@ function GeneratePowerPage(page: PagePower): Payload[] { let arrayColorScale = [colorScale0, colorScale1, colorScale2, colorScale3, colorScale4, colorScale5, colorScale6, colorScale7, colorScale8, colorScale9, colorScale10]; - let homeIconColor = 0; if (!demoMode) { for (let obji = 1; obji < 7; obji++) { - array_icon_color[obji] = arrayColorScale[obj[obji].iconColor !== '' ? obj[obji].iconColor : 0]; + const color = obj[obji].iconColor !== '' ? obj[obji].iconColor : 0; + array_icon_color[obji] = arrayColorScale[color]; array_icon[obji] = obj[obji].icon; array_powerspeed[obji] = obj[obji].speed; array_powerstate[obji] = obj[obji].value + ' ' + obj[obji].unit ; } array_icon[0] = obj[0].icon; array_powerstate[0] = obj[0].value + ' ' + obj[0].unit; - homeIconColor = obj[0].iconColor; + array_icon_color[0] = arrayColorScale[obj[0].iconColor]; } let power_string : any = ''; @@ -5108,7 +5108,7 @@ function GeneratePowerPage(page: PagePower): Payload[] { '' + '~' + // type (ignored) '' + '~' + // intNameEntity (ignored) Icons.GetIcon(array_icon[0]) + '~' + // icon - rgb_dec565(array_icon_color[homeIconColor]) + '~' + // icon_color + rgb_dec565(array_icon_color[0]) + '~' + // icon_color '' + '~' + // display (ignored in TS) array_powerstate[0] + '~' + // optionalValue '' + '~' + // speed diff --git a/ioBroker/NsPanelTs_without_Examples.ts b/ioBroker/NsPanelTs_without_Examples.ts index 9ac08eed..56a8ce1e 100644 --- a/ioBroker/NsPanelTs_without_Examples.ts +++ b/ioBroker/NsPanelTs_without_Examples.ts @@ -4572,17 +4572,17 @@ function GeneratePowerPage(page: PagePower): Payload[] { let arrayColorScale = [colorScale0, colorScale1, colorScale2, colorScale3, colorScale4, colorScale5, colorScale6, colorScale7, colorScale8, colorScale9, colorScale10]; - let homeIconColor = 0; if (!demoMode) { for (let obji = 1; obji < 7; obji++) { - array_icon_color[obji] = arrayColorScale[obj[obji].iconColor !== '' ? obj[obji].iconColor : 0]; + const color = obj[obji].iconColor !== '' ? obj[obji].iconColor : 0; + array_icon_color[obji] = arrayColorScale[color]; array_icon[obji] = obj[obji].icon; array_powerspeed[obji] = obj[obji].speed; array_powerstate[obji] = obj[obji].value + ' ' + obj[obji].unit ; } array_icon[0] = obj[0].icon; array_powerstate[0] = obj[0].value + ' ' + obj[0].unit; - homeIconColor = obj[0].iconColor; + array_icon_color[0] = arrayColorScale[obj[0].iconColor]; } let power_string : any = ''; @@ -4609,7 +4609,7 @@ function GeneratePowerPage(page: PagePower): Payload[] { '' + '~' + // type (ignored) '' + '~' + // intNameEntity (ignored) Icons.GetIcon(array_icon[0]) + '~' + // icon - rgb_dec565(array_icon_color[homeIconColor]) + '~' + // icon_color + rgb_dec565(array_icon_color[0]) + '~' + // icon_color '' + '~' + // display (ignored in TS) array_powerstate[0] + '~' + // optionalValue '' + '~' + // speed From d04bad57403133c15432a7d3c271d6430ad945c2 Mon Sep 17 00:00:00 2001 From: Armilar <102996011+Armilar@users.noreply.github.com> Date: Sun, 23 Apr 2023 22:25:28 +0200 Subject: [PATCH 07/12] v4.0.5.10 Fixed error wrong icon index in GeneratePowerPage by fre4242 --- ioBroker/NsPanelTs.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ioBroker/NsPanelTs.ts b/ioBroker/NsPanelTs.ts index 2ddab54e..b5b87512 100644 --- a/ioBroker/NsPanelTs.ts +++ b/ioBroker/NsPanelTs.ts @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------- -TypeScript v4.0.5.9 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @Sternmiere / @Britzelpuf / @ravenS0ne / @TT-Tom +TypeScript v4.0.5.10 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @Sternmiere / @Britzelpuf / @ravenS0ne / @TT-Tom - abgestimmt auf TFT 50 / v4.0.5 / BerryDriver 8 / Tasmota 12.5.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 @@ -132,8 +132,9 @@ ReleaseNotes: - 11.04.2023 - v4.0.5.6 Fix function InitDimmode - 18.04.2023 - v4.0.5.7 Fix Function check_updates - 20.04.2023 - v4.0.5.8 Fix Layout Update message for TFT, Berry-Driver and Tasmota - - 21.04.2023 - v4.0.5.9 Add Parameter pageitem id0 to ActivePages (0_userdata) - + - 21.04.2023 - v4.0.5.9 Add Parameter pageitem id0 to ActivePages (0_userdata) + - 23.04.2023 - v4.0.5.10 v4.0.5.10 Fixed error wrong icon index in GeneratePowerPage by fre4242 + *********************************************************************************************************** * Für die Erstellung der Aliase durch das Skript, muss in der JavaScript Instanz "setObect" gesetzt sein! * *********************************************************************************************************** From 16afdd969d356037c9d5224801d40a44ca8fb4f4 Mon Sep 17 00:00:00 2001 From: Armilar <102996011+Armilar@users.noreply.github.com> Date: Sun, 23 Apr 2023 22:26:27 +0200 Subject: [PATCH 08/12] v4.0.5.10 Fixed error wrong icon index in GeneratePowerPage by fre4242 --- ioBroker/NsPanelTs_without_Examples.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ioBroker/NsPanelTs_without_Examples.ts b/ioBroker/NsPanelTs_without_Examples.ts index 56a8ce1e..dd393d1f 100644 --- a/ioBroker/NsPanelTs_without_Examples.ts +++ b/ioBroker/NsPanelTs_without_Examples.ts @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------- -TypeScript v4.0.5.9 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @Sternmiere / @Britzelpuf / @ravenS0ne / @TT-Tom +TypeScript v4.0.5.10 zur Steuerung des SONOFF NSPanel mit dem ioBroker by @Armilar / @Sternmiere / @Britzelpuf / @ravenS0ne / @TT-Tom - abgestimmt auf TFT 50 / v4.0.5 / BerryDriver 8 / Tasmota 12.5.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 @@ -133,6 +133,7 @@ ReleaseNotes: - 18.04.2023 - v4.0.5.7 Fix Function check_updates - 20.04.2023 - v4.0.5.8 Fix Layout Update message for TFT, Berry-Driver and Tasmota - 21.04.2023 - v4.0.5.9 Add Parameter pageitem id0 to ActivePages (0_userdata) + - 21.04.2023 - v4.0.5.10 Fixed error wrong icon index in GeneratePowerPage by fre4242 *********************************************************************************************************** * Für die Erstellung der Aliase durch das Skript, muss in der JavaScript Instanz "setObect" gesetzt sein! * From 7980af2d7bca92b50d21de89b781beb58a12ac47 Mon Sep 17 00:00:00 2001 From: Johannes <29555657+joBr99@users.noreply.github.com> Date: Tue, 25 Apr 2023 17:50:15 +0200 Subject: [PATCH 09/12] Update localization.py --- apps/nspanel-lovelace-ui/luibackend/localization.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/nspanel-lovelace-ui/luibackend/localization.py b/apps/nspanel-lovelace-ui/luibackend/localization.py index 28bee7c6..5450ca23 100644 --- a/apps/nspanel-lovelace-ui/luibackend/localization.py +++ b/apps/nspanel-lovelace-ui/luibackend/localization.py @@ -29,7 +29,8 @@ def lookup(path_frontend_file, path_backend_file, lookupstr): if k in res: res = res[k] if type(res) is not str: - res = "error_tnf" + #res = "error_tnf" + res = lookupstr return res def get_translation(locale, lookupstr): From 0f31026506d557b3dc56045e4d60d2188de29b10 Mon Sep 17 00:00:00 2001 From: Johannes <29555657+joBr99@users.noreply.github.com> Date: Tue, 25 Apr 2023 17:59:32 +0200 Subject: [PATCH 10/12] Update localization.py --- apps/nspanel-lovelace-ui/luibackend/localization.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/nspanel-lovelace-ui/luibackend/localization.py b/apps/nspanel-lovelace-ui/luibackend/localization.py index 5450ca23..f2a6305e 100644 --- a/apps/nspanel-lovelace-ui/luibackend/localization.py +++ b/apps/nspanel-lovelace-ui/luibackend/localization.py @@ -30,7 +30,7 @@ def lookup(path_frontend_file, path_backend_file, lookupstr): res = res[k] if type(res) is not str: #res = "error_tnf" - res = lookupstr + res = lookupstr.split(".")["-1"] return res def get_translation(locale, lookupstr): From 0d29d203eb280091824b1bacece77e3899ac6602 Mon Sep 17 00:00:00 2001 From: Johannes <29555657+joBr99@users.noreply.github.com> Date: Tue, 25 Apr 2023 18:01:55 +0200 Subject: [PATCH 11/12] Update localization.py --- apps/nspanel-lovelace-ui/luibackend/localization.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/nspanel-lovelace-ui/luibackend/localization.py b/apps/nspanel-lovelace-ui/luibackend/localization.py index f2a6305e..4b1c793a 100644 --- a/apps/nspanel-lovelace-ui/luibackend/localization.py +++ b/apps/nspanel-lovelace-ui/luibackend/localization.py @@ -30,7 +30,7 @@ def lookup(path_frontend_file, path_backend_file, lookupstr): res = res[k] if type(res) is not str: #res = "error_tnf" - res = lookupstr.split(".")["-1"] + res = lookupstr.split(".")[-1] return res def get_translation(locale, lookupstr): From 3dd41ce8c5eb99ad224c425f3c05714bd0e8cd28 Mon Sep 17 00:00:00 2001 From: Johannes <29555657+joBr99@users.noreply.github.com> Date: Tue, 25 Apr 2023 19:04:29 +0200 Subject: [PATCH 12/12] fixes #869 --- apps/nspanel-lovelace-ui/luibackend/pages.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/nspanel-lovelace-ui/luibackend/pages.py b/apps/nspanel-lovelace-ui/luibackend/pages.py index e297f857..8768d41d 100644 --- a/apps/nspanel-lovelace-ui/luibackend/pages.py +++ b/apps/nspanel-lovelace-ui/luibackend/pages.py @@ -655,8 +655,8 @@ class LuiPagesGen(object): speed = 0 if apis.ha_api.entity_exists(item.entityId): entity = apis.ha_api.get_entity(item.entityId) - if float(entity.state) > 0: - speed = str(item.entity_input_config.get("speed", 1)) + speed = str(item.entity_input_config.get("speed", 0)) + if isinstance(speed, str): speed = apis.ha_api.render_template(speed) command += f"~{speed}" self._send_mqtt_msg(command)