Compare commits

..

44 Commits

Author SHA1 Message Date
joBr99
a65b8cb2df display light detail in correct mode (add nextion2text) 2022-03-16 16:37:58 +00:00
Johannes Braun
4d27f2f485 display light detail in correct mode 2022-03-16 17:37:21 +01:00
Johannes
864f5b80d0 Update codeql-analysis.yml 2022-03-16 17:07:21 +01:00
Johannes
6b1e0f0499 Update codeql-analysis.yml 2022-03-16 17:06:31 +01:00
Johannes
13919eba01 Adding typescript to codeql 2022-03-16 17:00:48 +01:00
Johannes
5965a089f1 Merge pull request #37 from britzelpuf/main
ioBroker integration
2022-03-16 16:44:24 +01:00
britzelpuf
5ea3557ffb Update NsPanelTs.ts
Fix commenting
2022-03-16 14:58:45 +01:00
britzelpuf
c8e3960003 Cleanup
DetailEntityWatcher for sending changes to display
2022-03-16 14:55:00 +01:00
Mad-C
9aec695f89 Basic Typescript for ioBroker. 2022-03-16 13:18:53 +01:00
joBr99
14bc505c79 redesign of light detail page, addded screen for icons on therm page (add nextion2text) 2022-03-15 17:38:02 +00:00
Johannes Braun
7504120e83 redesign of light detail page, addded screen for icons on therm page 2022-03-15 18:37:38 +01:00
joBr99
c1d15385c3 fixed icon (add nextion2text) 2022-03-14 22:09:36 +00:00
Johannes
a49b12c204 fixed icon 2022-03-14 23:09:14 +01:00
Johannes
96b136c194 change missing colors 2022-03-14 19:52:46 +01:00
Johannes
292c372060 Added Icons on Therm Page 2022-03-14 19:14:10 +01:00
joBr99
9c79197a59 changed therm button command (add nextion2text) 2022-03-14 18:00:31 +00:00
Johannes Braun
ac167a36ea changed therm button command 2022-03-14 19:00:11 +01:00
joBr99
989f085649 Merge branch 'main' of github.com:joBr99/nspanel-widget-ui (add nextion2text) 2022-03-14 17:50:18 +00:00
Johannes Braun
f231ea690b Merge branch 'main' of github.com:joBr99/nspanel-widget-ui 2022-03-14 18:49:56 +01:00
Johannes Braun
d18fbe269d fixed cmd len therm page 2022-03-14 18:49:24 +01:00
joBr99
27ff4f0581 changed msg format implemented buttons (add nextion2text) 2022-03-14 17:32:06 +00:00
Johannes Braun
b9e70f7b89 changed msg format implemented buttons 2022-03-14 18:31:39 +01:00
joBr99
bea91b01a9 fixed active color setting (add nextion2text) 2022-03-14 16:59:29 +00:00
Johannes Braun
0bcacd6ba6 fixed active color setting 2022-03-14 17:59:05 +01:00
joBr99
e3f5aad46b Merge branch 'main' of github.com:joBr99/nspanel-widget-ui (add nextion2text) 2022-03-14 16:18:44 +00:00
Johannes Braun
f367758445 Merge branch 'main' of github.com:joBr99/nspanel-widget-ui 2022-03-14 17:18:18 +01:00
Johannes Braun
9f0f670db5 fixed state attributes 2022-03-14 17:18:03 +01:00
joBr99
36d0685f3d added some icons (add nextion2text) 2022-03-14 15:32:25 +00:00
Johannes Braun
f0ee420d52 added some icons 2022-03-14 16:31:48 +01:00
Johannes Braun
daa1b1ee0f added button attr thermo page 2022-03-14 16:21:00 +01:00
Johannes
35d97fa0bd Merge branch 'main' of https://github.com/joBr99/nspanel-lovelace-ui 2022-03-14 01:00:32 +01:00
Johannes
0e76fc37de fix http headers 2022-03-14 01:00:24 +01:00
joBr99
0cb06c752f Merge branch 'main' of https://github.com/joBr99/nspanel-lovelace-ui (add nextion2text) 2022-03-13 23:30:06 +00:00
Johannes
cf9f14f12a Merge branch 'main' of https://github.com/joBr99/nspanel-lovelace-ui 2022-03-14 00:29:44 +01:00
Johannes
a3a6487e13 fix cardMedia from startupPage 2022-03-14 00:29:29 +01:00
joBr99
bd9709fda6 enable recmod before each startup event (add nextion2text) 2022-03-13 22:55:30 +00:00
Johannes
ac237ff2ed enable recmod before each startup event 2022-03-13 23:55:09 +01:00
Johannes
6353d67335 Merge branch 'main' of https://github.com/joBr99/nspanel-lovelace-ui 2022-03-13 23:28:12 +01:00
Johannes
c9b73303cf added beta driver based on ns-flash 2022-03-13 23:27:48 +01:00
Johannes
580681eb73 Implemented safe values for thermo page 2022-03-13 23:23:58 +01:00
Johannes
dc2aea3ffc Update nspanel-lovelace-ui.py 2022-03-13 19:12:41 +01:00
Johannes
4af3449491 Update nspanel-lovelace-ui.py 2022-03-13 19:09:25 +01:00
Johannes
85d1de3c19 Update nspanel-lovelace-ui.py 2022-03-13 19:07:07 +01:00
Johannes
cdda0d9601 fix for device_class in sensor item 2022-03-13 18:24:07 +01:00
14 changed files with 1838 additions and 221 deletions

View File

@@ -14,13 +14,14 @@ name: "CodeQL"
on:
push:
branches: [ main ]
paths:
- '**.py'
# paths:
# - '**.py'
# - '**.ts'
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
paths:
- '**.py'
# paths:
# - '**.py'
schedule:
- cron: '36 14 * * 3'

View File

