Panel offline mode (#900)

* Panel offline mode

Introduces "offline mode" for the panel, which will be used later with a fallback climate.

Pages that are depending on the blueprint (buttons pages, entity pages, settings pages, etc) won't be shown when the API is disconnected.

* Panel offline mode

* Panel offline mode

* Panel offline mode

* Panel offline mode
This commit is contained in:
Edward Firmo
2023-06-30 12:24:25 +02:00
committed by GitHub
parent ec48fbd335
commit 3aca4c64d2
24 changed files with 379 additions and 102 deletions

View File

@@ -609,12 +609,15 @@ binary_sensor:
condition: condition:
api.connected: api.connected:
then: then:
- lambda: id(disp1).set_component_value("home.api",1);
- lambda: id(disp1).set_component_text_printf("home.wifi_icon", "%s", "\U0000E5A8"); - lambda: id(disp1).set_component_text_printf("home.wifi_icon", "%s", "\U0000E5A8");
- lambda: id(disp1).set_component_font_color("home.wifi_icon", 33808); - lambda: id(disp1).set_component_font_color("home.wifi_icon", 33808);
else: else:
- lambda: id(disp1).set_component_value("home.api",0);
- lambda: id(disp1).set_component_text_printf("home.wifi_icon", "%s", "\U0000F256"); - lambda: id(disp1).set_component_text_printf("home.wifi_icon", "%s", "\U0000F256");
- lambda: id(disp1).set_component_font_color("home.wifi_icon", 63488); - lambda: id(disp1).set_component_font_color("home.wifi_icon", 63488);
else: else:
- lambda: id(disp1).set_component_value("home.api",0);
- lambda: id(disp1).set_component_text_printf("home.wifi_icon", "%s", "\U0000E5A9"); - lambda: id(disp1).set_component_text_printf("home.wifi_icon", "%s", "\U0000E5A9");
- lambda: id(disp1).set_component_font_color("home.wifi_icon", 63488); - lambda: id(disp1).set_component_font_color("home.wifi_icon", 63488);

Binary file not shown.

Binary file not shown.

View File

@@ -13,12 +13,18 @@ Page notification
Events Events
Preinitialize Event Preinitialize Event
dim=home.brightness.val dim=home.brightness.val
printh 92 if(home.api.val==0)
prints "nspanelevent",0 {
printh 00 page home
prints "{\"page\": \"notification\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0 }else
printh 00 {
printh FF FF FF printh 92
prints "nspanelevent",0
printh 00
prints "{\"page\": \"notification\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0
printh 00
printh FF FF FF
}
Touch Press Event Touch Press Event
printh 92 printh 92

View File

@@ -13,12 +13,18 @@ Page qrcode
Events Events
Preinitialize Event Preinitialize Event
dim=home.brightness.val dim=home.brightness.val
printh 92 if(home.api.val==0)
prints "nspanelevent",0 {
printh 00 page home
prints "{\"page\": \"qrcode\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0 }else
printh 00 {
printh FF FF FF printh 92
prints "nspanelevent",0
printh 00
prints "{\"page\": \"qrcode\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0
printh 00
printh FF FF FF
}
Touch Press Event Touch Press Event
printh 92 printh 92

View File

@@ -21,7 +21,7 @@ Page screensaver
printh FF FF FF printh FF FF FF
Touch Release Event Touch Release Event
page home page orign.val
Variable (int32) orign Variable (int32) orign
Attributes Attributes

Binary file not shown.

Binary file not shown.

View File

@@ -13,14 +13,20 @@ Page cover
Events Events
Preinitialize Event Preinitialize Event
dim=home.brightness.val dim=home.brightness.val
coversetting.txt="{\"page\": \"cover\", \"component\": \"currentpage\", \"value\": \"pagechange\", \"entity\": \""+home.entity.txt+"\"}" if(home.api.val==0)
printh 92 {
prints "nspanelevent",0 page home
printh 00 }else
prints coversetting.txt,0 {
printh 00 coversetting.txt="{\"page\": \"cover\", \"component\": \"currentpage\", \"value\": \"pagechange\", \"entity\": \""+home.entity.txt+"\"}"
printh FF FF FF printh 92
page_label.txt=home.entity.txt prints "nspanelevent",0
printh 00
prints coversetting.txt,0
printh 00
printh FF FF FF
page_label.txt=home.entity.txt
}
Touch Press Event Touch Press Event
coversetting.txt="{\"page\": \"cover\", \"component\": \"touchevent\", \"value\": \"press\", \"entity\": \""+home.entity.txt+"\"}" coversetting.txt="{\"page\": \"cover\", \"component\": \"touchevent\", \"value\": \"press\", \"entity\": \""+home.entity.txt+"\"}"

View File

@@ -12,12 +12,19 @@ Page entitypage01
Events Events
Preinitialize Event Preinitialize Event
printh 92 dim=home.brightness.val
prints "nspanelevent",0 if(home.api.val==0)
printh 00 {
prints "{\"page\": \"entitypage01\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0 page home
printh 00 }else
printh FF FF FF {
printh 92
prints "nspanelevent",0
printh 00
prints "{\"page\": \"entitypage01\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0
printh 00
printh FF FF FF
}
Touch Press Event Touch Press Event
printh 92 printh 92

View File

@@ -13,32 +13,38 @@ Page light
Events Events
Preinitialize Event Preinitialize Event
dim=home.brightness.val dim=home.brightness.val
lightsetting.txt="{\"page\": \"light\", \"component\": \"currentpage\", \"value\": \"pagechange\", \"entity\": \""+home.entity.txt+"\"}" if(home.api.val==0)
printh 92 {
prints "nspanelevent",0 page home
printh 00 }else
prints lightsetting.txt,0 {
printh 00 lightsetting.txt="{\"page\": \"light\", \"component\": \"currentpage\", \"value\": \"pagechange\", \"entity\": \""+home.entity.txt+"\"}"
printh FF FF FF printh 92
vis light_b_press,1 prints "nspanelevent",0
vis lightslider,1 printh 00
vis light_value,1 prints lightsetting.txt,0
// #### OFF Button ##### printh 00
vis temp_b_press,0 printh FF FF FF
vis color_b_pres,0 vis light_b_press,1
// #### OFF Value ##### vis lightslider,1
vis temp_value,0 vis light_value,1
vis light_value_2,0 // #### OFF Button #####
// #### OFF Slider ##### vis temp_b_press,0
vis tempslider,0 vis color_b_pres,0
vis colorwheel,0 // #### OFF Value #####
// #### Hide color & temp buttons ##### vis temp_value,0
vis temp_touch,0 vis light_value_2,0
vis temp_value_2,0 // #### OFF Slider #####
vis temp_button,0 vis tempslider,0
vis color_touch,0 vis colorwheel,0
vis color_button,0 // #### Hide color & temp buttons #####
page_label.txt=home.entity.txt vis temp_touch,0
vis temp_value_2,0
vis temp_button,0
vis color_touch,0
vis color_button,0
page_label.txt=home.entity.txt
}
Touch Press Event Touch Press Event
lightsetting.txt="{\"page\": \"light\", \"component\": \"touchevent\", \"value\": \"press\", \"entity\": \""+home.entity.txt+"\"}" lightsetting.txt="{\"page\": \"light\", \"component\": \"touchevent\", \"value\": \"press\", \"entity\": \""+home.entity.txt+"\"}"

View File

@@ -13,12 +13,18 @@ Page notification
Events Events
Preinitialize Event Preinitialize Event
dim=home.brightness.val dim=home.brightness.val
printh 92 if(home.api.val==0)
prints "nspanelevent",0 {
printh 00 page home
prints "{\"page\": \"notification\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0 }else
printh 00 {
printh FF FF FF printh 92
prints "nspanelevent",0
printh 00
prints "{\"page\": \"notification\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0
printh 00
printh FF FF FF
}
Touch Press Event Touch Press Event
printh 92 printh 92

View File

@@ -13,12 +13,18 @@ Page qrcode
Events Events
Preinitialize Event Preinitialize Event
dim=home.brightness.val dim=home.brightness.val
printh 92 if(home.api.val==0)
prints "nspanelevent",0 {
printh 00 page home
prints "{\"page\": \"qrcode\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0 }else
printh 00 {
printh FF FF FF printh 92
prints "nspanelevent",0
printh 00
prints "{\"page\": \"qrcode\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0
printh 00
printh FF FF FF
}
Touch Press Event Touch Press Event
printh 92 printh 92

View File

@@ -20,6 +20,9 @@ Page screensaver
printh 00 printh 00
printh FF FF FF printh FF FF FF
Touch Release Event
page orign.val
Variable (int32) orign Variable (int32) orign
Attributes Attributes
ID : 2 ID : 2

View File

@@ -12,12 +12,19 @@ Page weather01
Events Events
Preinitialize Event Preinitialize Event
printh 92 dim=home.brightness.val
prints "nspanelevent",0 if(home.api.val==0)
printh 00 {
prints "{\"page\": \"weather01\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0 page home
printh 00 }else
printh FF FF FF {
printh 92
prints "nspanelevent",0
printh 00
prints "{\"page\": \"weather01\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0
printh 00
printh FF FF FF
}
Touch Press Event Touch Press Event
printh 92 printh 92

View File

@@ -12,12 +12,19 @@ Page weather02
Events Events
Preinitialize Event Preinitialize Event
printh 92 dim=home.brightness.val
prints "nspanelevent",0 if(home.api.val==0)
printh 00 {
prints "{\"page\": \"weather02\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0 page home
printh 00 }else
printh FF FF FF {
printh 92
prints "nspanelevent",0
printh 00
prints "{\"page\": \"weather02\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0
printh 00
printh FF FF FF
}
Touch Press Event Touch Press Event
printh 92 printh 92

View File

@@ -12,12 +12,19 @@ Page weather03
Events Events
Preinitialize Event Preinitialize Event
printh 92 dim=home.brightness.val
prints "nspanelevent",0 if(home.api.val==0)
printh 00 {
prints "{\"page\": \"weather03\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0 page home
printh 00 }else
printh FF FF FF {
printh 92
prints "nspanelevent",0
printh 00
prints "{\"page\": \"weather03\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0
printh 00
printh FF FF FF
}
Touch Press Event Touch Press Event
printh 92 printh 92

View File

@@ -12,12 +12,19 @@ Page weather04
Events Events
Preinitialize Event Preinitialize Event
printh 92 dim=home.brightness.val
prints "nspanelevent",0 if(home.api.val==0)
printh 00 {
prints "{\"page\": \"weather04\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0 page home
printh 00 }else
printh FF FF FF {
printh 92
prints "nspanelevent",0
printh 00
prints "{\"page\": \"weather04\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0
printh 00
printh FF FF FF
}
Touch Press Event Touch Press Event
printh 92 printh 92

View File

@@ -12,12 +12,19 @@ Page weather05
Events Events
Preinitialize Event Preinitialize Event
printh 92 dim=home.brightness.val
prints "nspanelevent",0 if(home.api.val==0)
printh 00 {
prints "{\"page\": \"weather05\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0 page home
printh 00 }else
printh FF FF FF {
printh 92
prints "nspanelevent",0
printh 00
prints "{\"page\": \"weather05\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0
printh 00
printh FF FF FF
}
Touch Press Event Touch Press Event
printh 92 printh 92

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,187 @@
Page notification
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=home.brightness.val
if(home.api.val==0)
{
page home
}else
{
printh 92
prints "nspanelevent",0
printh 00
prints "{\"page\": \"notification\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0
printh 00
printh FF FF FF
}
Touch Press Event
printh 92
prints "touchevent",0
printh 00
prints "{\"page\": \"notification\", \"component\": \"touchevent\", \"value\": \"press\"}",0
printh 00
printh FF FF FF
Touch Release Event
printh 92
prints "touchevent",0
printh 00
prints "{\"page\": \"notification\", \"component\": \"touchevent\", \"value\": \"release\"}",0
printh 00
printh FF FF FF
Variable (string) lastclick
Attributes
ID : 10
Scope : local
Text :
Max. Text Size: 100
Text notifi_text01
Attributes
ID : 2
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 100
Text notifi_label
Attributes
ID : 3
Scope : local
Dragging : 0
Send Component ID : disabled
Associated Keyboard: none
Text :
Max. Text Size : 30
Picture accept_pic
Attributes
ID : 4
Scope : local
Dragging : 0
Send Component ID: disabled
Picture clear_pic
Attributes
ID : 5
Scope : local
Dragging : 0
Send Component ID: disabled
Hotspot notifi_back
Attributes
ID : 1
Scope : local
Dragging : 0
Send Component ID: disabled
Events
Touch Press Event
page home
Hotspot accept
Attributes
ID : 6
Scope : local
Dragging : 0
Send Component ID: disabled
Events
Touch Release Event
lastclick.txt="{\"page\": \"notification\", \"component\": \"accept\", \"value\": \"release\"}"
printh 92
prints "nspanelevent",0
printh 00
prints lastclick.txt,0
printh 00
printh FF FF FF
Hotspot clear
Attributes
ID : 7
Scope : local
Dragging : 0
Send Component ID: disabled
Events
Touch Release Event
lastclick.txt="{\"page\": \"notification\", \"component\": \"clear\", \"value\": \"release\"}"
printh 92
prints "nspanelevent",0
printh 00
prints lastclick.txt,0
printh 00
printh FF FF FF
Timer swipestore
Attributes
ID : 9
Scope : local
Period (ms): 50
Enabled : no
Events
Timer Event
swipex=tch0
swipey=tch1
TouchCap swipe
Attributes
ID : 8
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
}
}

View File

@@ -13,12 +13,18 @@ Page qrcode
Events Events
Preinitialize Event Preinitialize Event
dim=home.brightness.val dim=home.brightness.val
printh 92 if(home.api.val==0)
prints "nspanelevent",0 {
printh 00 page home
prints "{\"page\": \"qrcode\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0 }else
printh 00 {
printh FF FF FF printh 92
prints "nspanelevent",0
printh 00
prints "{\"page\": \"qrcode\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0
printh 00
printh FF FF FF
}
Touch Press Event Touch Press Event
printh 92 printh 92

View File

@@ -21,7 +21,7 @@ Page screensaver
printh FF FF FF printh FF FF FF
Touch Release Event Touch Release Event
page home page orign.val
Variable (int32) orign Variable (int32) orign
Attributes Attributes