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
This commit is contained in:
Edward Firmo
2023-09-13 23:36:24 +02:00
parent a836462df1
commit d1638863a4
31 changed files with 315 additions and 482 deletions

View File

@@ -17,11 +17,10 @@ Page media_player
page home
}else
{
lastclick.txt="{\"page\": \"media_player\", \"component\": \"currentpage\", \"value\": \"pagechange\", \"entity\": \""+entity.txt+"\"}"
printh 92
prints "nspanelevent",0
printh 00
prints lastclick.txt,0
prints "{\"page\": \"media_player\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0
printh 00
printh FF FF FF
}
@@ -47,42 +46,35 @@ Variable (string) back_page
Text : home
Max. Text Size: 15
Variable (string) entity
Attributes
ID : 4
Scope : global
Text :
Max. Text Size: 100
Variable (string) lastclick
Attributes
ID : 21
ID : 20
Scope : local
Text :
Max. Text Size: 255
Variable (string) va0
Attributes
ID : 24
ID : 23
Scope : local
Text :
Max. Text Size: 10
Variable (int32) is_muted
Attributes
ID : 25
ID : 24
Scope: local
Value: 0
Variable (int32) prg_current
Attributes
ID : 27
ID : 26
Scope: local
Value: 0
Variable (int32) prg_total
Attributes
ID : 28
ID : 27
Scope: local
Value: 0
@@ -108,7 +100,7 @@ Text icon_state
Text vol_text
Attributes
ID : 7
ID : 6
Scope : local
Dragging : 0
Send Component ID : disabled
@@ -118,7 +110,7 @@ Text vol_text
Text bt_vol_down
Attributes
ID : 8
ID : 7
Scope : local
Dragging : 0
Send Component ID : disabled
@@ -144,7 +136,7 @@ Text bt_vol_down
Text bt_vol_up
Attributes
ID : 9
ID : 8
Scope : local
Dragging : 0
Send Component ID : disabled
@@ -170,7 +162,7 @@ Text bt_vol_up
Text bt_mute
Attributes
ID : 10
ID : 9
Scope : local
Dragging : 0
Send Component ID : disabled
@@ -187,7 +179,7 @@ Text bt_mute
{
va0.txt="false"
}
lastclick.txt="{\"page\": \"media_player\", \"key\": \"volume_mute\", \"value\": \""+va0.txt+"\", \"entity\": \""+entity.txt+"\"}"
lastclick.txt="{\"page\": \"media_player\", \"key\": \"volume_mute\", \"value\": \""+va0.txt+"\"}"
printh 92
prints "localevent",0
printh 00
@@ -197,7 +189,7 @@ Text bt_mute
Text time_current
Attributes
ID : 12
ID : 11
Scope : local
Dragging : 0
Send Component ID : disabled
@@ -207,7 +199,7 @@ Text time_current
Text time_total
Attributes
ID : 13
ID : 12
Scope : local
Dragging : 0
Send Component ID : disabled
@@ -217,7 +209,7 @@ Text time_total
Text track
Attributes
ID : 14
ID : 13
Scope : local
Dragging : 0
Send Component ID : disabled
@@ -227,7 +219,7 @@ Text track
Text artist
Attributes
ID : 15
ID : 14
Scope : local
Dragging : 0
Send Component ID : disabled
@@ -236,6 +228,26 @@ Text artist
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
@@ -247,15 +259,14 @@ Text bt_prev
Events
Touch Release Event
lastclick.txt="{\"page\": \"media_player\", \"key\": \"media_previous_track\", \"value\": \"\", \"entity\": \""+entity.txt+"\"}"
printh 92
prints "localevent",0
printh 00
prints lastclick.txt,0
prints "{\"page\": \"media_player\", \"key\": \"media_play_pause\"}",0
printh 00
printh FF FF FF
Text bt_play_pause
Text bt_stop
Attributes
ID : 17
Scope : local
@@ -267,15 +278,14 @@ Text bt_play_pause
Events
Touch Release Event
lastclick.txt="{\"page\": \"media_player\", \"key\": \"media_play_pause\", \"value\": \"\", \"entity\": \""+entity.txt+"\"}"
printh 92
prints "localevent",0
printh 00
prints lastclick.txt,0
prints "{\"page\": \"media_player\", \"key\": \"media_stop\"}",0
printh 00
printh FF FF FF
Text bt_stop
Text bt_next
Attributes
ID : 18
Scope : local
@@ -287,15 +297,14 @@ Text bt_stop
Events
Touch Release Event
lastclick.txt="{\"page\": \"media_player\", \"key\": \"media_stop\", \"value\": \"\", \"entity\": \""+entity.txt+"\"}"
printh 92
prints "localevent",0
printh 00
prints lastclick.txt,0
prints "{\"page\": \"media_player\", \"key\": \"media_next_track\"}",0
printh 00
printh FF FF FF
Text bt_next
Text bt_on_off
Attributes
ID : 19
Scope : local
@@ -307,37 +316,16 @@ Text bt_next
Events
Touch Release Event
lastclick.txt="{\"page\": \"media_player\", \"key\": \"media_next_track\", \"value\": \"\", \"entity\": \""+entity.txt+"\"}"
printh 92
prints "localevent",0
printh 00
prints lastclick.txt,0
printh 00
printh FF FF FF
Text bt_on_off
Attributes
ID : 20
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\": \"toggle\", \"value\": \"\", \"entity\": \""+entity.txt+"\"}"
printh 92
prints "localevent",0
printh 00
prints lastclick.txt,0
prints "{\"page\": \"media_player\", \"key\": \"toggle\"}",0
printh 00
printh FF FF FF
Progress Bar time_progress
Attributes
ID : 11
ID : 10
Scope : local
Dragging : 0
Send Component ID: disabled
@@ -345,7 +333,7 @@ Progress Bar time_progress
Slider vol_slider
Attributes
ID : 6
ID : 5
Scope : local
Dragging : 0
Send Component ID: disabled
@@ -366,7 +354,7 @@ Slider vol_slider
Button button_back
Attributes
ID : 5
ID : 4
Scope : local
Dragging : 0
Send Component ID: disabled
@@ -395,7 +383,7 @@ Button button_back
Timer wakeup_timer
Attributes
ID : 22
ID : 21
Scope : local
Period (ms): 100
Enabled : yes
@@ -418,7 +406,7 @@ Timer wakeup_timer
Timer timer0
Attributes
ID : 23
ID : 22
Scope : local
Period (ms): 1000
Enabled : no
@@ -428,7 +416,7 @@ Timer timer0
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+", \"entity\": \""+entity.txt+"\"}"
lastclick.txt="{\"page\": \"media_player\", \"key\": \"volume_set\", \"value\": "+va0.txt+"}"
printh 92
prints "localevent",0
printh 00
@@ -438,7 +426,7 @@ Timer timer0
Timer prg_timer
Attributes
ID : 26
ID : 25
Scope : local
Period (ms): 1000
Enabled : no