@@ -117,7 +117,9 @@ The following message can be used to update the content on the cardEntities Page
### cardThermo Page
`entityUpd,*internalNameEntiy*,*heading*,*currentTemp*,*destTemp*,*status*,*minTemp*,*maxTemp*,*stepTemp*`
`entityUpd,*internalNameEntiy*,*heading*,*currentTemp*,*destTemp*,*status*,*minTemp*,*maxTemp*,*stepTemp*[[,*iconId*,*activeColor*,*state*,*hvac_action*]]`
`[[]]` are not part of the command, this part repeats 9 times for the buttons
### cardMedia Page
@@ -179,6 +181,8 @@ The following message can be used to update the content on the cardEntities Page
`event,tempUpd,*pageNumber*,*entityName*,*temperature*`
`event,buttonPress,*pageNumber*,*tHeading*,*entityName,1,hvac_action,*hvac_action*
### cardMedia Page
`event,buttonPress,1,tHeading,internalNameEntity,1,media-back`
@@ -222,6 +226,11 @@ ID | Icon
24 | ![weather-windy](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/weather-windy.svg)
25 | ![weather-windy-variant](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/weather-windy-variant.svg)
26 | ![water-percent](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/water-percent.svg)
27 | ![power](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/power.svg)
28 | ![fire](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/fire.svg)
29 | ![calendar-sync](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/calendar-sync.svg)
30 | ![fan](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/fan.svg)
31 | ![snowflake](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/snowflake.svg)
# Design Guidelines for Nextion HMI Project

View File

@@ -92,56 +92,56 @@ Variable (string) strCommand
Variable (string) type1
Attributes
ID : 47
ID : 46
Scope : local
Text :
Max. Text Size: 10
Variable (string) type2
Attributes
ID : 48
ID : 47
Scope : local
Text :
Max. Text Size: 10
Variable (string) type3
Attributes
ID : 49
ID : 48
Scope : local
Text :
Max. Text Size: 10
Variable (string) type4
Attributes
ID : 50
ID : 49
Scope : local
Text :
Max. Text Size: 10
Variable (string) entn1
Attributes
ID : 51
ID : 50
Scope : local
Text :
Max. Text Size: 50
Variable (string) entn2
Attributes
ID : 52
ID : 51
Scope : local
Text :
Max. Text Size: 50
Variable (string) entn3
Attributes
ID : 53
ID : 52
Scope : local
Text :
Max. Text Size: 50
Variable (string) entn4
Attributes
ID : 54
ID : 53
Scope : local
Text :
Max. Text Size: 50
@@ -1341,7 +1341,7 @@ Button bNext
Button bText1
Attributes
ID : 39
ID : 38
Scope : local
Dragging : 0
Disable release event after dragging: 0
@@ -1395,7 +1395,7 @@ Button bText1
Button bText2
Attributes
ID : 40
ID : 39
Scope : local
Dragging : 0
Disable release event after dragging: 0
@@ -1449,7 +1449,7 @@ Button bText2
Button bText3
Attributes
ID : 41
ID : 40
Scope : local
Dragging : 0
Disable release event after dragging: 0
@@ -1503,7 +1503,7 @@ Button bText3
Button bText4
Attributes
ID : 42
ID : 41
Scope : local
Dragging : 0
Disable release event after dragging: 0
@@ -1791,7 +1791,7 @@ Hotspot mSpecial
Hotspot m2
Attributes
ID : 43
ID : 42
Scope : local
Dragging : 0
Disable release event after dragging: 0
@@ -1806,7 +1806,7 @@ Hotspot m2
Effect Time : 300
Events
Touch Release Event
Touch Press Event
pageIcons.tTmp1.txt=tEntity3.txt
pageIcons.tTmp2.txt=entn3.txt
if(type3.txt=="shutter")
@@ -1822,7 +1822,7 @@ Hotspot m2
Hotspot m1
Attributes
ID : 44
ID : 43
Scope : local
Dragging : 0
Disable release event after dragging: 0
@@ -1837,7 +1837,7 @@ Hotspot m1
Effect Time : 300
Events
Touch Release Event
Touch Press Event
pageIcons.tTmp1.txt=tEntity2.txt
pageIcons.tTmp2.txt=entn2.txt
if(type2.txt=="shutter")
@@ -1853,7 +1853,7 @@ Hotspot m1
Hotspot m0
Attributes
ID : 45
ID : 44
Scope : local
Dragging : 0
Disable release event after dragging: 0
@@ -1868,7 +1868,7 @@ Hotspot m0
Effect Time : 300
Events
Touch Release Event
Touch Press Event
pageIcons.tTmp1.txt=tEntity1.txt
pageIcons.tTmp2.txt=entn1.txt
if(type1.txt=="shutter")
@@ -1884,7 +1884,7 @@ Hotspot m0
Hotspot m3
Attributes
ID : 46
ID : 45
Scope : local
Dragging : 0
Disable release event after dragging: 0
@@ -1899,7 +1899,7 @@ Hotspot m3
Effect Time : 300
Events
Touch Release Event
Touch Press Event
pageIcons.tTmp1.txt=tEntity4.txt
pageIcons.tTmp2.txt=entn4.txt
if(type4.txt=="shutter")
@@ -2424,7 +2424,7 @@ Timer tmSleep
TouchCap tc0
Attributes
ID : 38
ID : 54
Scope: local
Value: 0

View File

@@ -30,11 +30,16 @@ Page cardThermo
vis xTempMax,0
vis xTempStep,0
//tEntity.txt=tHeading.txt
//disable buttons that are not implemented
vis t7,0
vis t6,0
vis t5,0
//
// disable all buttons
vis bt0,0
vis bt1,0
vis bt2,0
vis bt3,0
vis bt4,0
vis bt5,0
vis bt6,0
vis bt7,0
vis bt8,0
//page open event
// event,pageOpen,cardThermo,pageNumber
// craft command
@@ -60,15 +65,78 @@ Variable (string) strCommand
ID : 7
Scope : local
Text :
Max. Text Size: 100
Max. Text Size: 250
Variable (string) entn
Attributes
ID : 25
ID : 22
Scope : local
Text :
Max. Text Size: 50
Variable (string) va0
Attributes
ID : 33
Scope : local
Text :
Max. Text Size: 10
Variable (string) va1
Attributes
ID : 34
Scope : local
Text :
Max. Text Size: 10
Variable (string) va2
Attributes
ID : 35
Scope : local
Text :
Max. Text Size: 10
Variable (string) va3
Attributes
ID : 36
Scope : local
Text :
Max. Text Size: 10
Variable (string) va4
Attributes
ID : 37
Scope : local
Text :
Max. Text Size: 10
Variable (string) va5
Attributes
ID : 38
Scope : local
Text :
Max. Text Size: 10
Variable (string) va6
Attributes
ID : 39
Scope : local
Text :
Max. Text Size: 10
Variable (string) va7
Attributes
ID : 40
Scope : local
Text :
Max. Text Size: 10
Variable (string) va8
Attributes
ID : 41
Scope : local
Text :
Max. Text Size: 10
Number nPageDisp
Attributes
ID : 5
@@ -101,7 +169,7 @@ Number nPageDisp
XFloat xTempCurr
Attributes
ID : 17
ID : 14
Scope : local
Dragging : 0
Disable release event after dragging: 0
@@ -122,7 +190,7 @@ XFloat xTempCurr
Font Color : 65535
Horizontal Alignment : center
Vertical Alignment : center
Value : 215
Value : 0
Significant digits left : 0
Significant digits right : 1
Word wrap : enabled
@@ -131,7 +199,7 @@ XFloat xTempCurr
XFloat xTempDest
Attributes
ID : 19
ID : 16
Scope : local
Dragging : 0
Disable release event after dragging: 0
@@ -152,7 +220,7 @@ XFloat xTempDest
Font Color : 65535
Horizontal Alignment : center
Vertical Alignment : center
Value : 215
Value : 0
Significant digits left : 0
Significant digits right : 1
Word wrap : enabled
@@ -161,7 +229,7 @@ XFloat xTempDest
XFloat xTempMin
Attributes
ID : 20
ID : 17
Scope : local
Dragging : 0
Disable release event after dragging: 0
@@ -191,7 +259,7 @@ XFloat xTempMin
XFloat xTempMax
Attributes
ID : 21
ID : 18
Scope : local
Dragging : 0
Disable release event after dragging: 0
@@ -221,7 +289,7 @@ XFloat xTempMax
XFloat xTempStep
Attributes
ID : 22
ID : 19
Scope : local
Dragging : 0
Disable release event after dragging: 0
@@ -423,97 +491,7 @@ Text tStatus
Horizontal Alignment : center
Vertical Alignment : center
Input Type : character
Text : Heizung
Max. Text Size : 10
Word wrap : disabled
Horizontal Spacing : 0
Vertical Spacing : 0
Text t5
Attributes
ID : 12
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 263
y coordinate : 218
Width : 30
Height : 30
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : flat
Associated Keyboard : none
Font ID : 1
Back. Color : 6371
Font Color : 50712
Horizontal Alignment : center
Vertical Alignment : center
Input Type : character
Text : 
Max. Text Size : 10
Word wrap : disabled
Horizontal Spacing : 0
Vertical Spacing : 0
Text t6
Attributes
ID : 13
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 211
y coordinate : 218
Width : 30
Height : 30
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : flat
Associated Keyboard : none
Font ID : 1
Back. Color : 6371
Font Color : 64512
Horizontal Alignment : center
Vertical Alignment : center
Input Type : character
Text : 
Max. Text Size : 10
Word wrap : disabled
Horizontal Spacing : 0
Vertical Spacing : 0
Text t7
Attributes
ID : 14
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 160
y coordinate : 218
Width : 30
Height : 30
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : flat
Associated Keyboard : none
Font ID : 1
Back. Color : 6371
Font Color : 50712
Horizontal Alignment : center
Vertical Alignment : center
Input Type : character
Text : 
Text :
Max. Text Size : 10
Word wrap : disabled
Horizontal Spacing : 0
@@ -521,7 +499,7 @@ Text t7
Text t2
Attributes
ID : 18
ID : 15
Scope : local
Dragging : 0
Disable release event after dragging: 0
@@ -622,7 +600,7 @@ Button bNext
Button bDown
Attributes
ID : 15
ID : 12
Scope : local
Dragging : 0
Disable release event after dragging: 0
@@ -678,7 +656,7 @@ Button bDown
Button bUp
Attributes
ID : 16
ID : 13
Scope : local
Dragging : 0
Disable release event after dragging: 0
@@ -732,7 +710,7 @@ Button bUp
Button bPrev
Attributes
ID : 26
ID : 23
Scope : local
Dragging : 0
Disable release event after dragging: 0
@@ -784,6 +762,483 @@ Button bPrev
prints tSend.txt,0
prints crcval,2
Dual-state Button bt0
Attributes
ID : 24
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 115
y coordinate : 223
Width : 31
Height : 31
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : flat
Font ID : 1
Back. Color (Unpressed) : 6371
Back. Picture ID (Pressed) : 65535
Back. Color (Pressed) : 6371
Font Color (Unpressed) : 50712
Font Color (Pressed) : 64512
Horizontal Alignment : center
Vertical Alignment : center
State : unpressed
Text : 
Max. Text Size : 10
Word wrap : disabled
Horizontal Spacing : 0
Vertical Spacing : 0
Events
Touch Press Event
//craft command
// convert pageNumber and write to tTmp
covx nPage,tTmp.txt,0,0
tSend.txt="event,buttonPress,"+tTmp.txt+","
tSend.txt+=tHeading.txt+","
tSend.txt+=entn.txt+","
tSend.txt+="1,hvac_action,"+va0.txt
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Dual-state Button bt1
Attributes
ID : 25
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 162
y coordinate : 223
Width : 31
Height : 31
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : flat
Font ID : 1
Back. Color (Unpressed) : 6371
Back. Picture ID (Pressed) : 65535
Back. Color (Pressed) : 6371
Font Color (Unpressed) : 50712
Font Color (Pressed) : 64512
Horizontal Alignment : center
Vertical Alignment : center
State : unpressed
Text : 
Max. Text Size : 10
Word wrap : disabled
Horizontal Spacing : 0
Vertical Spacing : 0
Events
Touch Press Event
//craft command
// convert pageNumber and write to tTmp
covx nPage,tTmp.txt,0,0
tSend.txt="event,buttonPress,"+tTmp.txt+","
tSend.txt+=tHeading.txt+","
tSend.txt+=entn.txt+","
tSend.txt+="1,hvac_action,"+va1.txt
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Dual-state Button bt2
Attributes
ID : 26
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 209
y coordinate : 223
Width : 31
Height : 31
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : flat
Font ID : 1
Back. Color (Unpressed) : 6371
Back. Picture ID (Pressed) : 65535
Back. Color (Pressed) : 6371
Font Color (Unpressed) : 50712
Font Color (Pressed) : 64512
Horizontal Alignment : center
Vertical Alignment : center
State : unpressed
Text : 
Max. Text Size : 10
Word wrap : disabled
Horizontal Spacing : 0
Vertical Spacing : 0
Events
Touch Press Event
//craft command
// convert pageNumber and write to tTmp
covx nPage,tTmp.txt,0,0
tSend.txt="event,buttonPress,"+tTmp.txt+","
tSend.txt+=tHeading.txt+","
tSend.txt+=entn.txt+","
tSend.txt+="1,hvac_action,"+va2.txt
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Dual-state Button bt3
Attributes
ID : 27
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 256
y coordinate : 223
Width : 31
Height : 31
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : flat
Font ID : 1
Back. Color (Unpressed) : 6371
Back. Picture ID (Pressed) : 65535
Back. Color (Pressed) : 6371
Font Color (Unpressed) : 50712
Font Color (Pressed) : 64512
Horizontal Alignment : center
Vertical Alignment : center
State : unpressed
Text : 
Max. Text Size : 10
Word wrap : disabled
Horizontal Spacing : 0
Vertical Spacing : 0
Events
Touch Press Event
//craft command
// convert pageNumber and write to tTmp
covx nPage,tTmp.txt,0,0
tSend.txt="event,buttonPress,"+tTmp.txt+","
tSend.txt+=tHeading.txt+","
tSend.txt+=entn.txt+","
tSend.txt+="1,hvac_action,"+va3.txt
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Dual-state Button bt4
Attributes
ID : 28
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 303
y coordinate : 223
Width : 31
Height : 31
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : flat
Font ID : 1
Back. Color (Unpressed) : 6371
Back. Picture ID (Pressed) : 65535
Back. Color (Pressed) : 6371
Font Color (Unpressed) : 50712
Font Color (Pressed) : 64512
Horizontal Alignment : center
Vertical Alignment : center
State : unpressed
Text : 
Max. Text Size : 10
Word wrap : disabled
Horizontal Spacing : 0
Vertical Spacing : 0
Events
Touch Press Event
//craft command
// convert pageNumber and write to tTmp
covx nPage,tTmp.txt,0,0
tSend.txt="event,buttonPress,"+tTmp.txt+","
tSend.txt+=tHeading.txt+","
tSend.txt+=entn.txt+","
tSend.txt+="1,hvac_action,"+va4.txt
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Dual-state Button bt5
Attributes
ID : 29
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 136
y coordinate : 223
Width : 31
Height : 31
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : flat
Font ID : 1
Back. Color (Unpressed) : 6371
Back. Picture ID (Pressed) : 65535
Back. Color (Pressed) : 6371
Font Color (Unpressed) : 50712
Font Color (Pressed) : 64512
Horizontal Alignment : center
Vertical Alignment : center
State : pressed
Text : 
Max. Text Size : 10
Word wrap : disabled
Horizontal Spacing : 0
Vertical Spacing : 0
Events
Touch Press Event
//craft command
// convert pageNumber and write to tTmp
covx nPage,tTmp.txt,0,0
tSend.txt="event,buttonPress,"+tTmp.txt+","
tSend.txt+=tHeading.txt+","
tSend.txt+=entn.txt+","
tSend.txt+="1,hvac_action,"+va5.txt
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Dual-state Button bt6
Attributes
ID : 30
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 183
y coordinate : 223
Width : 31
Height : 31
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : flat
Font ID : 1
Back. Color (Unpressed) : 6371
Back. Picture ID (Pressed) : 65535
Back. Color (Pressed) : 6371
Font Color (Unpressed) : 50712
Font Color (Pressed) : 64512
Horizontal Alignment : center
Vertical Alignment : center
State : pressed
Text : 
Max. Text Size : 10
Word wrap : disabled
Horizontal Spacing : 0
Vertical Spacing : 0
Events
Touch Press Event
//craft command
// convert pageNumber and write to tTmp
covx nPage,tTmp.txt,0,0
tSend.txt="event,buttonPress,"+tTmp.txt+","
tSend.txt+=tHeading.txt+","
tSend.txt+=entn.txt+","
tSend.txt+="1,hvac_action,"+va6.txt
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Dual-state Button bt7
Attributes
ID : 31
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 230
y coordinate : 223
Width : 31
Height : 31
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : flat
Font ID : 1
Back. Color (Unpressed) : 6371
Back. Picture ID (Pressed) : 65535
Back. Color (Pressed) : 6371
Font Color (Unpressed) : 50712
Font Color (Pressed) : 64512
Horizontal Alignment : center
Vertical Alignment : center
State : pressed
Text : 
Max. Text Size : 10
Word wrap : disabled
Horizontal Spacing : 0
Vertical Spacing : 0
Events
Touch Press Event
//craft command
// convert pageNumber and write to tTmp
covx nPage,tTmp.txt,0,0
tSend.txt="event,buttonPress,"+tTmp.txt+","
tSend.txt+=tHeading.txt+","
tSend.txt+=entn.txt+","
tSend.txt+="1,hvac_action,"+va7.txt
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Dual-state Button bt8
Attributes
ID : 32
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 277
y coordinate : 223
Width : 31
Height : 31
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : flat
Font ID : 1
Back. Color (Unpressed) : 6371
Back. Picture ID (Pressed) : 65535
Back. Color (Pressed) : 6371
Font Color (Unpressed) : 50712
Font Color (Pressed) : 64512
Horizontal Alignment : center
Vertical Alignment : center
State : pressed
Text : 
Max. Text Size : 10
Word wrap : disabled
Horizontal Spacing : 0
Vertical Spacing : 0
Events
Touch Press Event
//craft command
// convert pageNumber and write to tTmp
covx nPage,tTmp.txt,0,0
tSend.txt="event,buttonPress,"+tTmp.txt+","
tSend.txt+=tHeading.txt+","
tSend.txt+=entn.txt+","
tSend.txt+="1,hvac_action,"+va8.txt
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Timer tmSerial
Attributes
ID : 6
@@ -859,6 +1314,178 @@ Timer tmSerial
//tempStep
spstr strCommand.txt,tTmp.txt,",",8
covx tTmp.txt,xTempStep.val,0,0
// disable all buttons
vis bt0,0
vis bt1,0
vis bt2,0
vis bt3,0
vis bt4,0
vis bt5,0
vis bt6,0
vis bt7,0
vis bt8,0
//bt0
spstr strCommand.txt,tTmp.txt,",",9
if(tTmp.txt!="")
{
// set icon
covx tTmp.txt,sys0,0,0
substr pageIcons.tIcons.txt,bt0.txt,sys0,1
// set text color on active state
spstr strCommand.txt,tTmp.txt,",",10
covx tTmp.txt,bt0.pco2,0,0
// set state
spstr strCommand.txt,tTmp.txt,",",11
covx tTmp.txt,bt0.val,0,0
// save action
spstr strCommand.txt,va0.txt,",",12
//enable
vis bt0,1
}
//bt1
spstr strCommand.txt,tTmp.txt,",",13
if(tTmp.txt!="")
{
// set icon
covx tTmp.txt,sys0,0,0
substr pageIcons.tIcons.txt,bt1.txt,sys0,1
// set text color on active state
spstr strCommand.txt,tTmp.txt,",",14
covx tTmp.txt,bt1.pco2,0,0
// set state
spstr strCommand.txt,tTmp.txt,",",15
covx tTmp.txt,bt1.val,0,0
// save action
spstr strCommand.txt,va1.txt,",",16
//enable
vis bt1,1
}
//bt2
spstr strCommand.txt,tTmp.txt,",",17
if(tTmp.txt!="")
{
// set icon
covx tTmp.txt,sys0,0,0
substr pageIcons.tIcons.txt,bt2.txt,sys0,1
// set text color on active state
spstr strCommand.txt,tTmp.txt,",",18
covx tTmp.txt,bt2.pco2,0,0
// set state
spstr strCommand.txt,tTmp.txt,",",19
covx tTmp.txt,bt2.val,0,0
// save action
spstr strCommand.txt,va2.txt,",",20
//enable
vis bt2,1
}
//bt3
spstr strCommand.txt,tTmp.txt,",",21
if(tTmp.txt!="")
{
// set icon
covx tTmp.txt,sys0,0,0
substr pageIcons.tIcons.txt,bt3.txt,sys0,1
// set text color on active state
spstr strCommand.txt,tTmp.txt,",",22
covx tTmp.txt,bt3.pco2,0,0
// set state
spstr strCommand.txt,tTmp.txt,",",23
covx tTmp.txt,bt3.val,0,0
// save action
spstr strCommand.txt,va3.txt,",",24
//enable
vis bt3,1
}
//bt4
spstr strCommand.txt,tTmp.txt,",",25
if(tTmp.txt!="")
{
// set icon
covx tTmp.txt,sys0,0,0
substr pageIcons.tIcons.txt,bt4.txt,sys0,1
// set text color on active state
spstr strCommand.txt,tTmp.txt,",",26
covx tTmp.txt,bt4.pco2,0,0
// set state
spstr strCommand.txt,tTmp.txt,",",27
covx tTmp.txt,bt4.val,0,0
// save action
spstr strCommand.txt,va4.txt,",",28
//enable
vis bt4,1
}
//bt5
spstr strCommand.txt,tTmp.txt,",",29
if(tTmp.txt!="")
{
// set icon
covx tTmp.txt,sys0,0,0
substr pageIcons.tIcons.txt,bt5.txt,sys0,1
// set text color on active state
spstr strCommand.txt,tTmp.txt,",",30
covx tTmp.txt,bt5.pco2,0,0
// set state
spstr strCommand.txt,tTmp.txt,",",31
covx tTmp.txt,bt5.val,0,0
// save action
spstr strCommand.txt,va5.txt,",",32
//enable
vis bt5,1
}
//bt6
spstr strCommand.txt,tTmp.txt,",",33
if(tTmp.txt!="")
{
// set icon
covx tTmp.txt,sys0,0,0
substr pageIcons.tIcons.txt,bt6.txt,sys0,1
// set text color on active state
spstr strCommand.txt,tTmp.txt,",",34
covx tTmp.txt,bt6.pco2,0,0
// set state
spstr strCommand.txt,tTmp.txt,",",35
covx tTmp.txt,bt6.val,0,0
// save action
spstr strCommand.txt,va6.txt,",",36
//enable
vis bt6,1
}
//bt7
spstr strCommand.txt,tTmp.txt,",",37
if(tTmp.txt!="")
{
// set icon
covx tTmp.txt,sys0,0,0
substr pageIcons.tIcons.txt,bt7.txt,sys0,1
// set text color on active state
spstr strCommand.txt,tTmp.txt,",",38
covx tTmp.txt,bt7.pco2,0,0
// set state
spstr strCommand.txt,tTmp.txt,",",39
covx tTmp.txt,bt7.val,0,0
// save action
spstr strCommand.txt,va7.txt,",",40
//enable
vis bt7,1
}
//bt8
spstr strCommand.txt,tTmp.txt,",",41
if(tTmp.txt!="")
{
// set icon
covx tTmp.txt,sys0,0,0
substr pageIcons.tIcons.txt,bt8.txt,sys0,1
// set text color on active state
spstr strCommand.txt,tTmp.txt,",",42
covx tTmp.txt,bt8.pco2,0,0
// set state
spstr strCommand.txt,tTmp.txt,",",43
covx tTmp.txt,bt8.val,0,0
// save action
spstr strCommand.txt,va8.txt,",",44
//enable
vis bt8,1
}
}
if(tInstruction.txt=="time")
{
@@ -945,7 +1572,7 @@ Timer tmSerial
Timer tmSleep
Attributes
ID : 23
ID : 20
Scope : local
Period (ms): 1000
Enabled : yes
@@ -965,7 +1592,7 @@ Timer tmSleep
TouchCap tc0
Attributes
ID : 24
ID : 21
Scope: local
Value: 0

View File

@@ -32,20 +32,20 @@ cardMedia
114 Unique line(s) of event code
pageStartup
19 Component(s)
135 Line(s) of event code
105 Unique line(s) of event code
popupLight
27 Component(s)
296 Line(s) of event code
152 Unique line(s) of event code
140 Line(s) of event code
107 Unique line(s) of event code
popupShutter
19 Component(s)
148 Line(s) of event code
84 Unique line(s) of event code
cardThermo
popupLight
27 Component(s)
201 Line(s) of event code
120 Unique line(s) of event code
290 Line(s) of event code
149 Unique line(s) of event code
cardThermo
42 Component(s)
450 Line(s) of event code
220 Unique line(s) of event code
cardEntities
55 Component(s)
824 Line(s) of event code
@@ -53,6 +53,6 @@ cardEntities
Total
12 Page(s)
258 Component(s)
2251 Line(s) of event code
578 Unique line(s) of event code
273 Component(s)
2499 Line(s) of event code
670 Unique line(s) of event code

View File

@@ -72,7 +72,7 @@ Text tIcons
Horizontal Alignment : left
Vertical Alignment : top
Input Type : character
Text : 
Text : 
Max. Text Size : 100
Word wrap : enabled
Horizontal Spacing : 0

View File

@@ -236,9 +236,9 @@ Text tInstruction
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 246
x coordinate : 163
y coordinate : 0
Width : 100
Width : 119
Height : 30
Effect : load
Effect Priority : 0
@@ -266,9 +266,9 @@ Text tId
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 355
x coordinate : 282
y coordinate : 0
Width : 39
Width : 125
Height : 30
Effect : load
Effect Priority : 0
@@ -459,6 +459,7 @@ Button bSendStartup
Events
Touch Press Event
recmod=1
bauds=115200
// startup event
tSend.txt="event,startup,"+tVersion.txt
@@ -607,6 +608,10 @@ Timer tmSerial
{
page popupNotify
}
if(tId.txt=="cardMedia")
{
page cardMedia
}
}
// end of user code
udelete payloadLength-1

View File

@@ -54,8 +54,9 @@ Page popupLight
vis hTempSlider,0
//disable color wheel components by default
vis bColor,0
vis pColorWheel,0
vis t0,0
vis pColorWheel,0
//vis t0,0
Variable (string) strCommand
Attributes
@@ -97,8 +98,8 @@ Text tEntity
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 63
y coordinate : 37
x coordinate : 92
y coordinate : 21
Width : 263
Height : 30
Effect : load
@@ -127,8 +128,8 @@ Text tIcon1
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 10
y coordinate : 38
x coordinate : 11
y coordinate : 21
Width : 45
Height : 30
Effect : load
@@ -158,7 +159,7 @@ Text t1
Send Component ID : disabled
Opacity : 127
x coordinate : 10
y coordinate : 133
y coordinate : 226
Width : 100
Height : 30
Effect : load
@@ -188,7 +189,7 @@ Text t2
Send Component ID : disabled
Opacity : 127
x coordinate : 10
y coordinate : 173
y coordinate : 267
Width : 45
Height : 30
Effect : load
@@ -218,7 +219,7 @@ Text t3
Send Component ID : disabled
Opacity : 127
x coordinate : 10
y coordinate : 251
y coordinate : 181
Width : 45
Height : 30
Effect : load
@@ -248,7 +249,7 @@ Text t4
Send Component ID : disabled
Opacity : 127
x coordinate : 9
y coordinate : 213
y coordinate : 143
Width : 116
Height : 30
Effect : load
@@ -280,7 +281,7 @@ Text tSend
x coordinate : 0
y coordinate : 0
Width : 348
Height : 22
Height : 7
Effect : load
Effect Priority : 0
Effect Time : 300
@@ -397,8 +398,8 @@ Text t0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 76
y coordinate : 89
x coordinate : 9
y coordinate : 80
Width : 64
Height : 30
Effect : load
@@ -444,10 +445,10 @@ Picture pColorWheel
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 142
y coordinate : 87
Width : 213
Height : 213
x coordinate : 167
y coordinate : 69
Width : 160
Height : 160
Effect : load
Effect Priority : 0
Effect Time : 300
@@ -491,7 +492,7 @@ Slider hBrightness
Send Component ID : disabled
Opacity : 127
x coordinate : 61
y coordinate : 167
y coordinate : 261
Width : 335
Height : 43
Effect : load
@@ -559,7 +560,7 @@ Slider hTempSlider
Send Component ID : disabled
Opacity : 127
x coordinate : 61
y coordinate : 248
y coordinate : 178
Width : 335
Height : 44
Effect : load
@@ -662,8 +663,8 @@ Button bColor
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 9
y coordinate : 78
x coordinate : 89
y coordinate : 68
Width : 50
Height : 50
Effect : load
@@ -693,11 +694,11 @@ Button bColor
mode.val=0
//enable color wheel
vis pColorWheel,1
vis t0,1
//vis t0,1
//disable brightness
vis t1,0
vis t2,0
vis hBrightness,0
//vis t1,0
//vis t2,0
//vis hBrightness,0
//disable color temp
vis t4,0
vis t3,0
@@ -707,14 +708,14 @@ Button bColor
mode.val=1
//disable color wheel
vis pColorWheel,0
vis t0,0
if(mode_bright.val==1)
{
//enable brightness
vis t1,1
vis t2,1
vis hBrightness,1
}
//vis t0,0
//if(mode_bright.val==1)
//{
// //enable brightness
// vis t1,1
// vis t2,1
// vis hBrightness,1
//}
if(mode_temp.val==1)
{
//enable color temp
@@ -733,7 +734,7 @@ Dual-state Button btOnOff1
Send Component ID : disabled
Opacity : 127
x coordinate : 370
y coordinate : 75
y coordinate : 79
Width : 50
Height : 50
Effect : load
@@ -852,28 +853,32 @@ Timer tmSerial
spstr strCommand.txt,tTmp.txt,",",1
covx tTmp.txt,sys0,0,0
btOnOff1.val=sys0
// get Brightness value
spstr strCommand.txt,tTmp.txt,",",2
if(tTmp.txt=="disable")
{
vis t1,0
vis t2,0
vis hBrightness,0
mode_bright.val=0
}else
{
vis t1,1
vis t2,1
vis hBrightness,1
mode_bright.val=1
covx tTmp.txt,sys0,0,0
hBrightness.val=sys0
}
if(mode.val==1)
{
// get Brightness value
spstr strCommand.txt,tTmp.txt,",",2
if(tTmp.txt=="disable")
{
vis t1,0
vis t2,0
vis hBrightness,0
mode_bright.val=0
}else
{
vis t1,1
vis t2,1
vis hBrightness,1
mode_bright.val=1
covx tTmp.txt,sys0,0,0
hBrightness.val=sys0
}
// get ColorTemp value
spstr strCommand.txt,tTmp.txt,",",3
if(tTmp.txt=="disable")
if(tTmp.txt=="unknown")
{
click bColor,1
mode_temp.val=1
}else if(tTmp.txt=="disable")
{
vis t4,0
vis t3,0
@@ -894,6 +899,7 @@ Timer tmSerial
if(tTmp.txt!="disable")
{
vis bColor,1
vis t0,1
}
}
if(tInstruction.txt=="time")

Binary file not shown.

Binary file not shown.

View File

@@ -74,7 +74,7 @@ class NsPanelLovelaceUI:
self.api.log("Received Message from Tasmota: %s", data, level="DEBUG")
return
msg = data["CustomRecv"]
self.api.log("Received Message from Tasmota: %s", msg, level="DEBUG")
self.api.log("Received Message from Tasmota: %s", msg) #, level="DEBUG"
# Split message into parts seperated by ","
msg = msg.split(",")
@@ -133,7 +133,7 @@ class NsPanelLovelaceUI:
self.update_screensaver_weather("")
def send_mqtt_msg(self,msg):
self.api.log("Send Message from Tasmota: %s", msg, level="DEBUG")
self.api.log("Send Message from Tasmota: %s", msg) #, level="DEBUG"
self.mqtt.mqtt_publish(self.config["panelSendTopic"], msg)
def update_time(self, kwargs):
@@ -217,6 +217,9 @@ class NsPanelLovelaceUI:
if(btype == "media-pause"):
self.api.get_entity(entity_id).call_service("media_play_pause")
if(btype == "hvac_action"):
self.api.get_entity(entity_id).call_service("set_hvac_mode", hvac_mode=optVal)
if(btype == "brightnessSlider"):
# scale 0-100 to ha brightness range
@@ -345,14 +348,19 @@ class NsPanelLovelaceUI:
if item_type == "sensor":
icon_id = 0
unit_of_measurement = ""
icon_mapping = {
"temperature": 2,
"power": 4
}
if entity.attributes.device_class in icon_mapping:
icon_id = icon_mapping[entity.attributes.device_class]
if "device_class" in entity.attributes:
if entity.attributes.device_class in icon_mapping:
icon_id = icon_mapping[entity.attributes.device_class]
value = entity.state + " " + entity.attributes.unit_of_measurement
if "unit_of_measurement" in entity.attributes:
unit_of_measurement = entity.attributes.unit_of_measurement
value = entity.state + " " + unit_of_measurement
return "entityUpd,{0},{1},{2},{3},{4},{5}".format(item_nr, "text", item, icon_id, name, value)
if item_type == "button" or item_type == "input_button":
@@ -361,21 +369,71 @@ class NsPanelLovelaceUI:
if item_type == "scene":
return "entityUpd,{0},{1},{2},{3},{4},{5}".format(item_nr, "button", item, 10, name, "ACTIVATE")
def generate_thermo_page(self, item):
def get_safe_ha_attribute(self, eattr, attr, default):
return eattr[attr] if attr in eattr else default
def generate_thermo_page(self, item):
if not self.api.entity_exists(item):
return f"entityUpd,{item},Not found,220,220,Not found,150,300,5"
entity = self.api.get_entity(item)
heading = entity.attributes.friendly_name
current_temp = int(entity.attributes.current_temperature*10)
dest_temp = int(entity.attributes.temperature*10)
status = entity.attributes.hvac_action
min_temp = int(entity.attributes.min_temp*10)
max_temp = int(entity.attributes.max_temp*10)
step_temp = int(0.5*10)
current_temp = int(self.get_safe_ha_attribute(entity.attributes, "current_temperature", 0)*10)
dest_temp = int(self.get_safe_ha_attribute(entity.attributes, "temperature", 0)*10)
status = self.get_safe_ha_attribute(entity.attributes, "hvac_action", "")
min_temp = int(self.get_safe_ha_attribute(entity.attributes, "min_temp", 0)*10)
max_temp = int(self.get_safe_ha_attribute(entity.attributes, "max_temp", 0)*10)
step_temp = int(self.get_safe_ha_attribute(entity.attributes, "target_temp_step", 0.5)*10)
return "entityUpd,{0},{1},{2},{3},{4},{5},{6},{7}".format(item, heading, current_temp, dest_temp, status, min_temp, max_temp, step_temp)
icon_res = ""
hvac_modes = self.get_safe_ha_attribute(entity.attributes, "hvac_modes", [])
for mode in hvac_modes:
icon_id = 11
color_on = 64512
if mode == "auto":
icon_id = 29
color_on = 1024
if mode == "heat":
icon_id = 28
color_on = 64512
if mode == "off":
icon_id = 27
color_on = 35921
if mode == "cool":
icon_id = 31
color_on = 11487
if mode == "dry":
icon_id = 26
color_on = 60897
if mode == "fan_only":
icon_id = 30
color_on = 35921
state = 0
if(mode == entity.state):
state = 1
icon_res += f",{icon_id},{color_on},{state},{mode}"
len_hvac_modes = len(hvac_modes)
if len_hvac_modes%2 == 0:
# even
padding_len = int((4-len_hvac_modes)/2)
icon_res = ","*4*padding_len + icon_res + ","*4*padding_len
# use last 4 icons
icon_res = ","*4*5 + icon_res
else:
# uneven
padding_len = int((5-len_hvac_modes)/2)
icon_res = ","*4*padding_len + icon_res + ","*4*padding_len
# uneven use first 5 icons
icon_res = icon_res + ","*4*4
return f"entityUpd,{item},{heading},{current_temp},{dest_temp},{status},{min_temp},{max_temp},{step_temp}{icon_res}"
def generate_media_page(self, item):
@@ -452,7 +510,7 @@ class NsPanelLovelaceUI:
# scale ha color temp range to 0-100
color_temp = int(self.scale(entity.attributes.color_temp,(entity.attributes.min_mireds, entity.attributes.max_mireds),(0,100)))
else:
color_temp = 0
color_temp = "unknown"
else:
color_temp = "disable"
@@ -472,7 +530,7 @@ class NsPanelLovelaceUI:
hsv = colorsys.hsv_to_rgb(h,s,v)
return tuple(round(i * 255) for i in hsv)
def pos_to_color(self, x, y):
r = 213/2
r = 160/2
x = round((x - r) / r * 100) / 100
y = round((r - y) / r * 100) / 100
@@ -484,4 +542,4 @@ class NsPanelLovelaceUI:
sat = r
hsv = (math.degrees(math.atan2(y, x))%360/360, sat, 1)
rgb = self.hsv2rgb(hsv[0],hsv[1],hsv[2])
return rgb
return rgb

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 KiB

After

Width:  |  Height:  |  Size: 204 KiB

523
ioBroker/NsPanelTs.ts Normal file
View File

@@ -0,0 +1,523 @@
type Payload = {
payload: string;
};
type Page = {
type: string,
heading: string
}
interface PageEntities extends Page {
type: "cardEntities",
items: string[]
}
interface PageThermo extends Page {
type: "cardThermo",
item: string
}
type Config = {
panelRecvTopic: string,
panelSendTopic: string,
timeoutScreensaver: number,
dimmode: number,
//brightnessScreensaver:
locale: string,
timeFormat: string,
dateFormat: string,
weatherEntity: string | null,
temperatureUnit: string,
batEntity: string,
pvEntity: string,
pages: (PageThermo | PageEntities)[]
}
var subscriptions: any = {};
var pageId = 0;
var config: Config = {
panelRecvTopic: "mqtt.0.tele.WzDisplay.RESULT",
panelSendTopic: "mqtt.0.cmnd.WzDisplay.CustomSend",
batEntity: "alias.0.Batterie.ACTUAL",
pvEntity: "alias.0.Pv.ACTUAL",
timeoutScreensaver: 15,
dimmode: 8,
locale: "de_DE",
timeFormat: "%H:%M",
dateFormat: "%A, %d. %B %Y",
weatherEntity: "alias.0.Wetter",
temperatureUnit: "°C",
pages: [
{
"type": "cardEntities",
"heading": "Testseite",
"items": [
"alias.0.Rolladen_Eltern",
"alias.0.Erker",
"alias.0.Küche",
"alias.0.Wand"
]
},
{
"type": "cardEntities",
"heading": "Strom",
"items": [
"alias.0.Netz",
"alias.0.Hausverbrauch",
"alias.0.Pv",
"alias.0.Batterie"
]
},
{
"type": "cardThermo",
"heading": "Thermostat",
"item": "alias.0.WzNsPanel"
}
]
};
schedule("* * * * *", function () {
SendTime();
});
schedule("0 * * * *", function () {
SendDate();
});
on([config.pvEntity, config.batEntity], function () {
HandleScreensaverUpdate();
})
on({ id: config.panelRecvTopic }, function (obj) {
if (obj.state.val.startsWith('\{"CustomRecv":')) {
var json = JSON.parse(obj.state.val);
var split = json.CustomRecv.split(",");
if (split[1] == "pageOpenDetail") {
UnsubscribeWatcher();
SendToPanel(GenerateDetailPage(split[2], split[3]));
}
else {
HandleMessage(split[0], split[1], parseInt(split[2]), split);
}
}
});
function SendToPanel(val: Payload | Payload[]): void {
if (Array.isArray(val)) {
val.forEach(function (id, i) {
setState(config.panelSendTopic, id.payload);
});
}
else
setState(config.panelSendTopic, val.payload);
}
function HandleMessage(typ: string, method: string, page: number, words: Array<string>): void {
if (typ == "event") {
var pageNum = (page % config.pages.length);
pageId = Math.abs(pageNum);
if (method == 'pageOpen' || method == 'startup') {
UnsubscribeWatcher();
var retMsgs: Array<Payload> = [];
if (config.pages[pageId].type == "cardEntities") {
retMsgs = GenerateEntitiesPage(pageId, <PageEntities>config.pages[pageId])
} else if (config.pages[pageId].type == "cardThermo") {
retMsgs = GenerateThermoPage(pageId, <PageThermo>config.pages[pageId])
}
if (method == 'startup')
HandleStartupProcess();
SendToPanel(retMsgs)
}
if (method == 'buttonPress' || method == "tempUpd") {
HandleButtonEvent(words)
}
if (method == 'screensaverOpen') {
HandleScreensaver()
}
}
}
function HandleStartupProcess(): void {
SendDate();
SendTime();
SendToPanel({ payload: "timeout," + config.timeoutScreensaver });
SendToPanel({ payload: "dimmode," + config.dimmode });
}
function SendDate(): void {
var months = ["Jan", "Feb", "Mar", "Apr", "Mai", "Juni", "Juli", "Aug", "Sep", "Okt", "Nov", "Dez"];
var days = ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"];
var d = new Date();
var day = days[d.getDay()];
var date = d.getDate();
var month = months[d.getMonth()];
var year = d.getFullYear();
var _sendDate = "date,?" + day + " " + date + "." + month + "." + year + "";
SendToPanel(<Payload>{ payload: _sendDate });
}
function SendTime(): void {
var d = new Date();
var hr = d.getHours().toString();
var min = d.getMinutes().toString();
if (d.getHours() < 10) {
hr = "0" + d.getHours().toString();
}
if (d.getMinutes() < 10) {
min = "0" + d.getMinutes().toString();
}
SendToPanel(<Payload>{ payload: "time," + hr + ":" + min });
}
function GenerateEntitiesPage(pageNum: number, page: PageEntities): Payload[] {
var out_msgs: Array<Payload> = [];
out_msgs = [{ payload: "pageType,cardEntities" }, { payload: "entityUpdHeading," + config.pages[pageNum].heading }]
page.items.forEach(function (id, i) {
out_msgs.push(CreateEntity(id, i + 1));
})
return out_msgs
}
function CreateEntity(id: string, placeId: number): Payload {
var type = "delete"
var iconId = 0
var name = "FriendlyName"
if (id == "delete") {
return { payload: "entityUpd," + placeId + "," + type };
}
// case "button":
// type = "button"
// iconId = 3
// var optVal = "PRESS"
// out_msgs.push({ payload: "entityUpd," + (i + 1) + "," + type + "," + id + "," + iconId + "," + name + "," + optVal })
// break
// ioBroker
if (existsObject(id)) {
let o = getObject(id)
var val = null;
name = o.common.name.de
if (existsState(id + ".GET")) {
val = getState(id + ".GET").val;
RegisterEntityWatcher(id + ".GET", id, placeId);
}
else if (existsState(id + ".SET")) {
val = getState(id + ".SET").val;
RegisterEntityWatcher(id + ".SET", id, placeId);
}
switch (o.common.role) {
case "light":
type = "light"
iconId = 1
var optVal = "0"
if (val === true || val === "true")
optVal = "1"
return { payload: "entityUpd," + placeId + "," + type + "," + id + "," + iconId + "," + name + "," + optVal }
break
case "dimmer":
type = "light"
iconId = 1
var optVal = "0"
if (existsState(id + ".ON_ACTUAL")) {
val = getState(id + ".ON_ACTUAL").val;
RegisterEntityWatcher(id + ".ON_ACTUAL", id, placeId);
}
else if (existsState(id + ".ON_SET")) {
val = getState(id + ".ON_SET").val;
RegisterEntityWatcher(id + ".ON_SET", id, placeId);
}
if (val === true || val === "true")
optVal = "1"
return { payload: "entityUpd," + placeId + "," + type + "," + id + "," + iconId + "," + name + "," + optVal }
break
case "blind":
type = "shutter"
iconId = 0
return { payload: "entityUpd," + placeId + "," + type + "," + id + "," + iconId + "," + name }
break
case "info":
case "value.temperature":
type = "text"
var optVal = "0"
if (existsState(id + ".ON_ACTUAL")) {
optVal = getState(id + ".ON_ACTUAL").val + " " + GetUnitOfMeasurement(id + ".ON_ACTUAL");
RegisterEntityWatcher(id + ".ON_ACTUAL", id, placeId);
}
else if (existsState(id + ".ACTUAL")) {
optVal = getState(id + ".ACTUAL").val;
RegisterEntityWatcher(id + ".ACTUAL", id, placeId);
}
if (o.common.role == "value.temperature") {
iconId = 2
optVal += config.temperatureUnit;
}
else {
optVal += GetUnitOfMeasurement(id + ".ACTUAL");
}
return { payload: "entityUpd," + placeId + "," + type + "," + id + "," + iconId + "," + name + "," + optVal }
break
default:
break
}
}
return { payload: "entityUpd," + placeId + "," + type };
}
function RegisterEntityWatcher(id: string, entityId: string, placeId: number): void {
if (subscriptions.hasOwnProperty(id)) {
return;
}
subscriptions[id] = (on({ id: id, change: 'any' }, function (data) {
SendToPanel(CreateEntity(entityId, placeId));
}))
}
function RegisterDetailEntityWatcher(id: string, entityId: string, type: string): void {
if (subscriptions.hasOwnProperty(id)) {
return;
}
subscriptions[id] = (on({ id: id, change: 'any' }, function () {
SendToPanel(GenerateDetailPage(type, entityId));
}))
}
function GetUnitOfMeasurement(id: string): string {
if (!existsObject(id))
return "";
let obj = getObject(id);
if (typeof obj.common.unit !== 'undefined') {
return obj.common.unit
}
if (typeof obj.common.alias !== 'undefined' && typeof obj.common.alias.id !== 'undefined') {
return GetUnitOfMeasurement(obj.common.alias.id);
}
return "";
}
function GenerateThermoPage(pageNum: number, page: PageThermo): Payload[] {
var id = page.item
var out_msgs: Array<Payload> = [];
out_msgs.push({ payload: "pageType,cardThermo" });
// ioBroker
if (existsObject(id)) {
let o = getObject(id)
let name = o.common.name.de
let currentTemp = 0;
if (existsState(id + ".ACTUAL"))
currentTemp = parseInt(getState(id + ".ACTUAL").val) * 10;
let destTemp = 0;
if (existsState(id + ".SET"))
destTemp = parseInt(getState(id + ".SET").val) * 10;
let status = ""
if (existsState(id + ".MODE"))
status = destTemp = getState(id + ".MODE").val;
let minTemp = 180
let maxTemp = 300
let stepTemp = 5
out_msgs.push({ payload: "entityUpd," + id + "," + name + "," + currentTemp + "," + destTemp + "," + status + "," + minTemp + "," + maxTemp + "," + stepTemp })
}
return out_msgs
}
function HandleButtonEvent(words): void {
let id = words[4]
if (words[6] == "OnOff" && existsObject(id)) {
var action = false
if (words[7] == "1")
action = true
let o = getObject(id)
switch (o.common.role) {
case "light":
setState(id + ".SET", action);
break;
case "dimmer":
if (existsState(id + ".ON_SET"))
setState(id + ".ON_SET", action);
else if (existsState(id + ".ON_ACTUAL"))
setState(id + ".ON_ACTUAL", action);
}
}
if (words[6] == "up")
setState(id + ".OPEN", true)
if (words[6] == "stop")
setState(id + ".STOP", true)
if (words[6] == "down")
setState(id + ".CLOSE", true)
if (words[6] == "positionSlider")
setState(id + ".SET", parseInt(words[7]))
if (words[6] == "brightnessSlider")
if (existsState(id + ".SET"))
setState(id + ".SET", parseInt(words[7]));
else if (existsState(id + ".ACTUAL"))
setState(id + ".ACTUAL", parseInt(words[7]));
// out_msgs.push({ payload: id, action: "turn_on", domain: "lightBrightness", brightness: parseInt(words[7]) })
// if (words[6] == "colorTempSlider")
// out_msgs.push({ payload: id, action: "turn_on", domain: "lightTemperature", temperature: parseInt(words[7]) })
if (words[1] == "tempUpd") {
setState(words[3] + ".SET", parseInt(words[4]) / 10)
}
}
function GenerateDetailPage(type: string, entityId: string): Payload[] {
var out_msgs: Array<Payload> = [];
let id = entityId
if (existsObject(id)) {
var o = getObject(id)
var val = null;
if (type == "popupLight") {
let switchVal = "0"
if (o.common.role == "light") {
if (existsState(id + ".GET"))
{
val = getState(id + ".GET").val;
RegisterDetailEntityWatcher(id + ".GET", id, type);
}
else if (existsState(id + ".SET"))
{
val = getState(id + ".SET").val;
RegisterDetailEntityWatcher(id + ".SET", id, type);
}
if (val)
switchVal = "1"
out_msgs.push({ payload: "entityUpdateDetail," + switchVal + ",disable,disable,disable" })
}
if (o.common.role == "dimmer") {
if (existsState(id + ".ON_ACTUAL"))
{
val = getState(id + ".ON_ACTUAL").val;
RegisterDetailEntityWatcher(id + ".ON_ACTUAL", id, type);
}
else if (existsState(id + ".ON_SET"))
{
val = getState(id + ".ON_SET").val;
RegisterDetailEntityWatcher(id + ".ON_SET", id, type);
}
if (val === true || val === "true")
switchVal = "1"
let brightness = 0;
if (existsState(id + ".ACTUAL"))
{
brightness = Math.trunc(scale(getState(id + ".ACTUAL").val, 0, 100, 0, 100))
RegisterDetailEntityWatcher(id + ".ACTUAL", id, type);
}
let colortemp = "disable"
//let attr_support_color = attr.supported_color_modes
//if (attr_support_color.includes("color_temp"))
// colortemp = Math.trunc(scale(attr.color_temp, attr.min_mireds, attr.max_mireds, 0, 100))
out_msgs.push({ payload: "entityUpdateDetail," + switchVal + "," + brightness + "," + colortemp })
}
}
if (type == "popupShutter") {
if (existsState(id + ".ACTUAL"))
val = getState(id + ".ACTUAL").val;
else if (existsState(id + ".SET"))
val = getState(id + ".SET").val;
out_msgs.push({ payload: "entityUpdateDetail," + val })
}
}
return out_msgs
}
function scale(number: number, inMin: number, inMax: number, outMin: number, outMax: number): number {
return (number - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
}
function UnsubscribeWatcher(): void {
for (const [key, value] of Object.entries(subscriptions)) {
unsubscribe(value);
delete subscriptions[key]
}
}
function HandleScreensaver(): void {
UnsubscribeWatcher();
HandleScreensaverUpdate();
}
function HandleScreensaverUpdate(): void {
if (config.weatherEntity != null && existsObject(config.weatherEntity)) {
var icon = getState(config.weatherEntity + ".ICON").val;
let temperature: string = getState(config.weatherEntity + ".TEMP").val;
let humidity = getState(config.weatherEntity + ".HUMIDITY").val;
let u1 = getState(config.batEntity).val;
let u2 = getState(config.pvEntity).val;
SendToPanel(<Payload>{ payload: "weatherUpdate,?" + GetAccuWeatherIcon(parseInt(icon)) + "?" + temperature.toString() + " " + config.temperatureUnit + "?26?" + humidity + " %?Batterie?4?" + u1 + "%?PV?23?" + u2 + "W" })
}
}
function GetAccuWeatherIcon(icon: number): number {
switch (icon) {
case 6: // stark bewölkt
case 38:
return 12;
break;
case 1: // Sonnig
case 2:
case 3:
return 23;
case 12: // pouring
return 19;
case 18: // rainy
return 20;
case 32: // windig
return 24;
case 33: // klar
case 34:
return 17;
case 35: // partlycloudy
return 18;
case 11: // fog
return 13;
default:
return 1;
break;
}
}

388
tasmota/autoexec-beta.be Normal file
View File

@@ -0,0 +1,388 @@
# Sonoff NSPanel Tasmota Lovelace UI Berry Driver | code by joBr99
# based on;
# Sonoff NSPanel Tasmota (Nextion with Flashing) driver | code by peepshow-21
# based on;
# Sonoff NSPanel Tasmota driver v0.47 | code by blakadder and s-hadinger
# Example Flash
# FlashNextion http://ip-address-of-your-homeassistant:8123/local/nspanel.tft
# FlashNextion http://nspanel.pky.eu/lui.tft
class Nextion : Driver
static VERSION = "1.1.3"
static header = bytes('55BB')
static flash_block_size = 4096
var flash_mode
var flash_size
var flash_written
var flash_buff
var flash_offset
var awaiting_offset
var tcp
var ser
var last_per
def split_55(b)
var ret = []
var s = size(b)
var i = s-2 # start from last-1
while i > 0
if b[i] == 0x55 && b[i+1] == 0xBB
ret.push(b[i..s-1]) # push last msg to list
b = b[(0..i-1)] # write the rest back to b
end
i -= 1
end
ret.push(b)
return ret
end
def crc16(data, poly)
if !poly poly = 0xA001 end
# CRC-16 MODBUS HASHING ALGORITHM
var crc = 0xFFFF
for i:0..size(data)-1
crc = crc ^ data[i]
for j:0..7
if crc & 1
crc = (crc >> 1) ^ poly
else
crc = crc >> 1
end
end
end
return crc
end
# encode using custom protocol 55 BB [payload length] [payload length] [payload] [crc] [crc]
def encode(payload)
var b = bytes()
b += self.header
b.add(size(payload), 2) # add size as 2 bytes, little endian
b += bytes().fromstring(payload)
var msg_crc = self.crc16(b)
b.add(msg_crc, 2) # crc 2 bytes, little endian
return b
end
def encodenx(payload)
var b = bytes().fromstring(payload)
b += bytes('FFFFFF')
return b
end
def sendnx(payload)
import string
var payload_bin = self.encodenx(payload)
self.ser.write(payload_bin)
log(string.format("NXP: Nextion command sent = %s",str(payload_bin)), 3)
end
def send(payload)
var payload_bin = self.encode(payload)
if self.flash_mode==1
log("NXP: skipped command becuase still flashing", 3)
else
self.ser.write(payload_bin)
log("NXP: payload sent = " + str(payload_bin), 3)
end
end
def write_to_nextion(b)
self.ser.write(b)
end
def screeninit()
log("NXP: Screen Initialized")
self.sendnx("recmod=1")
end
def write_block()
import string
log("FLH: Read block",3)
while size(self.flash_buff)<self.flash_block_size && self.tcp.connected()
if self.tcp.available()>0
self.flash_buff += self.tcp.readbytes()
else
tasmota.delay(50)
log("FLH: Wait for available...",3)
end
end
log("FLH: Buff size "+str(size(self.flash_buff)),3)
var to_write
if size(self.flash_buff)>self.flash_block_size
to_write = self.flash_buff[0..self.flash_block_size-1]
self.flash_buff = self.flash_buff[self.flash_block_size..]
else
to_write = self.flash_buff
self.flash_buff = bytes()
end
log("FLH: Writing "+str(size(to_write)),3)
var per = (self.flash_written*100)/self.flash_size
if (self.last_per!=per)
self.last_per = per
tasmota.publish_result(string.format("{\"Flashing\":{\"complete\": %d}}",per), "RESULT")
end
if size(to_write)>0
self.flash_written += size(to_write)
if self.flash_offset==0 || self.flash_written>self.flash_offset
self.ser.write(to_write)
self.flash_offset = 0
else
tasmota.set_timer(10,/->self.write_block())
end
end
log("FLH: Total "+str(self.flash_written),3)
if (self.flash_written==self.flash_size)
log("FLH: Flashing complete")
self.flash_mode = 0
end
end
def every_100ms()
import string
if self.ser.available() > 0
var msg = self.ser.read()
if size(msg) > 0
log(string.format("NXP: Received Raw = %s",str(msg)), 3)
if (self.flash_mode==1)
var strv = msg[0..-4].asstring()
if string.find(strv,"comok 2")>=0
log("FLH: Send (High Speed) flash start")
self.sendnx(string.format("whmi-wris %d,115200,res0",self.flash_size))
elif size(msg)==1 && msg[0]==0x08
log("FLH: Waiting offset...",3)
self.awaiting_offset = 1
elif size(msg)==4 && self.awaiting_offset==1
self.awaiting_offset = 0
self.flash_offset = msg.get(0,4)
log("FLH: Flash offset marker "+str(self.flash_offset),3)
self.write_block()
elif size(msg)==1 && msg[0]==0x05
self.write_block()
else
log("FLH: Something has gone wrong flashing display firmware ["+str(msg)+"]",2)
end
else
var msg_list = self.split_55(msg)
for i:0..size(msg_list)-1
msg = msg_list[i]
if size(msg) > 0
if msg == bytes('000000FFFFFF88FFFFFF')
self.screeninit()
elif size(msg)>=2 && msg[0]==0x55 && msg[1]==0xBB
var jm = string.format("{\"CustomRecv\":\"%s\"}",msg[4..-3].asstring())
tasmota.publish_result(jm, "RESULT")
elif msg[0]==0x07 && size(msg)==1 # BELL/Buzzer
tasmota.cmd("buzzer 1,1")
else
var jm = string.format("{\"nextion\":\"%s\"}",str(msg[0..-4]))
tasmota.publish_result(jm, "RESULT")
end
end
end
end
end
end
end
def begin_nextion_flash()
self.flash_written = 0
self.awaiting_offset = 0
self.flash_offset = 0
self.sendnx('DRAKJHSUYDGBNCJHGJKSHBDN')
self.sendnx('recmod=0')
self.sendnx('recmod=0')
self.flash_mode = 1
self.sendnx("connect")
end
def open_url(url)
import string
var host
var port
var s1 = string.split(url,7)[1]
var i = string.find(s1,":")
var sa
if i<0
port = 80
i = string.find(s1,"/")
sa = string.split(s1,i)
host = sa[0]
else
sa = string.split(s1,i)
host = sa[0]
s1 = string.split(sa[1],1)[1]
i = string.find(s1,"/")
sa = string.split(s1,i)
port = int(sa[0])
end
var get = sa[1]
log(string.format("FLH: host: %s, port: %s, get: %s",host,port,get))
self.tcp = tcpclient()
self.tcp.connect(host,port)
log("FLH: Connected:"+str(self.tcp.connected()),3)
var get_req = "GET "+get+" HTTP/1.0\r\n"
get_req += string.format("HOST: %s:%s\r\n\r\n",host,port)
self.tcp.write(get_req)
var a = self.tcp.available()
i = 1
while a==0 && i<5
tasmota.delay(100*i)
tasmota.yield()
i += 1
log("FLH: Retry "+str(i),3)
a = self.tcp.available()
end
if a==0
log("FLH: Nothing available to read!",3)
return
end
var b = self.tcp.readbytes()
i = 0
var end_headers = false;
var headers
while i<size(b) && headers==nil
if b[i..(i+3)]==bytes().fromstring("\r\n\r\n")
headers = b[0..(i+3)].asstring()
self.flash_buff = b[(i+4)..]
else
i += 1
end
end
#print(headers)
# check http respose for code 200
var tag = "200 OK"
i = string.find(headers,tag)
if (i>0)
log("FLH: HTTP Respose is 200 OK",3)
else
log("FLH: HTTP Respose is not 200 OK",3)
print(headers)
return
end
# check http respose for content-length
tag = "Content-Length: "
i = string.find(headers,tag)
if (i>0)
var i2 = string.find(headers,"\r\n",i)
var s = headers[i+size(tag)..i2-1]
self.flash_size=int(s)
end
if self.flash_size==0
log("FLH: No size header, counting ...",3)
self.flash_size = size(self.flash_buff)
#print("counting start ...")
while self.tcp.connected()
while self.tcp.available()>0
self.flash_size += size(self.tcp.readbytes())
end
tasmota.delay(50)
end
#print("counting end ...",self.flash_size)
self.tcp.close()
self.open_url(url)
else
log("FLH: Size found in header, skip count",3)
end
log("FLH: Flash file size: "+str(self.flash_size),3)
end
def flash_nextion(url)
self.flash_size = 0
self.open_url(url)
self.begin_nextion_flash()
end
def version_number(str)
import string
var i1 = string.find(str,".",0)
var i2 = string.find(str,".",i1+1)
var num = int(str[0..i1-1])*10000+int(str[i1+1..i2-1])*100+int(str[i2+1..])
return num
end
def init()
log("NXP: Initializing Driver")
self.ser = serial(17, 16, 115200, serial.SERIAL_8N1)
self.flash_mode = 0
end
end
var nextion = Nextion()
tasmota.add_driver(nextion)
def get_current_version(cmd, idx, payload, payload_json)
import string
var version_of_this_script = 2
var jm = string.format("{\"nlui_driver_version\":\"%s\"}", version_of_this_script)
tasmota.publish_result(jm, "RESULT")
end
tasmota.add_cmd('GetDriverVersion', get_current_version)
def update_berry_driver(cmd, idx, payload, payload_json)
def task()
import string
var cl = webclient()
cl.begin(payload)
var r = cl.GET()
if r == 200
print("Sucessfully downloaded nspanel-lovelace-ui berry driver")
else
print("Error while downloading nspanel-lovelace-ui berry driver")
end
r = cl.write_file("autoexec.be")
if r < 0
print("Error while writeing nspanel-lovelace-ui berry driver")
else
print("Scucessfully written nspanel-lovelace-ui berry driver")
var s = load('autoexec.be')
if s == true
var jm = string.format("{\"nlui_driver_update\":\"%s\"}", "succeeded")
tasmota.publish_result(jm, "RESULT")
else
var jm = string.format("{\"nlui_driver_update\":\"%s\"}", "failed")
tasmota.publish_result(jm, "RESULT")
end
end
end
tasmota.set_timer(0,task)
tasmota.resp_cmnd_done()
end
tasmota.add_cmd('UpdateDriverVersion', update_berry_driver)
def flash_nextion(cmd, idx, payload, payload_json)
def task()
nextion.flash_nextion(payload)
end
tasmota.set_timer(0,task)
tasmota.resp_cmnd_done()
end
def send_cmd(cmd, idx, payload, payload_json)
nextion.sendnx(payload)
tasmota.resp_cmnd_done()
end
def send_cmd2(cmd, idx, payload, payload_json)
nextion.send(payload)
tasmota.resp_cmnd_done()
end
tasmota.add_cmd('Nextion', send_cmd)
tasmota.add_cmd('CustomSend', send_cmd2)
tasmota.add_cmd('FlashNextion', flash_nextion)