Files
NSPanel_HA_Blueprint/nspanel_eu_code/media_player.txt
Edward Firmo d1638863a4 Remove entity info from pages on TFT
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
2023-09-13 23:36:24 +02:00

489 lines
13 KiB
Plaintext

Page media_player
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\": \"media_player\", \"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) back_page
Attributes
ID : 3
Scope : local
Text : home
Max. Text Size: 15
Variable (string) lastclick
Attributes
ID : 20
Scope : local
Text :
Max. Text Size: 255
Variable (string) va0
Attributes
ID : 23
Scope : local
Text :
Max. Text Size: 10
Variable (int32) is_muted
Attributes
ID : 24
Scope: local
Value: 0
Variable (int32) prg_current
Attributes
ID : 26
Scope: local
Value: 0
Variable (int32) prg_total
Attributes
ID : 27
Scope: local
Value: 0
Text page_label
Attributes
ID : 1
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text : Media Player
Max. Text Size : 25
Text icon_state
Attributes
ID : 2
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text : 
Max. Text Size : 10
Text vol_text
Attributes
ID : 6
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 5
Text bt_vol_down
Attributes
ID : 7
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 3
Events
Touch Release Event
if(vol_slider.val>0)
{
vol_slider.val--
covx vol_slider.val,va0.txt,0,0
vol_text.txt=va0.txt+"%"
timer0.en=1
}
printh 92
prints "localevent",0
printh 00
prints lastclick.txt,0
printh 00
printh FF FF FF
Text bt_vol_up
Attributes
ID : 8
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 3
Events
Touch Release Event
if(vol_slider.val<100)
{
vol_slider.val++
covx vol_slider.val,va0.txt,0,0
vol_text.txt=va0.txt+"%"
timer0.en=1
}
printh 92
prints "localevent",0
printh 00
prints lastclick.txt,0
printh 00
printh FF FF FF
Text bt_mute
Attributes
ID : 9
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 3
Events
Touch Release Event
if(is_muted.val==1)
{
va0.txt="true"
}else
{
va0.txt="false"
}
lastclick.txt="{\"page\": \"media_player\", \"key\": \"volume_mute\", \"value\": \""+va0.txt+"\"}"
printh 92
prints "localevent",0
printh 00
prints lastclick.txt,0
printh 00
printh FF FF FF
Text time_current
Attributes
ID : 11
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Text time_total
Attributes
ID : 12
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Text track
Attributes
ID : 13
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 50
Text artist
Attributes
ID : 14
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 50
Text bt_prev
Attributes
ID : 15
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Events
Touch Release Event
lastclick.txt="{\"page\": \"media_player\", \"key\": \"media_previous_track\"}"
printh 92
prints "localevent",0
printh 00
prints "{\"page\": \"media_player\", \"key\": \"media_previous_track\"}",0
printh 00
printh FF FF FF
Text bt_play_pause
Attributes
ID : 16
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Events
Touch Release Event
printh 92
prints "localevent",0
printh 00
prints "{\"page\": \"media_player\", \"key\": \"media_play_pause\"}",0
printh 00
printh FF FF FF
Text bt_stop
Attributes
ID : 17
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Events
Touch Release Event
printh 92
prints "localevent",0
printh 00
prints "{\"page\": \"media_player\", \"key\": \"media_stop\"}",0
printh 00
printh FF FF FF
Text bt_next
Attributes
ID : 18
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Events
Touch Release Event
printh 92
prints "localevent",0
printh 00
prints "{\"page\": \"media_player\", \"key\": \"media_next_track\"}",0
printh 00
printh FF FF FF
Text bt_on_off
Attributes
ID : 19
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 10
Events
Touch Release Event
printh 92
prints "localevent",0
printh 00
prints "{\"page\": \"media_player\", \"key\": \"toggle\"}",0
printh 00
printh FF FF FF
Progress Bar time_progress
Attributes
ID : 10
Scope : local
Dragging : 0
Send Component ID: disabled
Value : 0
Slider vol_slider
Attributes
ID : 5
Scope : local
Dragging : 0
Send Component ID: disabled
Position : 0
Upper range limit: 100
Lower range limit: 0
Events
Touch Release Event
covx vol_slider.val,va0.txt,0,0
vol_text.txt=va0.txt+"%"
timer0.en=1
printh 91
prints "touchevent",0
printh 00
prints rand,0
printh FF FF FF
Button button_back
Attributes
ID : 4
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 wakeup_timer
Attributes
ID : 21
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
}
Timer timer0
Attributes
ID : 22
Scope : local
Period (ms): 1000
Enabled : no
Events
Timer Event
timer0.en=0
covx vol_slider.val,va0.txt,0,0
vol_text.txt=va0.txt+"%"
lastclick.txt="{\"page\": \"media_player\", \"key\": \"volume_set\", \"value\": "+va0.txt+"}"
printh 92
prints "localevent",0
printh 00
prints lastclick.txt,0
printh 00
printh FF FF FF
Timer prg_timer
Attributes
ID : 25
Scope : local
Period (ms): 1000
Enabled : no
Events
Timer Event
if(prg_current.val<prg_total.val&&prg_total.val>0)
{
prg_current.val++
time_progress.val=100*prg_current.val/prg_total.val
covx prg_current.val,time_current.txt,0,0
}
// Progress - Total
sys0=prg_total.val/3600 //hours
sys2=prg_total.val%3600 //remainder
sys1=sys2/60 //minutes
sys2%=60 //seconds
time_total.txt=""
if(sys0>0)
{
covx sys0,time_total.txt,0,0
time_total.txt+=":"
if(sys1<10)
{
time_total.txt+="0"
}
}
covx sys1,va0.txt,0,0
time_total.txt+=va0.txt+":"
if(sys2<10)
{
time_total.txt+="0"
}
covx sys2,va0.txt,0,0
time_total.txt+=va0.txt
// Progress - Current
sys0=prg_current.val/3600 //hours
sys2=prg_current.val%3600 //remainder
sys1=sys2/60 //minutes
sys2%=60 //seconds
time_current.txt=""
if(sys0>0)
{
covx sys0,time_current.txt,0,0
time_current.txt+=":"
if(sys1<10)
{
time_current.txt+="0"
}
}
covx sys1,va0.txt,0,0
time_current.txt+=va0.txt+":"
if(sys2<10)
{
time_current.txt+="0"
}
covx sys2,va0.txt,0,0
time_current.txt+=va0.txt