Compare commits

...

47 Commits

Author SHA1 Message Date
Johannes
7a5d76e2f4 Update nspanel-lovelace-ui.py 2022-03-21 16:53:41 +01:00
joBr99
745445af19 Merge branch 'main' of https://github.com/joBr99/nspanel-lovelace-ui (add nextion2text) 2022-03-21 15:53:30 +00:00
Johannes
1f7a3d513d Merge branch 'main' of https://github.com/joBr99/nspanel-lovelace-ui 2022-03-21 16:53:08 +01:00
Johannes
24365f7824 bump to 15 2022-03-21 16:53:05 +01:00
Johannes
7996393afb fix version tag 2022-03-21 16:48:13 +01:00
Johannes
5903239456 Update nspanel-lovelace-ui.py 2022-03-21 15:46:04 +01:00
joBr99
32aa35d9c3 Merge branch 'main' of https://github.com/joBr99/nspanel-lovelace-ui (add nextion2text) 2022-03-21 14:44:50 +00:00
Johannes
bb0108dc7a Merge branch 'main' of https://github.com/joBr99/nspanel-lovelace-ui 2022-03-21 15:44:27 +01:00
Johannes
cf6359dea5 bump version for next release 2022-03-21 15:44:16 +01:00
joBr99
8d4c1904f1 add icon (add nextion2text) 2022-03-21 14:43:35 +00:00
Johannes
3111ce15a2 add icon 2022-03-21 15:43:12 +01:00
joBr99
85d290c3f4 added command to exit notification page (add nextion2text) 2022-03-21 13:56:20 +00:00
Johannes
f8a72a55a9 added command to exit notification page 2022-03-21 14:55:55 +01:00
Johannes Braun
b9123ed2e9 update screens pic 2022-03-21 12:24:48 +01:00
Johannes
b9d2c08cab icon color also for switches 2022-03-21 11:02:12 +01:00
Johannes
0d460af0c6 fixed method call 2022-03-21 10:58:43 +01:00
Johannes
6eefab4ed7 Merge branch 'main' of https://github.com/joBr99/nspanel-lovelace-ui 2022-03-21 10:53:02 +01:00
Johannes
41c90f68ce changed color on state 2022-03-21 10:52:55 +01:00
joBr99
18516917b9 Merge branch 'main' of https://github.com/joBr99/nspanel-lovelace-ui (add nextion2text) 2022-03-21 09:25:20 +00:00
Johannes
bd64ba702a Merge branch 'main' of https://github.com/joBr99/nspanel-lovelace-ui 2022-03-21 10:24:59 +01:00
Johannes
429f023d3d flip icon 1 and 11 2022-03-21 10:24:45 +01:00
joBr99
6264f22d12 added v2 button msg format (add nextion2text) 2022-03-21 09:13:51 +00:00
Johannes
fc4fb72818 added v2 button msg format 2022-03-21 10:13:25 +01:00
Johannes
23814a7bf2 added internal names to buttons 2022-03-21 10:11:44 +01:00
Johannes
ef6877b2ae Merge branch 'main' of https://github.com/joBr99/nspanel-lovelace-ui 2022-03-21 10:01:47 +01:00
Johannes
9b5ca37673 implemented commands for alarm page 2022-03-21 09:59:46 +01:00
Johannes
acc2e859bb Fixed weather forecast to make babel optional again 2022-03-21 09:13:33 +01:00
Johannes
481f5fc074 fix ident 2022-03-21 07:58:18 +01:00
Johannes
ff96c8fce6 Merge pull request #48 from britzelpuf/main
Gridpages
2022-03-21 00:42:40 +01:00
joBr99
5e74db2d85 bumped version for next release (add nextion2text) 2022-03-20 23:25:26 +00:00
Johannes
74a2cfd369 bumped version for next release 2022-03-21 00:24:53 +01:00
Johannes
e780bf302d fixed pageThermo type from pageNotify 2022-03-21 00:24:17 +01:00
britzelpuf
54c8b7d2ab Merge branch 'joBr99:main' into main 2022-03-21 00:01:31 +01:00
britzelpuf
88a2ad46ec Merge branch 'main' of https://github.com/britzelpuf/nspanel-lovelace-ui 2022-03-21 00:01:14 +01:00
britzelpuf
18855840d8 Added support for GridPages
Added color support
Color interpolation
2022-03-21 00:00:54 +01:00
Johannes
2cbcb098e6 Merge branch 'main' of https://github.com/joBr99/nspanel-lovelace-ui 2022-03-20 23:52:07 +01:00
Johannes
e2c20b8c2d bumped version for next release 2022-03-20 23:51:52 +01:00
joBr99
a895a85477 fixed screensaver timeout on popup pages (add nextion2text) 2022-03-20 22:49:55 +00:00
Johannes
d1165efbd8 fixed screensaver timeout on popup pages 2022-03-20 23:49:36 +01:00
Johannes
a2a2e221d4 Fix delete doc 2022-03-20 23:22:08 +01:00
Johannes
23d0514339 added advanced examples nodered 2022-03-20 22:42:01 +01:00
joBr99
d66cfc6cd8 fixed event on sleeptimout on notify page (add nextion2text) 2022-03-20 21:33:34 +00:00
Johannes
07fd51543f fixed event on sleeptimout on notify page 2022-03-20 22:33:13 +01:00
joBr99
8d0feefb01 fix timeout on pageNotify (add nextion2text) 2022-03-20 21:26:22 +00:00
Johannes
b5afc7d427 fix timeout on pageNotify 2022-03-20 22:26:01 +01:00
britzelpuf
c0dd81f967 Merge branch 'joBr99:main' into main 2022-03-20 21:52:18 +01:00
britzelpuf
91273bb6f2 Fix Typo 2022-03-20 21:44:44 +01:00
22 changed files with 787 additions and 955 deletions

View File

@@ -91,7 +91,7 @@ The following message can be used to update the content on the cardEntities Page
`,shutter,cover.entityName,0,17299,Shutter2,`
`,delete,,,,`
`,delete,,,,,`
`,text,sensor.entityName,3,17299,Temperature,content`
@@ -117,6 +117,8 @@ The following message can be used to update the content on the cardEntities Page
`entityUpdateDetail,*internalName*,*tHeading*,*tHeadingColor*,*b1*,*tB1Color*,*b2*,*tB2Color*,*tText*,*tTextColor*,*sleepTimeout*`
`popupExit`
### cardThermo Page
`entityUpd,*internalNameEntiy*,*heading*,*currentTemp*,*destTemp*,*status*,*minTemp*,*maxTemp*,*stepTemp*[[,*iconId*,*activeColor*,*state*,*hvac_action*]]`
@@ -127,6 +129,11 @@ The following message can be used to update the content on the cardEntities Page
`entityUpd,|*internalNameEntiy*|*heading*|*icon*|*title*|*author*|*volume*|*playpauseicon*`
### cardAlarm Page
`entityUpd,*internalNameEntity*,*arm1*,*arm1ActionName*,*arm2*,*arm2ActionName*,*arm3*,*arm3ActionName*,*arm4*,*arm4ActionName*,*icon*,*numpadStatus*`
## Messages from Nextion Display
### startup page
@@ -195,6 +202,9 @@ The following message can be used to update the content on the cardEntities Page
`event,buttonPress,1,tHeading,internalNameEntity,1,volumeSlider,75`
### cardAlarm Page
`event,buttonPress2,internalNameEntity,actionName,code`
# Icons IDs

