Home buttons new format - QRcode
Modernise the button "QRcode" flow on page Home to improve performance.
This commit is contained in:
@@ -294,15 +294,16 @@ api:
|
||||
rtttl: !lambda 'return song_str;'
|
||||
|
||||
# Service to show a QR code on the display (ex. for WiFi password)
|
||||
- service: qr_code
|
||||
- service: qrcode
|
||||
variables:
|
||||
qrdata: string
|
||||
title: string
|
||||
qrcode: string
|
||||
show: bool
|
||||
then:
|
||||
- wait_until:
|
||||
binary_sensor.is_on: nextion_init
|
||||
- lambda: |-
|
||||
id(disp1).send_command_printf("page qrcode");
|
||||
id(disp1).set_component_text_printf("qrcode.qrcode_value", "%s", qrdata.c_str());
|
||||
id(disp1).set_component_text_printf("qrcode.qrcode_label", "%s", title.c_str());
|
||||
id(disp1).set_component_text_printf("qrcode.qrcode_value", "%s", qrcode.c_str());
|
||||
if (show) id(disp1).send_command_printf("page qrcode");
|
||||
|
||||
#### Service to set climate state ####
|
||||
- service: set_climate
|
||||
@@ -444,10 +445,6 @@ api:
|
||||
time_color: int
|
||||
embedded_climate: bool
|
||||
wakeup_page: int
|
||||
alarm_state: string
|
||||
entities_pages: bool
|
||||
entities_pages_icon: string
|
||||
entities_pages_icon_color: int
|
||||
then:
|
||||
## Logs
|
||||
- lambda: if (${verbose_log}) ESP_LOGD("service.global_settings", "Starting");
|
||||
@@ -465,10 +462,6 @@ api:
|
||||
ESP_LOGD("service.global_settings", "time_color: %i", time_color);
|
||||
ESP_LOGD("service.global_settings", "embedded_climate: %i", (embedded_climate) ? 1 : 0);
|
||||
ESP_LOGD("service.global_settings", "wakeup_page: %i", wakeup_page);
|
||||
ESP_LOGD("service.global_settings", "alarm_state: %s", alarm_state.c_str());
|
||||
ESP_LOGD("service.global_settings", "entities_pages: %i", (entities_pages) ? 1 : 0);
|
||||
ESP_LOGD("service.global_settings", "entities_pages_icon: %s", entities_pages_icon.c_str());
|
||||
ESP_LOGD("service.global_settings", "entities_pages_icon_color: %i", entities_pages_icon_color);
|
||||
}
|
||||
|
||||
## Relays
|
||||
@@ -494,19 +487,6 @@ api:
|
||||
embedded_climate: !lambda return embedded_climate;
|
||||
#- lambda: id(is_embedded_thermostat) = embedded_climate;
|
||||
|
||||
## Entities pages button
|
||||
- lambda: |-
|
||||
if (${verbose_log}) ESP_LOGD("service.global_settings", "Entities pages button - Start");
|
||||
id(disp1).send_command_printf("is_entities=%i", (entities_pages) ? 1 : 0);
|
||||
id(disp1).set_component_text_printf("home.bt_entities", "%s", entities_pages_icon.c_str());
|
||||
id(disp1).set_component_font_color("home.bt_entities", entities_pages_icon_color);
|
||||
|
||||
## Alarm button
|
||||
- lambda: |-
|
||||
if (${verbose_log}) ESP_LOGD("service.global_settings", "Alarm button - Start");
|
||||
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
|
||||
- lambda: |-
|
||||
if (${verbose_log}) ESP_LOGD("service.global_settings", "Wakeup page - Start");
|
||||
@@ -524,6 +504,52 @@ api:
|
||||
|
||||
- lambda: if (${verbose_log}) ESP_LOGD("service.global_settings", "Finished");
|
||||
|
||||
#### Service to populate the page Home #####
|
||||
- service: page_home_settings
|
||||
variables:
|
||||
qrcode: bool
|
||||
qrcode_icon: string
|
||||
qrcode_icon_color: int
|
||||
entities_pages: bool
|
||||
entities_pages_icon: string
|
||||
entities_pages_icon_color: int
|
||||
alarm_state: string
|
||||
then:
|
||||
## Logs
|
||||
- lambda: if (${verbose_log}) ESP_LOGD("service.page_home_settings", "Starting");
|
||||
- lambda: |-
|
||||
if (${verbose_log})
|
||||
{
|
||||
ESP_LOGD("service.page_home_settings", "qrcode: %i", (qrcode) ? 1 : 0);
|
||||
ESP_LOGD("service.page_home_settings", "qrcode_icon: %s", qrcode_icon.c_str());
|
||||
ESP_LOGD("service.page_home_settings", "qrcode_icon_color: %i", qrcode_icon_color);
|
||||
ESP_LOGD("service.page_home_settings", "entities_pages: %i", (entities_pages) ? 1 : 0);
|
||||
ESP_LOGD("service.page_home_settings", "entities_pages_icon: %s", entities_pages_icon.c_str());
|
||||
ESP_LOGD("service.page_home_settings", "entities_pages_icon_color: %i", entities_pages_icon_color);
|
||||
ESP_LOGD("service.page_home_settings", "alarm_state: %s", alarm_state.c_str());
|
||||
}
|
||||
## QRCode button
|
||||
- lambda: |-
|
||||
if (${verbose_log}) ESP_LOGD("service.page_home_settings", "QRcode button - Start");
|
||||
id(disp1).send_command_printf("is_qrcode=%i", (qrcode) ? 1 : 0);
|
||||
id(disp1).set_component_text_printf("home.bt_qrcode", "%s", qrcode_icon.c_str());
|
||||
id(disp1).set_component_font_color("home.bt_qrcode", qrcode_icon_color);
|
||||
|
||||
## Entities pages button
|
||||
- lambda: |-
|
||||
if (${verbose_log}) ESP_LOGD("service.page_home_settings", "Entities pages button - Start");
|
||||
id(disp1).send_command_printf("is_entities=%i", (entities_pages) ? 1 : 0);
|
||||
id(disp1).set_component_text_printf("home.bt_entities", "%s", entities_pages_icon.c_str());
|
||||
id(disp1).set_component_font_color("home.bt_entities", entities_pages_icon_color);
|
||||
|
||||
## Alarm button
|
||||
- lambda: |-
|
||||
if (${verbose_log}) ESP_LOGD("service.page_home_settings", "Alarm button - Start");
|
||||
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());
|
||||
|
||||
- lambda: if (${verbose_log}) ESP_LOGD("service.page_home_settings", "Finished");
|
||||
|
||||
#### Service to populate the alarm settings page #####
|
||||
- service: alarm_settings
|
||||
variables:
|
||||
|
||||
Reference in New Issue
Block a user