Home buttons new format - Alarm

Modernise the button Alarm flow on page Home to improve performance.
This commit is contained in:
Edward Firmo
2023-08-23 10:54:56 +02:00
parent c389c5b20b
commit f399d757e5
13 changed files with 54 additions and 85 deletions

View File

@@ -504,7 +504,8 @@ api:
## Alarm button ## Alarm button
- lambda: |- - lambda: |-
if (${verbose_log}) ESP_LOGD("service.global_settings", "Alarm button - Start"); if (${verbose_log}) ESP_LOGD("service.global_settings", "Alarm button - Start");
id(home_alarm_state) = alarm_state; id(disp1).send_command_printf("is_alarm=%i", (alarm_state=="" or alarm_state.empty()) ? 0 : 1);
id(update_alarm_icon)->execute("home.bt_alarm", alarm_state.c_str());
## Wakeup page ## Wakeup page
- lambda: |- - lambda: |-
@@ -549,8 +550,8 @@ api:
// set alarm icon on home page // set alarm icon on home page
if (${verbose_log}) ESP_LOGD("service.alarm_settings", "Updating home page icon"); if (${verbose_log}) ESP_LOGD("service.alarm_settings", "Updating home page icon");
id(home_alarm_state) = state; id(disp1).send_command_printf("is_alarm=%i", (state=="" or state.empty()) ? 0 : 1);
id(update_alarm_icon)->execute("home.button07_icon", state.c_str()); id(update_alarm_icon)->execute("home.bt_alarm", state.c_str());
## Update alarm page ## Update alarm page
- if: - if:
@@ -709,12 +710,6 @@ globals:
restore_value: true restore_value: true
initial_value: '0' initial_value: '0'
##### Alarm state #####
- id: home_alarm_state
type: std::string
restore_value: false
initial_value: ''
##### Entities pages button ##### ##### Entities pages button #####
- id: home_entities_pages - id: home_entities_pages
type: bool type: bool
@@ -1578,19 +1573,6 @@ script:
id(disp1).hide_component("button06_icon"); id(disp1).hide_component("button06_icon");
} }
// Show alarm button
if (${verbose_log}) ESP_LOGD("script.update_page_home", "Show alarm button");
if (id(home_alarm_state) != "" and not id(home_alarm_state).empty())
{
id(update_alarm_icon)->execute("button07_icon", id(home_alarm_state));
id(disp1).show_component("button07");
id(disp1).show_component("button07_icon");
}
else
{
id(disp1).hide_component("button07");
id(disp1).hide_component("button07_icon");
}
- script.execute: - script.execute:
id: addon_climate_update_page_home id: addon_climate_update_page_home
- lambda: if (${verbose_log}) ESP_LOGD("script.update_page_home", "Finished"); - lambda: if (${verbose_log}) ESP_LOGD("script.update_page_home", "Finished");

Binary file not shown.

Binary file not shown.

View File

@@ -5,6 +5,7 @@ Program.s
int h=0,s=0,v=0 int h=0,s=0,v=0
int p=0,q=0,t=0,f=0 int p=0,q=0,t=0,f=0
int api=0 // 0 = disconnected from HA, 1 = connected to HA int api=0 // 0 = disconnected from HA, 1 = connected to HA
int is_alarm=0
bauds=115200//Configure baudrat bauds=115200//Configure baudrat
recmod=0//Serial data parsing mode:0-Passive mode;1-Active mode recmod=0//Serial data parsing mode:0-Passive mode;1-Active mode
printh 00 00 00 ff ff ff 88 ff ff ff//Output power on information to serial port printh 00 00 00 ff ff ff 88 ff ff ff//Output power on information to serial port

View File

