Files
NSPanel_HA_Blueprint/nspanel_eu_code/home.txt
Edward Firmo 7452dfd2bb Simplify touchevent engine
The touch event is used only for the sleeping engine (it will be used for dimming later) and it was transferring all the json info with page name, component, entity, etc.
This was replaced by a simple random integer with no meaning other than "the screen was touched, reset the timer".
2023-09-11 12:17:10 +02:00

659 lines
17 KiB
Plaintext

Page home
Attributes
ID : 0
Scope : local
Dragging : 0
Send Component ID : disabled
Locked : no
Swide up page ID : disabled
Swide down page ID : disabled
Swide left page ID : disabled
Swide right page ID: disabled
Events
Preinitialize Event
dim=brightness
dimtimer.en=1
sleeptimer.en=1
printh 92
prints "nspanelevent",0
printh 00
prints "{\"page\": \"home\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0
printh 00
printh FF FF FF
vis bt_notific,is_notification
vis bt_qrcode,is_qrcode
vis bt_entities,is_entities
vis bt_alarm,is_alarm
if(display_mode==3)
{
vis left_bt_text,0
vis right_bt_text,0
}
Touch Press Event
printh 91
prints "touchevent",0
printh 00
prints rand,0
printh FF FF FF
Touch Release Event
printh 91
prints "touchevent",0
printh 00
prints rand,0
printh FF FF FF
Variable (int32) disdim
Attributes
ID : 2
Scope: global
Value: 0
Variable (string) lastclick
Attributes
ID : 45
Scope : local
Text :
Max. Text Size: 100
Variable (string) climate_entity
Attributes
ID : 46
Scope : global
Text :
Max. Text Size: 100
Text time
Attributes
ID : 5
Scope : global
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 5
Text current_temp
Attributes
ID : 6
Scope : global
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 8
Text outdoor_temp
Attributes
ID : 7
Scope : global
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 8
Text date
Attributes
ID : 8
Scope : global
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 25
Text value01_state
Attributes
ID : 10
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Text left_bt_text
Attributes
ID : 14
Scope : global
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 20
Text right_bt_text
Attributes
ID : 15
Scope : global
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 20
Text icon_top_01
Attributes
ID : 16
Scope : global
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Text icon_top_02
Attributes
ID : 17
Scope : global
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Text icon_top_03
Attributes
ID : 18
Scope : global
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Text icon_top_04
Attributes
ID : 19
Scope : global
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Text icon_top_05
Attributes
ID : 20
Scope : global
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Text icon_top_06
Attributes
ID : 21
Scope : global
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Text icon_top_07
Attributes
ID : 22
Scope : global
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Text icon_top_08
Attributes
ID : 23
Scope : global
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Text icon_top_09
Attributes
ID : 24
Scope : global
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Text icon_top_10
Attributes
ID : 25
Scope : global
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Text value01_icon
Attributes
ID : 26
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Text value03_state
Attributes
ID : 27
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Text value03_icon
Attributes
ID : 28
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Text value02_icon
Attributes
ID : 29
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Text value02_state
Attributes
ID : 30
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Text wifi_icon
Attributes
ID : 31
Scope : global
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 5
Text indoortempicon
Attributes
ID : 32
Scope : global
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Text button01_icon
Attributes
ID : 33
Scope : global
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Text button02_icon
Attributes
ID : 34
Scope : global
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Text button03_icon
Attributes
ID : 35
Scope : global
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Text bt_notific
Attributes
ID : 36
Scope : global
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Events
Touch Release Event
if(api==1)
{
page notification
}
Text bt_qrcode
Attributes
ID : 37
Scope : global
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Events
Touch Release Event
page qrcode
Text bt_entities
Attributes
ID : 38
Scope : global
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Events
Touch Release Event
if(api==1)
{
page entitypage01
}
Text bt_alarm
Attributes
ID : 39
Scope : global
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Events
Touch Release Event
if(api==1)
{
page alarm
}
Text meridiem
Attributes
ID : 44
Scope : global
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Picture weather
Attributes
ID : 9
Scope : global
Dragging : 0
Send Component ID: disabled
Dual-state Button left_bt_pic
Attributes
ID : 48
Scope : global
Dragging : 0
Send Component ID: disabled
State : unpressed
Text :
Max. Text Size : 0
Dual-state Button right_bt_pic
Attributes
ID : 49
Scope : global
Dragging : 0
Send Component ID: disabled
State : unpressed
Text :
Max. Text Size : 0
Hotspot fc_weather
Attributes
ID : 11
Scope : global
Dragging : 0
Send Component ID: on press and release
Events
Touch Press Event
if(api==1)
{
page weather01
}
Hotspot jump_climate
Attributes
ID : 12
Scope : local
Dragging : 0
Send Component ID: on press and release
Events
Touch Press Event
if(climate_entity.txt=="")
{
lastclick.txt="{\"page\": \"home\", \"component\": \"climate\", \"value\": \"press\"}"
printh 92
prints "nspanelevent",0
printh 00
prints lastclick.txt,0
printh 00
printh FF FF FF
}else
{
climate.entity.txt=climate_entity.txt
page climate
}
Touch Release Event
if(climate_entity.txt=="")
{
lastclick.txt="{\"page\": \"home\", \"component\": \"climate\", \"value\": \"release\"}"
printh 92
prints "nspanelevent",0
printh 00
prints lastclick.txt,0
printh 00
printh FF FF FF
}else
{
page climate
}
Hotspot button01
Attributes
ID : 40
Scope : local
Dragging : 0
Send Component ID: disabled
Events
Touch Release Event
lastclick.txt="{\"page\": \"home\", \"component\": \"button01\", \"value\": \"release\"}"
printh 92
prints "nspanelevent",0
printh 00
prints lastclick.txt,0
printh 00
printh FF FF FF
Hotspot button02
Attributes
ID : 41
Scope : local
Dragging : 0
Send Component ID: disabled
Events
Touch Release Event
lastclick.txt="{\"page\": \"home\", \"component\": \"button02\", \"value\": \"release\"}"
printh 92
prints "nspanelevent",0
printh 00
prints lastclick.txt,0
printh 00
printh FF FF FF
Hotspot button03
Attributes
ID : 42
Scope : local
Dragging : 0
Send Component ID: disabled
Events
Touch Release Event
lastclick.txt="{\"page\": \"home\", \"component\": \"button03\", \"value\": \"release\"}"
printh 92
prints "nspanelevent",0
printh 00
prints lastclick.txt,0
printh 00
printh FF FF FF
Hotspot settings_click
Attributes
ID : 43
Scope : local
Dragging : 0
Send Component ID: disabled
Events
Touch Press Event
settings_timer.en=1
Touch Release Event
settings_timer.en=0
Timer dimtimer
Attributes
ID : 1
Scope : global
Period (ms): 50000
Enabled : yes
Events
Timer Event
if(disdim.val==0)
{
dim=brightness_dim // Dim down screen to val set from HA
}
Timer swipestore
Attributes
ID : 4
Scope : local
Period (ms): 50
Enabled : no
Events
Timer Event
swipex=tch0
swipey=tch1
Timer sleeptimer
Attributes
ID : 13
Scope : local
Period (ms): 65000
Enabled : no
Events
Timer Event
if(sleep_mode==1)
{
screensaver.orign.val=0
// Go to screensaver page
page screensaver
}
Timer settings_timer
Attributes
ID : 47
Scope : local
Period (ms): 1000
Enabled : no
Events
Timer Event
page settings
TouchCap swipe
Attributes
ID : 3
Scope: local
Value: 0
Events
Touch Press Event
swipestore.en=1 // Start swipestore timer
dim=brightness // Set brightness to saved value (from HA)
dimtimer.en=1 // Enable timer to calc down for dimming screen
sleeptimer.en=1
Touch Release Event
swipestore.en=0
// Touch has ended, x
if(tch0==0)
{
swipec=swipex-tch2
// From Left to Right
if(swipec>swipedx&&api==1)
{
page buttonpage04
}
// Right to Left
swipec2=0-swipedx
if(swipec<swipec2&&api==1)
{
page buttonpage01
}
}
// Touch has ended, y
if(tch1==0)
{
swipec=swipey-tch3
// From Up to Down
if(swipec>100&&api==1)
{
page buttonpage02
}
// Down to Up
swipec2=0-swipedy
if(swipec<-100&&api==1)
{
page buttonpage03
}
}