View File

@@ -2,7 +2,7 @@ import json
import os
icons = [
"window-open",
"alert-circle-outline",
"lightbulb",
"thermometer",
"gesture-tap-button",
@@ -13,7 +13,7 @@ icons = [
"pause",
"play",
"palette",
"alert-circle-outline",
"window-open",
"weather-cloudy",
"weather-fog",
"weather-hail",
@@ -36,7 +36,8 @@ icons = [
"snowflake",
"solar-power",
"battery-charging-medium",
"battery-medium"
"battery-medium",
"shield-home"
]

View File

@@ -4,7 +4,7 @@ This file contains the Icons IDs included in the display firmware, addressable v
ID | MD Icon Name | Icon
-- | ------------ | ----
0 | window-open | ![window-open](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/window-open.svg)
0 | alert-circle-outline | ![alert-circle-outline](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/alert-circle-outline.svg)
1 | lightbulb | ![lightbulb](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/lightbulb.svg)
2 | thermometer | ![thermometer](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/thermometer.svg)
3 | gesture-tap-button | ![gesture-tap-button](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/gesture-tap-button.svg)
@@ -15,7 +15,7 @@ ID | MD Icon Name | Icon
8 | pause | ![pause](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/pause.svg)
9 | play | ![play](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/play.svg)
10 | palette | ![palette](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/palette.svg)
11 | alert-circle-outline | ![alert-circle-outline](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/alert-circle-outline.svg)
11 | window-open | ![window-open](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/window-open.svg)
12 | weather-cloudy | ![weather-cloudy](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/weather-cloudy.svg)
13 | weather-fog | ![weather-fog](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/weather-fog.svg)
14 | weather-hail | ![weather-hail](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/weather-hail.svg)
@@ -39,3 +39,4 @@ ID | MD Icon Name | Icon
32 | solar-power | ![solar-power](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/solar-power.svg)
33 | battery-charging-medium | ![battery-charging-medium](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/battery-charging-medium.svg)
34 | battery-medium | ![battery-medium](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/battery-medium.svg)
35 | shield-home | ![shield-home](https://raw.githubusercontent.com/Templarian/MaterialDesign-SVG/0aeb4d612644d80d9d1fe242f705f362985de5dc/svg/shield-home.svg)

View File

@@ -27,24 +27,75 @@ Page cardAlarm
vis tTmp,0
vis tId,0
//vis nPageDisp,0
vis arm1,0
vis arm2,0
vis arm3,0
vis arm4,0
vis b0,0
vis b1,0
vis b2,0
vis b3,0
vis b4,0
vis b5,0
vis b6,0
vis b7,0
vis b8,0
vis b9,0
vis b10,0
vis tCode,0
Variable (string) strCommand
Attributes
ID : 8
ID : 7
Scope : local
Text :
Max. Text Size: 200
Variable (string) entn
Attributes
ID : 11
ID : 10
Scope : local
Text :
Max. Text Size: 50
Variable (string) tSend
Attributes
ID : 26
Scope : local
Text :
Max. Text Size: 100
Variable (string) va1
Attributes
ID : 31
Scope : local
Text :
Max. Text Size: 20
Variable (string) va2
Attributes
ID : 32
Scope : local
Text :
Max. Text Size: 20
Variable (string) va3
Attributes
ID : 33
Scope : local
Text :
Max. Text Size: 20
Variable (string) va4
Attributes
ID : 34
Scope : local
Text :
Max. Text Size: 20
Number nPageDisp
Attributes
ID : 6
ID : 5
Scope : local
Dragging : 0
Disable release event after dragging: 0
@@ -72,39 +123,9 @@ Number nPageDisp
Horizontal Spacing : 0
Vertical Spacing : 0
Text tSend
Attributes
ID : 2
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 0
y coordinate : 0
Width : 230
Height : 23
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : flat
Associated Keyboard : none
Font ID : 0
Back. Color : 65535
Font Color : 0
Horizontal Alignment : center
Vertical Alignment : center
Input Type : character
Text : newtxt
Max. Text Size : 100
Word wrap : disabled
Horizontal Spacing : 0
Vertical Spacing : 0
Text tTmp
Attributes
ID : 3
ID : 2
Scope : local
Dragging : 0
Disable release event after dragging: 0
@@ -134,7 +155,7 @@ Text tTmp
Text tInstruction
Attributes
ID : 9
ID : 8
Scope : local
Dragging : 0
Disable release event after dragging: 0
@@ -164,7 +185,7 @@ Text tInstruction
Text tId
Attributes
ID : 10
ID : 9
Scope : local
Dragging : 0
Disable release event after dragging: 0
@@ -194,15 +215,15 @@ Text tId
Text tCode
Attributes
ID : 25
ID : 24
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 162
y coordinate : 79
Width : 126
x coordinate : 92
y coordinate : 12
Width : 192
Height : 49
Effect : load
Effect Priority : 0
@@ -215,13 +236,43 @@ Text tCode
Font Color : 40179
Horizontal Alignment : center
Vertical Alignment : center
Input Type : character
Input Type : password
Text :
Max. Text Size : 10
Word wrap : disabled
Horizontal Spacing : 0
Vertical Spacing : 0
Text tIcon
Attributes
ID : 27
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 300
y coordinate : 12
Width : 64
Height : 49
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : flat
Associated Keyboard : none
Font ID : 2
Back. Color : 6371
Font Color : 65535
Horizontal Alignment : center
Vertical Alignment : center
Input Type : character
Text : 
Max. Text Size : 10
Word wrap : disabled
Horizontal Spacing : 0
Vertical Spacing : 0
Picture p0
Attributes
ID : 1
@@ -241,7 +292,7 @@ Picture p0
Button bNext
Attributes
ID : 4
ID : 3
Scope : local
Dragging : 0
Disable release event after dragging: 0
@@ -295,7 +346,7 @@ Button bNext
Button bPrev
Attributes
ID : 5
ID : 4
Scope : local
Dragging : 0
Disable release event after dragging: 0
@@ -349,14 +400,14 @@ Button bPrev
Button b0
Attributes
ID : 14
ID : 13
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 51
y coordinate : 139
x coordinate : 52
y coordinate : 146
Width : 75
Height : 50
Effect : load
@@ -387,14 +438,14 @@ Button b0
Button b1
Attributes
ID : 15
ID : 14
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 143
y coordinate : 139
x coordinate : 144
y coordinate : 146
Width : 75
Height : 50
Effect : load
@@ -425,14 +476,14 @@ Button b1
Button b2
Attributes
ID : 16
ID : 15
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 235
y coordinate : 138
x coordinate : 236
y coordinate : 145
Width : 75
Height : 50
Effect : load
@@ -463,14 +514,14 @@ Button b2
Button b3
Attributes
ID : 17
ID : 16
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 51
y coordinate : 197
x coordinate : 52
y coordinate : 204
Width : 75
Height : 50
Effect : load
@@ -501,14 +552,14 @@ Button b3
Button b4
Attributes
ID : 18
ID : 17
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 143
y coordinate : 197
x coordinate : 144
y coordinate : 204
Width : 75
Height : 50
Effect : load
@@ -539,14 +590,14 @@ Button b4
Button b5
Attributes
ID : 19
ID : 18
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 235
y coordinate : 197
x coordinate : 236
y coordinate : 204
Width : 75
Height : 50
Effect : load
@@ -577,14 +628,14 @@ Button b5
Button b6
Attributes
ID : 20
ID : 19
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 51
y coordinate : 255
x coordinate : 52
y coordinate : 262
Width : 75
Height : 50
Effect : load
@@ -615,14 +666,14 @@ Button b6
Button b7
Attributes
ID : 21
ID : 20
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 143
y coordinate : 255
x coordinate : 144
y coordinate : 262
Width : 75
Height : 50
Effect : load
@@ -653,14 +704,14 @@ Button b7
Button b8
Attributes
ID : 22
ID : 21
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 235
y coordinate : 255
x coordinate : 236
y coordinate : 262
Width : 75
Height : 50
Effect : load
@@ -691,14 +742,14 @@ Button b8
Button b9
Attributes
ID : 23
ID : 22
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 327
y coordinate : 197
x coordinate : 328
y coordinate : 204
Width : 75
Height : 50
Effect : load
@@ -729,14 +780,14 @@ Button b9
Button b10
Attributes
ID : 24
ID : 23
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 327
y coordinate : 255
x coordinate : 328
y coordinate : 262
Width : 75
Height : 50
Effect : load
@@ -765,18 +816,18 @@ Button b10
Touch Press Event
tCode.txt=""
Button b11
Button arm1
Attributes
ID : 26
ID : 25
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 96
y coordinate : 32
Width : 113
Height : 33
x coordinate : 59
y coordinate : 72
Width : 64
Height : 64
Effect : load
Effect Priority : 0
Effect Time : 300
@@ -793,24 +844,43 @@ Button b11
Horizontal Alignment : center
Vertical Alignment : center
State : unpressed
Text : ARM HOME
Text :
Max. Text Size : 10
Word wrap : disabled
Word wrap : enabled
Horizontal Spacing : 0
Vertical Spacing : 0
Button b12
Events
Touch Press Event
// event,buttonPress2,entn,arm1,tCode
tSend.txt="event,buttonPress2,"
tSend.txt+=entn.txt+","
tSend.txt+=va1.txt+","
tSend.txt+=tCode.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
Button arm3
Attributes
ID : 27
ID : 28
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 242
y coordinate : 32
Width : 113
Height : 33
x coordinate : 239
y coordinate : 72
Width : 64
Height : 64
Effect : load
Effect Priority : 0
Effect Time : 300
@@ -827,15 +897,140 @@ Button b12
Horizontal Alignment : center
Vertical Alignment : center
State : unpressed
Text : ARM AWAY
Text :
Max. Text Size : 10
Word wrap : disabled
Word wrap : enabled
Horizontal Spacing : 0
Vertical Spacing : 0
Events
Touch Press Event
// event,buttonPress2,entn,arm1,tCode
tSend.txt="event,buttonPress2,"
tSend.txt+=entn.txt+","
tSend.txt+=va3.txt+","
tSend.txt+=tCode.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
Button arm2
Attributes
ID : 29
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 149
y coordinate : 72
Width : 64
Height : 64
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : border
Border Color : 6371
Border Width : 2
Font ID : 0
Back. Color : 6371
Back. Picture ID (Pressed) : 65535
Back. Color (Pressed) : 14823
Font Color (Unpressed) : 1374
Font Color (Pressed) : 65535
Horizontal Alignment : center
Vertical Alignment : center
State : unpressed
Text :
Max. Text Size : 10
Word wrap : enabled
Horizontal Spacing : 0
Vertical Spacing : 0
Events
Touch Press Event
// event,buttonPress2,entn,arm1,tCode
tSend.txt="event,buttonPress2,"
tSend.txt+=entn.txt+","
tSend.txt+=va2.txt+","
tSend.txt+=tCode.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
Button arm4
Attributes
ID : 30
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Opacity : 127
x coordinate : 329
y coordinate : 72
Width : 64
Height : 64
Effect : load
Effect Priority : 0
Effect Time : 300
Fill : solid color
Style : border
Border Color : 6371
Border Width : 2
Font ID : 0
Back. Color : 6371
Back. Picture ID (Pressed) : 65535
Back. Color (Pressed) : 14823
Font Color (Unpressed) : 1374
Font Color (Pressed) : 65535
Horizontal Alignment : center
Vertical Alignment : center
State : unpressed
Text :
Max. Text Size : 10
Word wrap : enabled
Horizontal Spacing : 0
Vertical Spacing : 0
Events
Touch Press Event
// event,buttonPress2,entn,arm1,tCode
tSend.txt="event,buttonPress2,"
tSend.txt+=entn.txt+","
tSend.txt+=va4.txt+","
tSend.txt+=tCode.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 : 7
ID : 6
Scope : local
Period (ms): 50
Enabled : yes
@@ -887,6 +1082,61 @@ Timer tmSerial
spstr strCommand.txt,tInstruction.txt,",",0
if(tInstruction.txt=="entityUpd")
{
//entn
spstr strCommand.txt,entn.txt,",",1
//text arm1
spstr strCommand.txt,arm1.txt,",",2
if(arm1.txt!="")
{
vis arm1,1
}
//id arm1
spstr strCommand.txt,va1.txt,",",3
//text arm2
spstr strCommand.txt,arm2.txt,",",4
if(arm2.txt!="")
{
vis arm2,1
}
//id arm2
spstr strCommand.txt,va2.txt,",",5
//text arm3
spstr strCommand.txt,arm3.txt,",",6
if(arm3.txt!="")
{
vis arm3,1
}
//id arm3
spstr strCommand.txt,va3.txt,",",7
//text arm4
spstr strCommand.txt,arm4.txt,",",8
if(arm4.txt!="")
{
vis arm4,1
}
//id arm4
spstr strCommand.txt,va4.txt,",",9
//icon
spstr strCommand.txt,tTmp.txt,",",10
covx tTmp.txt,sys0,0,0
substr pageIcons.tIcons.txt,tIcon.txt,sys0,1
//numpad status
spstr strCommand.txt,tTmp.txt,",",11
if(tTmp.txt!="disable")
{
vis b0,1
vis b1,1
vis b2,1
vis b3,1
vis b4,1
vis b5,1
vis b6,1
vis b7,1
vis b8,1
vis b9,1
vis b10,1
vis tCode,1
}
}
if(tInstruction.txt=="time")
{
@@ -967,7 +1217,7 @@ Timer tmSerial
Timer tmSleep
Attributes
ID : 12
ID : 11
Scope : local
Period (ms): 1000
Enabled : yes
@@ -987,7 +1237,7 @@ Timer tmSleep
TouchCap tc0
Attributes
ID : 13
ID : 12
Scope: local
Value: 0

View File

@@ -16,20 +16,24 @@ cardMedia
116 Unique line(s) of event code
popupNotify
17 Component(s)
171 Line(s) of event code
113 Unique line(s) of event code
pageStartup
19 Component(s)
146 Line(s) of event code
111 Unique line(s) of event code
179 Line(s) of event code
118 Unique line(s) of event code
pageSwipeTest
18 Component(s)
62 Line(s) of event code
44 Unique line(s) of event code
popupLight
27 Component(s)
338 Line(s) of event code
170 Unique line(s) of event code
pageTest
14 Component(s)
14 Line(s) of event code
14 Unique line(s) of event code
pageStartup
19 Component(s)
146 Line(s) of event code
111 Unique line(s) of event code
popupShutter
19 Component(s)
194 Line(s) of event code
@@ -38,10 +42,6 @@ screensaver
25 Component(s)
173 Line(s) of event code
124 Unique line(s) of event code
cardAlarm
28 Component(s)
147 Line(s) of event code
106 Unique line(s) of event code
cardThermo
42 Component(s)
438 Line(s) of event code
@@ -54,13 +54,13 @@ cardGrid
39 Component(s)
406 Line(s) of event code
224 Unique line(s) of event code
popupLight
27 Component(s)
338 Line(s) of event code
170 Unique line(s) of event code
cardAlarm
35 Component(s)
259 Line(s) of event code
163 Unique line(s) of event code
Total
14 Page(s)
343 Component(s)
3172 Line(s) of event code
789 Unique line(s) of event code
350 Component(s)
3292 Line(s) of event code
842 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 : 120
Word wrap : enabled
Horizontal Spacing : 0

View File

@@ -402,7 +402,7 @@ Text tVersion
Horizontal Alignment : center
Vertical Alignment : center
Input Type : character
Text : 11
Text : 15
Max. Text Size : 10
Word wrap : disabled
Horizontal Spacing : 0

View File

@@ -807,7 +807,7 @@ Timer tmSleep
{
screensaver.originPage.val=dp
sleepValue=0
page cardEntities
click b0,1
}
}

View File

@@ -410,7 +410,7 @@ Timer tmSleep
{
screensaver.originPage.val=dp
sleepValue=0
page cardEntities
click b0,1
}
}
@@ -505,7 +505,7 @@ Timer tmSerial
//preserve old sleepTimeout
vaOldSleepT.val=sleepTimeout
// sleep timeout
spstr strCommand.txt,tTmp.txt,"|",9
spstr strCommand.txt,tTmp.txt,"|",10
covx tTmp.txt,sys0,0,0
sleepTimeout=sys0
}
@@ -531,6 +531,10 @@ Timer tmSerial
spstr strCommand.txt,tTmp.txt,",",1
covx tTmp.txt,sleepTimeout,0,0
}
if(tInstruction.txt=="exitPopup")
{
click b0,1
}
if(tInstruction.txt=="pageType")
{
sleepTimeout=vaOldSleepT.val
@@ -557,6 +561,10 @@ Timer tmSerial
{
page cardMedia
}
if(tId.txt=="cardThermo")
{
page cardThermo
}
if(tId.txt=="pageStartup")
{
page pageStartup

View File

@@ -563,7 +563,7 @@ Timer tmSleep
{
screensaver.originPage.val=dp
sleepValue=0
page cardEntities
click b0,1
}
}

Binary file not shown.

Binary file not shown.

View File

@@ -250,7 +250,7 @@ nspanel-1:
config:
panelRecvTopic: "tele/tasmota_your_mqtt_topic/RESULT"
panelSendTopic: "cmnd/tasmota_your_mqtt_topic/CustomSend"
updateMode: auto-notify # possible values are auto, auto-notify and manual
updateMode: auto-notify # possible values are auto, auto-notify and manual
timeoutScreensaver: 15 #in seconds
#brightnessScreensaver: 10
brightnessScreensaver:

View File

@@ -1,5 +1,5 @@
icons = {
'window-open': 0,
'alert-circle-outline': 0,
'lightbulb': 1,
'thermometer': 2,
'gesture-tap-button': 3,
@@ -10,7 +10,7 @@ icons = {
'pause': 8,
'play': 9,
'palette': 10,
'alert-circle-outline': 11,
'window-open': 11,
'weather-cloudy': 12,
'weather-fog': 13,
'weather-hail': 14,
@@ -34,6 +34,7 @@ icons = {
'solar-power': 32,
'battery-charging-medium': 33,
'battery-medium': 34,
'shield-home': 35,
}
def get_icon_id(ma_name):

View File

@@ -18,8 +18,8 @@ class NsPanelLovelaceUIManager(hass.Hass):
class Updater:
def __init__(self, nsplui, mode):
self.desired_display_firmware_version = 11
self.desired_display_firmware_url = "http://nspanel.pky.eu/lovelace-ui/github/nspanel-b0027d4.tft"
self.desired_display_firmware_version = 15
self.desired_display_firmware_url = "http://nspanel.pky.eu/lovelace-ui/github/nspanel-1f7a3d5.tft"
self.desired_tasmota_driver_version = 3
self.desired_tasmota_driver_url = "https://raw.githubusercontent.com/joBr99/nspanel-lovelace-ui/main/tasmota/autoexec.be"
@@ -205,6 +205,14 @@ class NsPanelLovelaceUI:
else:
value = None
self.handle_button_press(entity_id, btype, value)
if msg[1] == "buttonPress2":
entity_id = msg[2]
btype = msg[3]
if len(msg) > 4:
value = msg[4]
else:
value = None
self.handle_button_press(entity_id, btype, value)
if msg[1] == "pageOpenDetail":
self.api.log("Received pageOpenDetail command", level="DEBUG")
@@ -266,16 +274,24 @@ class NsPanelLovelaceUI:
'windy-variant': 'weather-windy-variant'
}
o1 = we.attributes.forecast[0]['datetime']
o1 = datetime.datetime.fromisoformat(o1)
o1 = babel.dates.format_date(o1, "E", locale=self.config["locale"])
i1 = get_icon_id(weathericons[we.attributes.forecast[0]['condition']])
u1 = we.attributes.forecast[0]['temperature']
o2 = we.attributes.forecast[1]['datetime']
o2 = datetime.datetime.fromisoformat(o2)
o2 = babel.dates.format_date(o2, "E", locale=self.config["locale"])
i2 = get_icon_id(weathericons[we.attributes.forecast[1]['condition']])
u2 = we.attributes.forecast[1]['temperature']
o1 = we.attributes.forecast[0]['datetime']
o1 = datetime.datetime.fromisoformat(o1)
o2 = we.attributes.forecast[1]['datetime']
o2 = datetime.datetime.fromisoformat(o2)
global babel_spec
if babel_spec is not None:
o1 = babel.dates.format_date(o1, "E", locale=self.config["locale"])
o2 = babel.dates.format_date(o2, "E", locale=self.config["locale"])
else:
o1 = o1.strftime("%a")
o2 = o2.strftime("%a")
self.send_mqtt_msg(f"weatherUpdate,?{get_icon_id(weathericons[we.state])}?{we.attributes.temperature}{unit}?{26}?{we.attributes.humidity} %?{o1}?{i1}?{u1}?{o2}?{i2}?{u2}")
@@ -468,26 +484,19 @@ class NsPanelLovelaceUI:
if item_type == "light":
switch_val = 1 if entity.state == "on" else 0
icon_color = 17299
if "rgb_color" in entity.attributes:
color = entity.attributes.rgb_color
if "brightness" in entity.attributes:
color = rgb_brightness(color, entity.attributes.brightness)
icon_color = rgb_dec565(color)
elif "brightness" in entity.attributes:
color = rgb_brightness([253, 216, 53], entity.attributes.brightness)
icon_color = rgb_dec565(color)
icon_color = self.getEntityColor(entity)
return f",{item_type},{item},{get_icon_id('lightbulb')},{icon_color},{name},{switch_val}"
if item_type == "switch" or item_type == "input_boolean":
switch_val = 1 if entity.state == "on" else 0
icon_id = get_icon_id("flash")
icon_color = self.getEntityColor(entity)
if item_type == "input_boolean":
if switch_val == 1:
icon_id = get_icon_id("check-circle-outline")
else:
icon_id = get_icon_id("close-circle-outline")
return f",switch,{item},{icon_id},17299,{name},{switch_val}"
return f",switch,{item},{icon_id},{icon_color},{name},{switch_val}"
if item_type == "sensor":
# maps ha device classes to material design icons
@@ -614,22 +623,29 @@ class NsPanelLovelaceUI:
return f"entityUpd,|{item}|{heading}|{icon}|{title}|{author}|{volume}|{iconplaypause}"
def getEntityColor(self, entity):
attr = entity.attributes
default_color_on = rgb_dec565([253, 216, 53])
default_color_off = rgb_dec565([68, 115, 158])
icon_color = default_color_on if entity.state == "on" else default_color_off
if "rgb_color" in attr:
color = attr.rgb_color
if "brightness" in attr:
color = rgb_brightness(color, attr.brightness)
icon_color = rgb_dec565(color)
elif "brightness" in attr:
color = rgb_brightness([253, 216, 53], attr.brightness)
icon_color = rgb_dec565(color)
return icon_color
def generate_detail_page(self, page_type, entity):
if page_type == "popupLight":
entity = self.api.get_entity(entity)
switch_val = 1 if entity.state == "on" else 0
icon_color = 17299
if "rgb_color" in entity.attributes:
color = entity.attributes.rgb_color
if "brightness" in entity.attributes:
color = rgb_brightness(color, entity.attributes.brightness)
icon_color = rgb_dec565(color)
elif "brightness" in entity.attributes:
color = rgb_brightness([253, 216, 53], entity.attributes.brightness)
icon_color = rgb_dec565(color)
icon_color = self.getEntityColor(entity)
brightness = "disable"
color_temp = "disable"

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 KiB

After

Width:  |  Height:  |  Size: 246 KiB

View File

@@ -11,7 +11,7 @@ nspanel-1:
config:
panelRecvTopic: "tele/tasmota_your_mqtt_topic/RESULT"
panelSendTopic: "cmnd/tasmota_your_mqtt_topic/CustomSend"
updateMode: auto-notify # possible values are auto, auto-notify and manual
updateMode: auto-notify # possible values are auto, auto-notify and manual
timeoutScreensaver: 15 #in seconds
#brightnessScreensaver: 10
brightnessScreensaver:

View File

@@ -1,3 +1,13 @@
type RGB = {
red: number,
green: number,
blue: number
};
const Red: RGB = { red: 255, green: 0, blue: 0 };
const White: RGB = { red: 255, green: 255, blue: 255 };
const Blue: RGB = { red: 68, green: 115, blue: 158 };
type Payload = {
payload: string;
};
@@ -5,17 +15,21 @@ type Payload = {
type Page = {
type: string,
heading: string
}
};
interface PageEntities extends Page {
type: "cardEntities",
items: string[]
}
items: PageItem[]
};
interface PageGrid extends Page {
type: "cardGrid",
items: PageItem[]
};
interface PageThermo extends Page {
type: "cardThermo",
item: string
}
item: PageItem
};
type Config = {
panelRecvTopic: string,
panelSendTopic: string,
@@ -35,11 +49,21 @@ type Config = {
rightEntityIcon: number,
rightEntityText: string,
rightEntityUnitText: string | null,
pages: (PageThermo | PageEntities)[],
button1Page: (PageThermo | PageEntities | null),
button2Page: (PageThermo | PageEntities | null),
}
defaultColor: RGB,
gridPageOnColor: RGB,
gridPageOffColor: RGB,
pages: (PageThermo | PageEntities | PageGrid)[],
button1Page: (PageThermo | PageEntities | PageGrid | null),
button2Page: (PageThermo | PageEntities | PageGrid | null),
};
type PageItem = {
id: string,
icon: (string | undefined),
onColor: (RGB | undefined),
offColor: (RGB | undefined),
useColor: (boolean | undefined)
}
var subscriptions: any = {};
var pageId = 0;
@@ -49,10 +73,10 @@ var page1: PageEntities =
"type": "cardEntities",
"heading": "Haus",
"items": [
"alias.0.Rolladen_Eltern",
"alias.0.Erker",
"alias.0.Küche",
"alias.0.Wand"
<PageItem>{ id: "alias.0.Rolladen_Eltern" },
<PageItem>{ id: "alias.0.Erker" },
<PageItem>{ id: "alias.0.Küche", useColor: true },
<PageItem>{ id: "alias.0.Wand", useColor: true }
]
};
@@ -61,22 +85,21 @@ var page2: PageEntities =
"type": "cardEntities",
"heading": "Strom",
"items": [
"alias.0.Netz",
"alias.0.Hausverbrauch",
"alias.0.Pv",
"alias.0.Batterie"
<PageItem>{ id: "alias.0.Netz" },
<PageItem>{ id: "alias.0.Hausverbrauch" },
<PageItem>{ id: "alias.0.Pv" },
<PageItem>{ id: "alias.0.Batterie" }
]
};
var button1Page: PageEntities =
var button1Page: PageGrid =
{
"type": "cardEntities",
"heading": "Knopf1",
"type": "cardGrid",
"heading": "Radio",
"items": [
"alias.0.Schlafen",
"alias.0.Stern",
"delete",
"delete"
<PageItem>{ id: "alias.0.Radio.NJoy" },
<PageItem>{ id: "alias.0.Radio.Delta_Radio" },
<PageItem>{ id: "alias.0.Radio.NDR2" },
]
};
@@ -86,11 +109,8 @@ var button2Page: PageEntities =
"type": "cardEntities",
"heading": "Knopf2",
"items": [
"delete",
"delete",
"alias.0.Schlafen",
"alias.0.Stern"
<PageItem>{ id: "alias.0.Schlafen" },
<PageItem>{ id: "alias.0.Stern" }
]
};
@@ -111,14 +131,15 @@ var config: Config = {
timeFormat: "%H:%M",
dateFormat: "%A, %d. %B %Y",
weatherEntity: "alias.0.Wetter",
gridPageOffColor: Blue,
gridPageOnColor: White,
defaultColor: Blue,
temperatureUnit: "°C",
pages: [page1, page2,
{
"type": "cardThermo",
"heading": "Thermostat",
"item": "alias.0.WzNsPanel"
"item": <PageItem>{ id: "alias.0.WzNsPanel" }
}
],
button1Page: button1Page,
@@ -132,6 +153,9 @@ schedule("0 * * * *", function () {
SendDate();
});
// Only monitor the extra nodes if one or both are present
var updateArray: string[] = [];
if (config.rightEntity !== null && existsState(config.rightEntity)) {
@@ -201,18 +225,22 @@ function HandleMessage(typ: string, method: string, page: number, words: Array<s
}
function GeneratePage(page: Page): void {
var retMsgs: Array<Payload> = [];
if (page.type == "cardEntities") {
retMsgs = GenerateEntitiesPage(<PageEntities>config.pages[pageId])
} else if (page.type == "cardThermo") {
retMsgs = GenerateThermoPage(pageId, <PageThermo>config.pages[pageId])
}
SendToPanel(retMsgs)
switch (page.type) {
case "cardEntities":
SendToPanel(GenerateEntitiesPage(<PageEntities>page));
break;
case "cardThermo":
SendToPanel(GenerateThermoPage(<PageThermo>page));
break;
case "cardGrid":
SendToPanel(GenerateGridPage(<PageGrid>page));
break;
}
}
function HandleHardwareButton(method: string): void {
let page: (PageThermo | PageEntities);
let page: (PageThermo | PageEntities | PageGrid);
if (config.button1Page !== null && method == "button1") {
page = config.button1Page;
}
@@ -222,15 +250,18 @@ function HandleHardwareButton(method: string): void {
else {
return;
}
SendToPanel({ payload: "wake" });
switch (page.type) {
case "cardEntities":
SendToPanel(GenerateEntitiesPage(page));
break;
case "cardThermo":
SendToPanel(GenerateThermoPage(0, page));
break;
}
log("button1");
GeneratePage(page);
//SendToPanel({ payload: "wake" });
// switch (page.type) {
// case "cardEntities":
// SendToPanel(GenerateEntitiesPage(page));
// break;
// case "cardThermo":
// SendToPanel(GenerateThermoPage(0, page));
// break;
// }
}
function HandleStartupProcess(): void {
@@ -270,78 +301,110 @@ function SendTime(): void {
function GenerateEntitiesPage(page: PageEntities): Payload[] {
var out_msgs: Array<Payload> = [];
out_msgs = [{ payload: "pageType,cardEntities" }, { payload: "entityUpdHeading," + page.heading }]
let pageData = "entityUpd";
page.items.forEach(function (id, i) {
pageData += CreateEntity(id, i + 1);
})
out_msgs.push({ payload: pageData });
out_msgs.push({ payload: GeneratePageElements(page.items, 4) });
return out_msgs
}
function CreateEntity(id: string, placeId: number): string {
var type = "delete"
var iconId = 0
var name = "FriendlyName"
if (id == "delete") {
return ",delete,,,,"
}
function GenerateGridPage(page: PageGrid): Payload[] {
var out_msgs: Array<Payload> = [];
out_msgs = [{ payload: "pageType,cardGrid" }, { payload: "entityUpdHeading," + page.heading }]
out_msgs.push({ payload: GeneratePageElements(page.items, 6, true) });
return out_msgs
}
function GeneratePageElements(pageItems: PageItem[], maxItems: number, useColors: boolean = false): string {
let pageData = "entityUpd";
for (let index = 0; index < maxItems; index++) {
if (pageItems[index] !== undefined) {
pageData += CreateEntity(pageItems[index], index + 1, useColors);
}
else {
pageData += CreateEntity(<PageItem>{ id: "delete" }, index + 1);
}
}
return pageData;
}
function CreateEntity(pageItem: PageItem, placeId: number, useColors: boolean = false): string {
var iconId = 0
if (pageItem.id == "delete") {
return ",delete,,,,,"
}
var name: string;
var type: string;
// ioBroker
if (existsObject(id)) {
let o = getObject(id)
if (existsObject(pageItem.id)) {
let o = getObject(pageItem.id)
var val = null;
name = o.common.name.de
if (existsState(id + ".GET")) {
val = getState(id + ".GET").val;
RegisterEntityWatcher(id + ".GET", id, placeId);
if (existsState(pageItem.id + ".GET")) {
val = getState(pageItem.id + ".GET").val;
RegisterEntityWatcher(pageItem.id + ".GET", pageItem.id, placeId);
}
else if (existsState(id + ".SET")) {
val = getState(id + ".SET").val;
RegisterEntityWatcher(id + ".SET", id, placeId);
else if (existsState(pageItem.id + ".SET")) {
val = getState(pageItem.id + ".SET").val;
RegisterEntityWatcher(pageItem.id + ".SET", pageItem.id, placeId);
}
var iconColor = rgb_dec565(useColors ? config.gridPageOffColor : config.defaultColor);
switch (o.common.role) {
case "light":
type = "light"
iconId = 1
var optVal = "0"
if (val === true || val === "true")
if (val === true || val === "true") {
optVal = "1"
return "," + type + "," + id + "," + iconId + "," + "17299," + name + "," + optVal
iconColor = rgb_dec565(useColors ? config.gridPageOnColor : config.defaultColor);
}
return "," + type + "," + pageItem.id + "," + iconId + "," + iconColor + "," + name + "," + optVal
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);
if (existsState(pageItem.id + ".ON_ACTUAL")) {
val = getState(pageItem.id + ".ON_ACTUAL").val;
RegisterEntityWatcher(pageItem.id + ".ON_ACTUAL", pageItem.id, placeId);
}
else if (existsState(id + ".ON_SET")) {
val = getState(id + ".ON_SET").val;
RegisterEntityWatcher(id + ".ON_SET", id, placeId);
else if (existsState(pageItem.id + ".ON_SET")) {
val = getState(pageItem.id + ".ON_SET").val;
RegisterEntityWatcher(pageItem.id + ".ON_SET", pageItem.id, placeId);
}
if (val === true || val === "true")
if (val === true || val === "true") {
optVal = "1"
return "," + type + "," + id + "," + iconId + "," + "17299," + name + "," + optVal
if ((pageItem.useColor || useColors) && existsState(pageItem.id + ".ACTUAL")) {
let iconColorRgb =
Interpolate(
pageItem.onColor !== undefined ? pageItem.onColor : config.gridPageOffColor,
pageItem.offColor !== undefined ? pageItem.offColor : config.gridPageOnColor,
(getState(pageItem.id + ".ACTUAL").val / 100)
);
iconColor = rgb_dec565(iconColorRgb);
}
}
return "," + type + "," + pageItem.id + "," + iconId + "," + iconColor + "," + name + "," + optVal
case "blind":
type = "shutter"
iconId = 0
return "," + type + "," + id + "," + iconId + "," + "17299," + name + ","
return "," + type + "," + pageItem.id + "," + iconId + "," + iconColor + "," + name + ","
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);
if (existsState(pageItem.id + ".ON_ACTUAL")) {
optVal = getState(pageItem.id + ".ON_ACTUAL").val + " " + GetUnitOfMeasurement(pageItem.id + ".ON_ACTUAL");
RegisterEntityWatcher(pageItem.id + ".ON_ACTUAL", pageItem.id, placeId);
}
else if (existsState(id + ".ACTUAL")) {
optVal = getState(id + ".ACTUAL").val;
RegisterEntityWatcher(id + ".ACTUAL", id, placeId);
else if (existsState(pageItem.id + ".ACTUAL")) {
optVal = getState(pageItem.id + ".ACTUAL").val;
RegisterEntityWatcher(pageItem.id + ".ACTUAL", pageItem.id, placeId);
}
if (o.common.role == "value.temperature") {
@@ -349,15 +412,15 @@ function CreateEntity(id: string, placeId: number): string {
optVal += config.temperatureUnit;
}
else {
optVal += GetUnitOfMeasurement(id + ".ACTUAL");
optVal += GetUnitOfMeasurement(pageItem.id + ".ACTUAL");
}
return "," + type + "," + id + "," + iconId + "," + "17299," + name + "," + optVal;
return "," + type + "," + pageItem.id + "," + iconId + "," + iconColor + "," + name + "," + optVal;
case "button":
type = "button";
iconId = 3;
var optVal = "PRESS";
return "," + type + "," + id + "," + iconId + "," + "17299," + name + "," + optVal;
return "," + type + "," + pageItem.id + "," + iconId + "," + + iconColor + "," + name + "," + optVal;
default:
return ",delete,,,,"
@@ -365,7 +428,7 @@ function CreateEntity(id: string, placeId: number): string {
}
}
return ",delete,,,,"
return ",delete,,,,,"
}
function RegisterEntityWatcher(id: string, entityId: string, placeId: number): void {
@@ -402,8 +465,8 @@ function GetUnitOfMeasurement(id: string): string {
return "";
}
function GenerateThermoPage(pageNum: number, page: PageThermo): Payload[] {
var id = page.item
function GenerateThermoPage(page: PageThermo): Payload[] {
var id = page.item.id
var out_msgs: Array<Payload> = [];
out_msgs.push({ payload: "pageType,cardThermo" });
@@ -432,11 +495,38 @@ function GenerateThermoPage(pageNum: number, page: PageThermo): Payload[] {
return out_msgs
}
function setIfExists(id: string, value: any, type: string | null = null): boolean {
if (type === null) {
if (existsState(id)) {
setState(id, value);
return true;
}
}
else {
let obj = getObject(id);
if (existsState(id) && obj.common.type !== undefined && obj.common.type === type) {
log(id)
setState(id, value);
return true;
}
}
return false;
}
function toggleState(id: string): boolean {
let obj = getObject(id);
if (existsState(id) && obj.common.type !== undefined && obj.common.type === "boolean") {
setState(id, !getState(id).val);
return true;
}
return false;
}
function HandleButtonEvent(words): void {
let id = words[4]
if (words[6] == "OnOff" && existsObject(id)) {
var action = false
if (words[7] == "1")
action = true
@@ -459,8 +549,12 @@ function HandleButtonEvent(words): void {
setState(id + ".STOP", true)
if (words[6] == "down")
setState(id + ".CLOSE", true)
if (words[6] == "button")
setState(id + ".SET", true)
if (words[6] == "button") {
let switchOn = true;
if (words[5] !== "1")
switchOn = false;
toggleState(id + ".SET") ? true : toggleState(id + ".ON_SET")
}
if (words[6] == "positionSlider")
setState(id + ".SET", parseInt(words[7]))
@@ -500,7 +594,7 @@ function GenerateDetailPage(type: string, entityId: string): Payload[] {
if (val)
switchVal = "1"
out_msgs.push({ payload: "entityUpdateDetail," + icon + "," + "17299," + switchVal + ",disable,disable,disable" })
out_msgs.push({ payload: "entityUpdateDetail," + icon + "," + "17299," + switchVal + ",disable,disable,disable" })
}
if (o.common.role == "dimmer") {
@@ -564,35 +658,31 @@ function HandleScreensaverUpdate(): void {
let temperature: string =
existsState(config.weatherEntity + ".ACTUAL") ? getState(config.weatherEntity + ".ACTUAL").val :
existsState(config.weatherEntity + ".TEMP") ? getState(config.weatherEntity + ".TEMP").val: "null";
existsState(config.weatherEntity + ".TEMP") ? getState(config.weatherEntity + ".TEMP").val : "null";
let humidity = getState(config.weatherEntity + ".HUMIDITY").val;
let payloadString =
"weatherUpdate,?" + GetAccuWeatherIcon(parseInt(icon)) + "?"
+ temperature + " " + config.temperatureUnit + "?26?"
+ humidity + " %?" ;
"weatherUpdate,?" + GetAccuWeatherIcon(parseInt(icon)) + "?"
+ temperature + " " + config.temperatureUnit + "?26?"
+ humidity + " %?";
if(existsState(config.leftEntity))
{
if (existsState(config.leftEntity)) {
let u1 = getState(config.leftEntity).val;
payloadString += config.leftEntityText + "?" + config.leftEntityIcon + "?" + u1 + " " + config.leftEntityUnitText + "?";
}
else
{
else {
payloadString += "???";
}
if(existsState(config.rightEntity))
{
if (existsState(config.rightEntity)) {
let u2 = getState(config.rightEntity).val;
payloadString += config.rightEntityText + "?" + config.rightEntityIcon + "?" + u2 + " " + config.rightEntityUnitText;
}
else
{
else {
payloadString += "??";
}
SendToPanel(<Payload>{ payload: payloadString});
SendToPanel(<Payload>{ payload: payloadString });
}
}
@@ -671,3 +761,23 @@ function GetAccuWeatherIcon(icon: number): number {
}
}
function GetBlendedColor(percentage: number): RGB {
if (percentage < 50)
return Interpolate(config.gridPageOffColor, config.gridPageOnColor, percentage / 50.0);
return Interpolate(Red, White, (percentage - 50) / 50.0);
}
function Interpolate(color1: RGB, color2: RGB, fraction: number): RGB {
var r: number = InterpolateNum(color1.red, color2.red, fraction);
var g: number = InterpolateNum(color1.green, color2.green, fraction);
var b: number = InterpolateNum(color1.blue, color2.blue, fraction);
return <RGB>{ red: Math.round(r), green: Math.round(g), blue: Math.round(b) };
}
function InterpolateNum(d1: number, d2: number, fraction: number): number {
return d1 + (d2 - d1) * fraction;
}
function rgb_dec565(rgb: RGB): number {
return ((Math.floor(rgb.red / 255 * 31) << 11) | (Math.floor(rgb.green / 255 * 63) << 5) | (Math.floor(rgb.blue / 255 * 31)))
}

View File

@@ -73,17 +73,19 @@ var config: Config = {
timeFormat: "%H:%M", // not used right now
dateFormat: "%A, %d. %B %Y", // not used right now
weatherEntity: "alias.0.Wetter",
defaultColor: RGB, // Default color of all elements
gridPageOnColor: RGB, // Default on color on grid page
gridPageOffColor: RGB, // Default off color on grid page
temperatureUnit: "°C", // Unit to append on temperature sensors
pages: [
{
"type": "cardEntities", // card type (cardEntities, cardThermo)
"heading": "Testseite", // heading
"items": [ // items array (up to 4 on cardEntities, 1 for cardThermo)
"alias.0.Rolladen_Eltern", // device which must be configured in the device panel. Use only the folder for the device, not the set, get states ...
"alias.0.Erker",
"alias.0.Küche",
"alias.0.Wand"
<PageItem>{ id: "alias.0.Rolladen_Eltern" }, // device which must be configured in the device panel. Use only the folder for the device, not the set, get states ...
<PageItem>{ id: "alias.0.Erker" },
<PageItem>{ id: "alias.0.Küche", useColor: true },
<PageItem>{ id: "alias.0.Wand", useColor: true }
]
},
@@ -91,10 +93,10 @@ var config: Config = {
"type": "cardEntities",
"heading": "Strom",
"items": [
"alias.0.Netz",
"alias.0.Hausverbrauch",
"alias.0.Pv",
"alias.0.Batterie"
<PageItem>{ id: "alias.0.Netz" },
<PageItem>{ id: "alias.0.Hausverbrauch" },
<PageItem>{ id: "alias.0.Pv" },
<PageItem>{ id: "alias.0.Batterie" }
]
},
@@ -109,18 +111,29 @@ var config: Config = {
};
```
The pageItem element:
```
type PageItem = {
id: string, // the element in ioBroker devices
icon: (string | undefined), // the icon which should be displayed instead of the default detected. (not implemented)
onColor: (RGB | undefined), // the color the item will get when active
offColor: (RGB | undefined), // the color the item will get when inactive
useColor: (boolean | undefined) // override colors, only Grid pages has colors enabled per default
}
```
If you want you can create dedicated objects, so you don't need to declare them again. Then you can use tehm in the pages array and button pages.
```
var button1Page: PageEntities =
var button1Page: PageGrid =
{
"type": "cardEntities",
"heading": "Knopf1",
"type": "cardGrid",
"heading": "Radio",
"items": [
"alias.0.Schlafen",
"alias.0.Stern",
"delete",
"delete"
<PageItem>{ id: "alias.0.Radio.NJoy" },
<PageItem>{ id: "alias.0.Radio.Delta_Radio" },
<PageItem>{ id: "alias.0.Radio.NDR2" },
]
};
```
@@ -134,11 +147,10 @@ pages: [
"type": "cardEntities",
"heading": "Strom",
"items": [
"alias.0.Netz",
"alias.0.Hausverbrauch",
"alias.0.Pv",
"alias.0.Batterie"
<PageItem>{ id: "alias.0.Netz" },
<PageItem>{ id: "alias.0.Hausverbrauch" },
<PageItem>{ id: "alias.0.Pv" },
<PageItem>{ id: "alias.0.Batterie" }
]
}]
```

View File

@@ -1,11 +1,6 @@
# Node-Red Flow
## Note:
**This flow has been deprecated in favour of the AppDaemon Backend.**
**It's still functioning with a limited feature set.**
There is no node-red backend, but for some advanced scenarios nodered can become handy, like remote controlling your nspanel.
![nodered-remote-control](../doc-pics/nodered-remote-control.png)
This is the exmaple node red flow which an be used to control the screen over MQTT.
Import the example node-red flow from "node-red-example-flow.json" file and adjust to your needs.

File diff suppressed because one or more lines are too long