@@ -23,6 +23,7 @@ Page home
printh FF FF FF printh FF FF FF
vis button06_icon,0 vis button06_icon,0
vis button06,0 vis button06,0
vis bt_alarm,is_alarm
Variable (int32) brightness Variable (int32) brightness
Attributes Attributes
@@ -50,14 +51,14 @@ Variable (int32) sleepmodus
Variable (string) lastclick Variable (string) lastclick
Attributes Attributes
ID : 54 ID : 53
Scope : local Scope : local
Text : Text :
Max. Text Size: 100 Max. Text Size: 100
Variable (string) entity Variable (string) entity
Attributes Attributes
ID : 55 ID : 54
Scope : global Scope : global
Text : Text :
Max. Text Size: 100 Max. Text Size: 100
@@ -362,7 +363,7 @@ Text button06_icon
Text : Text :
Max. Text Size : 10 Max. Text Size : 10
Text button07_icon Text bt_alarm
Attributes Attributes
ID : 44 ID : 44
Scope : global Scope : global
@@ -372,9 +373,17 @@ Text button07_icon
Text : Text :
Max. Text Size : 10 Max. Text Size : 10
Events
Touch Release Event
if(api==1)
{
entity.txt=""
page alarm
}
Text meridiem Text meridiem
Attributes Attributes
ID : 53 ID : 52
Scope : global Scope : global
Dragging : 0 Dragging : 0
Send Component ID : disabled Send Component ID : disabled
@@ -554,24 +563,9 @@ Hotspot button06
page entitypage01 page entitypage01
} }
Hotspot button07
Attributes
ID : 51
Scope : local
Dragging : 0
Send Component ID: disabled
Events
Touch Release Event
if(api==1)
{
entity.txt=""
page alarm
}
Hotspot settings_click Hotspot settings_click
Attributes Attributes
ID : 52 ID : 51
Scope : local Scope : local
Dragging : 0 Dragging : 0
Send Component ID: disabled Send Component ID: disabled
@@ -627,7 +621,7 @@ Timer sleeptimer
Timer settings_timer Timer settings_timer
Attributes Attributes
ID : 56 ID : 55
Scope : local Scope : local
Period (ms): 1000 Period (ms): 1000
Enabled : no Enabled : no

Binary file not shown.

Binary file not shown.

View File

@@ -5,6 +5,7 @@ Program.s
int h=0,s=0,v=0 int h=0,s=0,v=0
int p=0,q=0,t=0,f=0 int p=0,q=0,t=0,f=0
int api=0 // 0 = disconnected from HA, 1 = connected to HA int api=0 // 0 = disconnected from HA, 1 = connected to HA
int is_alarm=0
bauds=115200//Configure baudrat bauds=115200//Configure baudrat
recmod=0//Serial data parsing mode:0-Passive mode;1-Active mode recmod=0//Serial data parsing mode:0-Passive mode;1-Active mode
printh 00 00 00 ff ff ff 88 ff ff ff//Output power on information to serial port printh 00 00 00 ff ff ff 88 ff ff ff//Output power on information to serial port

View File

@@ -21,6 +21,9 @@ Page home
prints "{\"page\": \"home\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0 prints "{\"page\": \"home\", \"component\": \"currentpage\", \"value\": \"pagechange\"}",0
printh 00 printh 00
printh FF FF FF printh FF FF FF
vis button06_icon,0
vis button06,0
vis bt_alarm,is_alarm
Variable (int32) brightness Variable (int32) brightness
Attributes Attributes
@@ -48,14 +51,14 @@ Variable (int32) sleepmodus
Variable (string) lastclick Variable (string) lastclick
Attributes Attributes
ID : 54 ID : 53
Scope : local Scope : local
Text : Text :
Max. Text Size: 100 Max. Text Size: 100
Variable (string) entity Variable (string) entity
Attributes Attributes
ID : 55 ID : 54
Scope : global Scope : global
Text : Text :
Max. Text Size: 100 Max. Text Size: 100
@@ -360,7 +363,7 @@ Text button06_icon
Text : Text :
Max. Text Size : 10 Max. Text Size : 10
Text button07_icon Text bt_alarm
Attributes Attributes
ID : 44 ID : 44
Scope : global Scope : global
@@ -370,9 +373,17 @@ Text button07_icon
Text : Text :
Max. Text Size : 10 Max. Text Size : 10
Events
Touch Release Event
if(api==1)
{
entity.txt=""
page alarm
}
Text meridiem Text meridiem
Attributes Attributes
ID : 53 ID : 52
Scope : global Scope : global
Dragging : 0 Dragging : 0
Send Component ID : disabled Send Component ID : disabled
@@ -552,24 +563,9 @@ Hotspot button06
page entitypage01 page entitypage01
} }
Hotspot button07
Attributes
ID : 51
Scope : local
Dragging : 0
Send Component ID: disabled
Events
Touch Release Event
if(api==1)
{
entity.txt=""
page alarm
}
Hotspot settings_click Hotspot settings_click
Attributes Attributes
ID : 52 ID : 51
Scope : local Scope : local
Dragging : 0 Dragging : 0
Send Component ID: on release Send Component ID: on release
@@ -625,7 +621,7 @@ Timer sleeptimer
Timer settings_timer Timer settings_timer
Attributes Attributes
ID : 56 ID : 55
Scope : local Scope : local
Period (ms): 1000 Period (ms): 1000
Enabled : no Enabled : no

