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

@@ -12,13 +12,12 @@ Page climate
Events
Preinitialize Event
if(api==1||entity.txt=="embedded_climate")
if(api==1||embedded.val==1)
{
climatesetting.txt="{\"page\": \"climate\", \"component\": \"currentpage\", \"value\": \"pagechange\", \"entity\": \""+entity.txt+"\"}"
printh 92
prints "nspanelevent",0
printh 00
prints climatesetting.txt,0
prints "{\"page\": \"climate\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0
printh 00
printh FF FF FF
vis target_icon,0
@@ -57,7 +56,7 @@ Page climate
{
timer01.en=0
covx temp_number.val,va1.txt,0,0
climatesetting.txt="{\"page\": \"climate\", \"component\": \"climate_position\", \"value\": "+va1.txt+", \"entity\": \""+entity.txt+"\"}"
climatesetting.txt="{\"page\": \"climate\", \"component\": \"climate_position\", \"value\": "+va1.txt+"}"
printh 92
prints "nspanelevent",0
printh 00
@@ -131,16 +130,9 @@ Variable (string) va2
Text :
Max. Text Size: 10
Variable (string) entity
Attributes
ID : 49
Scope : global
Text :
Max. Text Size: 100
Variable (string) click_comp
Attributes
ID : 50
ID : 49
Scope : local
Text :
Max. Text Size: 8
@@ -485,7 +477,7 @@ Hotspot button01
Events
Touch Release Event
covx embedded.val,va2.txt,0,0
lastclick.txt="{\"page\": \"climate\", \"key\": \"hvac_mode\", \"value\": \"auto\", \"entity\": \""+entity.txt+"\", \"embedded\": "+va2.txt+"}"
lastclick.txt="{\"page\": \"climate\", \"key\": \"hvac_mode\", \"value\": \"auto\", \"embedded\": "+va2.txt+"}"
printh 92
prints "localevent",0
printh 00
@@ -503,7 +495,7 @@ Hotspot button02
Events
Touch Release Event
covx embedded.val,va2.txt,0,0
lastclick.txt="{\"page\": \"climate\", \"key\": \"hvac_mode\", \"value\": \"heat_cool\", \"entity\": \""+entity.txt+"\", \"embedded\": "+va2.txt+"}"
lastclick.txt="{\"page\": \"climate\", \"key\": \"hvac_mode\", \"value\": \"heat_cool\", \"embedded\": "+va2.txt+"}"
printh 92
prints "localevent",0
printh 00
@@ -521,7 +513,7 @@ Hotspot button03
Events
Touch Release Event
covx embedded.val,va2.txt,0,0
lastclick.txt="{\"page\": \"climate\", \"key\": \"hvac_mode\", \"value\": \"heat\", \"entity\": \""+entity.txt+"\", \"embedded\": "+va2.txt+"}"
lastclick.txt="{\"page\": \"climate\", \"key\": \"hvac_mode\", \"value\": \"heat\", \"embedded\": "+va2.txt+"}"
printh 92
prints "localevent",0
printh 00
@@ -539,7 +531,7 @@ Hotspot button04
Events
Touch Release Event
covx embedded.val,va2.txt,0,0
lastclick.txt="{\"page\": \"climate\", \"key\": \"hvac_mode\", \"value\": \"cool\", \"entity\": \""+entity.txt+"\", \"embedded\": "+va2.txt+"}"
lastclick.txt="{\"page\": \"climate\", \"key\": \"hvac_mode\", \"value\": \"cool\", \"embedded\": "+va2.txt+"}"
printh 92
prints "localevent",0
printh 00
@@ -557,7 +549,7 @@ Hotspot button05
Events
Touch Release Event
covx embedded.val,va2.txt,0,0
lastclick.txt="{\"page\": \"climate\", \"key\": \"hvac_mode\", \"value\": \"dry\", \"entity\": \""+entity.txt+"\", \"embedded\": "+va2.txt+"}"
lastclick.txt="{\"page\": \"climate\", \"key\": \"hvac_mode\", \"value\": \"dry\", \"embedded\": "+va2.txt+"}"
printh 92
prints "localevent",0
printh 00
@@ -575,7 +567,7 @@ Hotspot button06
Events
Touch Release Event
covx embedded.val,va2.txt,0,0
lastclick.txt="{\"page\": \"climate\", \"key\": \"hvac_mode\", \"value\": \"fan_only\", \"entity\": \""+entity.txt+"\", \"embedded\": "+va2.txt+"}"
lastclick.txt="{\"page\": \"climate\", \"key\": \"hvac_mode\", \"value\": \"fan_only\", \"embedded\": "+va2.txt+"}"
printh 92
prints "localevent",0
printh 00
@@ -593,7 +585,7 @@ Hotspot button07
Events
Touch Release Event
covx embedded.val,va2.txt,0,0
lastclick.txt="{\"page\": \"climate\", \"key\": \"hvac_mode\", \"value\": \"off\", \"entity\": \""+entity.txt+"\", \"embedded\": "+va2.txt+"}"
lastclick.txt="{\"page\": \"climate\", \"key\": \"hvac_mode\", \"value\": \"off\", \"embedded\": "+va2.txt+"}"
printh 92
prints "localevent",0
printh 00
@@ -675,7 +667,7 @@ Timer timer01
timer01.en=0
covx embedded.val,va2.txt,0,0
covx temp_number.val,va1.txt,0,0
climatesetting.txt="{\"page\": \"climate\", \"key\": \"set_temperature\", \"value\": "+va1.txt+", \"entity\": \""+entity.txt+"\", \"embedded\": "+va2.txt+"}"
climatesetting.txt="{\"page\": \"climate\", \"key\": \"set_temperature\", \"value\": "+va1.txt+", \"embedded\": "+va2.txt+"}"
printh 92
prints "localevent",0
printh 00
@@ -685,7 +677,7 @@ Timer timer01
Timer click_timer
Attributes
ID : 51
ID : 50
Scope : local
Period (ms): 800
Enabled : no
@@ -703,7 +695,7 @@ Timer click_timer
Timer wakeup_timer
Attributes
ID : 52
ID : 51
Scope : local
Period (ms): 100
Enabled : yes