Since v3.4, the info about entity_id shown was going all the way to Nextion and then sent back in the json return, however this requires a long (100-char) global var and the way it was implemented, it was one of those per settings page, as climate should be also recorded at the same time in case the embedded climate was installed. This was taking too much memory, so I've moved this info to a global variable (string) in ESPHome. There is now lots of space for code cleaning (and still pending to do the same with climate entity, as it could be only a bool to inform if embedded), but this brings the functionality. This enabled the return to global for some components, so it probably solves #1031
419 lines
11 KiB
Plaintext
419 lines
11 KiB
Plaintext
Page fan
|
|
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
|
|
if(api==0)
|
|
{
|
|
page home
|
|
}else
|
|
{
|
|
printh 92
|
|
prints "nspanelevent",0
|
|
printh 00
|
|
prints "{\"page\": \"fan\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0
|
|
printh 00
|
|
printh FF FF FF
|
|
}
|
|
|
|
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 (string) fansetting
|
|
Attributes
|
|
ID : 7
|
|
Scope : local
|
|
Text :
|
|
Max. Text Size: 255
|
|
|
|
Variable (string) back_page
|
|
Attributes
|
|
ID : 8
|
|
Scope : local
|
|
Text : home
|
|
Max. Text Size: 15
|
|
|
|
Variable (string) va0
|
|
Attributes
|
|
ID : 9
|
|
Scope : local
|
|
Text :
|
|
Max. Text Size: 10
|
|
|
|
Text fan_value
|
|
Attributes
|
|
ID : 1
|
|
Scope : local
|
|
Dragging : 0
|
|
Send Component ID : disabled
|
|
Associated Keyboard: none
|
|
Text :
|
|
Max. Text Size : 10
|
|
|
|
Text page_label
|
|
Attributes
|
|
ID : 2
|
|
Scope : local
|
|
Dragging : 0
|
|
Send Component ID : disabled
|
|
Associated Keyboard: none
|
|
Text :
|
|
Max. Text Size : 25
|
|
|
|
Text icon_state
|
|
Attributes
|
|
ID : 6
|
|
Scope : local
|
|
Dragging : 0
|
|
Send Component ID : disabled
|
|
Associated Keyboard: none
|
|
Text :
|
|
Max. Text Size : 10
|
|
|
|
Slider fanslider
|
|
Attributes
|
|
ID : 3
|
|
Scope : local
|
|
Dragging : 0
|
|
Send Component ID: disabled
|
|
Position : 0
|
|
Upper range limit: 4
|
|
Lower range limit: 0
|
|
|
|
Events
|
|
Touch Release Event
|
|
sys0=100*fanslider.val/fanslider.maxval
|
|
covx sys0,va0.txt,0,0
|
|
fan_value.txt=va0.txt+"%"
|
|
if(fanslider.val>fanslider.minval)
|
|
{
|
|
button_off.pco=59164
|
|
button_down.pco=59164
|
|
}else
|
|
{
|
|
button_off.pco=10597
|
|
button_down.pco=10597
|
|
}
|
|
if(fanslider.val<fanslider.maxval)
|
|
{
|
|
button_up.pco=59164
|
|
}else
|
|
{
|
|
button_up.pco=10597
|
|
}
|
|
timer0.en=1
|
|
|
|
Button button_up
|
|
Attributes
|
|
ID : 10
|
|
Scope : local
|
|
Dragging : 0
|
|
Send Component ID: disabled
|
|
State : unpressed
|
|
Text :
|
|
Max. Text Size : 10
|
|
|
|
Events
|
|
Touch Press Event
|
|
if(fanslider.val<fanslider.maxval)
|
|
{
|
|
fanslider.val++
|
|
sys0=100*fanslider.val/fanslider.maxval
|
|
covx sys0,va0.txt,0,0
|
|
fan_value.txt=va0.txt+"%"
|
|
}
|
|
if(fanslider.val>fanslider.minval)
|
|
{
|
|
button_off.pco=59164
|
|
button_down.pco=59164
|
|
}else
|
|
{
|
|
button_off.pco=10597
|
|
button_down.pco=10597
|
|
}
|
|
if(fanslider.val<fanslider.maxval)
|
|
{
|
|
button_up.pco=59164
|
|
}else
|
|
{
|
|
button_up.pco=10597
|
|
}
|
|
|
|
Touch Release Event
|
|
timer0.en=1
|
|
|
|
Button button_on
|
|
Attributes
|
|
ID : 11
|
|
Scope : local
|
|
Dragging : 0
|
|
Send Component ID: disabled
|
|
State : unpressed
|
|
Text :
|
|
Max. Text Size : 10
|
|
|
|
Events
|
|
Touch Press Event
|
|
fanslider.val=fanslider.maxval/2
|
|
sys0=fanslider.maxval*5
|
|
sys0%=10
|
|
if(sys0>=5)
|
|
{
|
|
fanslider.val++
|
|
}
|
|
sys0=100*fanslider.val/fanslider.maxval
|
|
covx sys0,va0.txt,0,0
|
|
fan_value.txt=va0.txt+"%"
|
|
if(fanslider.val>fanslider.minval)
|
|
{
|
|
button_off.pco=59164
|
|
button_down.pco=59164
|
|
}else
|
|
{
|
|
button_off.pco=10597
|
|
button_down.pco=10597
|
|
}
|
|
if(fanslider.val<fanslider.maxval)
|
|
{
|
|
button_up.pco=59164
|
|
}else
|
|
{
|
|
button_up.pco=10597
|
|
}
|
|
|
|
Touch Release Event
|
|
timer0.en=1
|
|
|
|
Button button_down
|
|
Attributes
|
|
ID : 12
|
|
Scope : local
|
|
Dragging : 0
|
|
Send Component ID: disabled
|
|
State : unpressed
|
|
Text :
|
|
Max. Text Size : 10
|
|
|
|
Events
|
|
Touch Press Event
|
|
if(fanslider.val>fanslider.minval)
|
|
{
|
|
fanslider.val--
|
|
sys0=100*fanslider.val/fanslider.maxval
|
|
covx sys0,va0.txt,0,0
|
|
fan_value.txt=va0.txt+"%"
|
|
}
|
|
if(fanslider.val>fanslider.minval)
|
|
{
|
|
button_off.pco=59164
|
|
button_down.pco=59164
|
|
}else
|
|
{
|
|
button_off.pco=10597
|
|
button_down.pco=10597
|
|
}
|
|
if(fanslider.val<fanslider.maxval)
|
|
{
|
|
button_up.pco=59164
|
|
}else
|
|
{
|
|
button_up.pco=10597
|
|
}
|
|
|
|
Touch Release Event
|
|
timer0.en=1
|
|
|
|
Button button_off
|
|
Attributes
|
|
ID : 13
|
|
Scope : local
|
|
Dragging : 0
|
|
Send Component ID: disabled
|
|
State : unpressed
|
|
Text :
|
|
Max. Text Size : 10
|
|
|
|
Events
|
|
Touch Press Event
|
|
fanslider.val=fanslider.minval
|
|
sys0=100*fanslider.val/fanslider.maxval
|
|
covx sys0,va0.txt,0,0
|
|
fan_value.txt=va0.txt+"%"
|
|
fansetting.txt="{\"page\": \"fan\", \"key\": \"stop\", \"value\": "+va0.txt+"}"
|
|
printh 92
|
|
prints "localevent",0
|
|
printh 00
|
|
prints fansetting.txt,0
|
|
printh 00
|
|
printh FF FF FF
|
|
if(fanslider.val>fanslider.minval)
|
|
{
|
|
button_off.pco=59164
|
|
button_down.pco=59164
|
|
}else
|
|
{
|
|
button_off.pco=10597
|
|
button_down.pco=10597
|
|
}
|
|
if(fanslider.val<fanslider.maxval)
|
|
{
|
|
button_up.pco=59164
|
|
}else
|
|
{
|
|
button_up.pco=10597
|
|
}
|
|
|
|
Touch Release Event
|
|
timer0.en=0
|
|
|
|
Button button_back
|
|
Attributes
|
|
ID : 15
|
|
Scope : local
|
|
Dragging : 0
|
|
Send Component ID: disabled
|
|
State : unpressed
|
|
Text :
|
|
Max. Text Size : 3
|
|
|
|
Events
|
|
Touch Press Event
|
|
if(back_page.txt=="buttonpage01")
|
|
{
|
|
page buttonpage01
|
|
}else if(back_page.txt=="buttonpage02")
|
|
{
|
|
page buttonpage02
|
|
}else if(back_page.txt=="buttonpage03")
|
|
{
|
|
page buttonpage03
|
|
}else if(back_page.txt=="buttonpage04")
|
|
{
|
|
page buttonpage04
|
|
}else
|
|
{
|
|
page home
|
|
}
|
|
|
|
Timer swipestore
|
|
Attributes
|
|
ID : 5
|
|
Scope : local
|
|
Period (ms): 50
|
|
Enabled : no
|
|
|
|
Events
|
|
Timer Event
|
|
swipex=tch0
|
|
swipey=tch1
|
|
|
|
Timer timer0
|
|
Attributes
|
|
ID : 14
|
|
Scope : local
|
|
Period (ms): 1000
|
|
Enabled : no
|
|
|
|
Events
|
|
Timer Event
|
|
timer0.en=0
|
|
sys0=100*fanslider.val/fanslider.maxval
|
|
covx sys0,va0.txt,0,0
|
|
fan_value.txt=va0.txt+"%"
|
|
fansetting.txt="{\"page\": \"fan\", \"key\": \"percentage\", \"value\": "+va0.txt+"}"
|
|
printh 92
|
|
prints "localevent",0
|
|
printh 00
|
|
prints fansetting.txt,0
|
|
printh 00
|
|
printh FF FF FF
|
|
|
|
Timer wakeup_timer
|
|
Attributes
|
|
ID : 16
|
|
Scope : local
|
|
Period (ms): 100
|
|
Enabled : yes
|
|
|
|
Events
|
|
Timer Event
|
|
if(dim<brightness)
|
|
{
|
|
dimdelta=brightness-dim
|
|
dimdelta/=10
|
|
if(dimdelta<1)
|
|
{
|
|
dimdelta=1
|
|
}
|
|
dim+=dimdelta
|
|
}else
|
|
{
|
|
wakeup_timer.en=0
|
|
}
|
|
|
|
TouchCap swipe
|
|
Attributes
|
|
ID : 4
|
|
Scope: local
|
|
Value: 0
|
|
|
|
Events
|
|
Touch Press Event
|
|
swipestore.en=1 // Start swipestore timer
|
|
|
|
Touch Release Event
|
|
swipestore.en=0
|
|
// Touch has ended, x
|
|
if(tch0==0)
|
|
{
|
|
swipec=swipex-tch2
|
|
// From Left to Right
|
|
if(swipec>swipedx)
|
|
{
|
|
//page
|
|
}
|
|
// Right to Left
|
|
swipec2=0-swipedx
|
|
if(swipec<swipec2)
|
|
{
|
|
//page
|
|
}
|
|
}
|
|
// Touch has ended, y
|
|
if(tch1==0)
|
|
{
|
|
swipec=swipey-tch3
|
|
// From Up to Down
|
|
if(swipec>100)
|
|
{
|
|
//page
|
|
}
|
|
// Down to Up
|
|
swipec2=0-swipedy
|
|
if(swipec<-100)
|
|
{
|
|
//page
|
|
}
|
|
}
|
|
|