Binary file not shown.

Binary file not shown.

View File

@@ -5,6 +5,7 @@ Program.s
int h=0,s=0,v=0 int h=0,s=0,v=0
int p=0,q=0,t=0,f=0 int p=0,q=0,t=0,f=0
int api=0 // 0 = disconnected from HA, 1 = connected to HA int api=0 // 0 = disconnected from HA, 1 = connected to HA
int is_alarm=0
bauds=115200//Configure baudrat bauds=115200//Configure baudrat
recmod=0//Serial data parsing mode:0-Passive mode;1-Active mode recmod=0//Serial data parsing mode:0-Passive mode;1-Active mode
printh 00 00 00 ff ff ff 88 ff ff ff//Output power on information to serial port printh 00 00 00 ff ff ff 88 ff ff ff//Output power on information to serial port

View File

@@ -23,6 +23,7 @@ Page home
printh FF FF FF printh FF FF FF
vis button06_icon,0 vis button06_icon,0
vis button06,0 vis button06,0
vis bt_alarm,is_alarm
vis left_bt_text,0 vis left_bt_text,0
vis right_bt_text,0 vis right_bt_text,0
@@ -52,14 +53,14 @@ Variable (int32) sleepmodus
Variable (string) lastclick Variable (string) lastclick
Attributes Attributes
ID : 54 ID : 53
Scope : local Scope : local
Text : Text :
Max. Text Size: 100 Max. Text Size: 100
Variable (string) entity Variable (string) entity
Attributes Attributes
ID : 55 ID : 54
Scope : global Scope : global
Text : Text :
Max. Text Size: 100 Max. Text Size: 100
@@ -364,7 +365,7 @@ Text button06_icon
Text : Text :
Max. Text Size : 10 Max. Text Size : 10
Text button07_icon Text bt_alarm
Attributes Attributes
ID : 44 ID : 44
Scope : global Scope : global
@@ -374,9 +375,17 @@ Text button07_icon
Text : Text :
Max. Text Size : 10 Max. Text Size : 10
Events
Touch Release Event
if(api==1)
{
entity.txt=""
page alarm
}
Text meridiem Text meridiem
Attributes Attributes
ID : 53 ID : 52
Scope : global Scope : global
Dragging : 0 Dragging : 0
Send Component ID : disabled Send Component ID : disabled
@@ -556,24 +565,9 @@ Hotspot button06
page entitypage01 page entitypage01
} }
Hotspot button07
Attributes
ID : 51
Scope : local
Dragging : 0
Send Component ID: disabled
Events
Touch Release Event
if(api==1)
{
entity.txt=""
page alarm
}
Hotspot settings_click Hotspot settings_click
Attributes Attributes
ID : 52 ID : 51
Scope : local Scope : local
Dragging : 0 Dragging : 0
Send Component ID: disabled Send Component ID: disabled
@@ -629,7 +623,7 @@ Timer sleeptimer
Timer settings_timer Timer settings_timer
Attributes Attributes
ID : 56 ID : 55
Scope : local Scope : local
Period (ms): 1000 Period (ms): 1000
Enabled : no Enabled : no