This commit is contained in:
Edward Firmo
2023-12-18 17:42:45 +01:00
parent 25567fa381
commit 98d3a9189c
6 changed files with 42 additions and 19 deletions

View File

@@ -7,6 +7,7 @@
##### ATTENTION: This will add climate elements to the core system and requires the core part. ##### ##### ATTENTION: This will add climate elements to the core system and requires the core part. #####
##################################################################################################### #####################################################################################################
---
substitutions: substitutions:
### Local thermostat defaults ### ### Local thermostat defaults ###
# https://esphome.io/components/climate/thermostat.html # https://esphome.io/components/climate/thermostat.html

View File

@@ -7,8 +7,8 @@
##### ATTENTION: This will add advanced elements to the core system and requires the core part. ##### ##### ATTENTION: This will add advanced elements to the core system and requires the core part. #####
##################################################################################################### #####################################################################################################
---
substitutions: substitutions:
################## Defaults ################## ################## Defaults ##################
# Just in case user forgets to set something # # Just in case user forgets to set something #
nextion_update_url: "http://github.com/Blackymas/NSPanel_HA_Blueprint/raw/main/custom_configuration/nspanel_eu.tft" nextion_update_url: "http://github.com/Blackymas/NSPanel_HA_Blueprint/raw/main/custom_configuration/nspanel_eu.tft"

View File

@@ -7,6 +7,7 @@
##### ATTENTION: This will add advanced elements to the core system and requires the core part. ##### ##### ATTENTION: This will add advanced elements to the core system and requires the core part. #####
##################################################################################################### #####################################################################################################
---
button: button:
##### EXIT REPARSE TFT DISPLAY ##### ##### EXIT REPARSE TFT DISPLAY #####
- name: ${device_name} Exit reparse - name: ${device_name} Exit reparse

View File

@@ -5,6 +5,7 @@
##### For normal use with the Blueprint, no changes are necessary. ##### ##### For normal use with the Blueprint, no changes are necessary. #####
##################################################################################################### #####################################################################################################
---
substitutions: substitutions:
##### DON'T CHANGE THIS ##### ##### DON'T CHANGE THIS #####
version: "4.2dev" version: "4.2dev"
@@ -171,14 +172,14 @@ api:
disp1->set_component_value(component.c_str(), val); disp1->set_component_value(component.c_str(), val);
##### Service to send a command "hide componente" directly to the display ##### ##### Service to send a command "hide componente" directly to the display #####
- service: send_command_hide ### unused ### - service: send_command_hide
variables: variables:
component: string component: string
then: then:
- lambda: 'disp1->hide_component(component.c_str());' - lambda: 'disp1->hide_component(component.c_str());'
##### Service to send a command "show componente" directly to the display ##### ##### Service to send a command "show componente" directly to the display #####
- service: send_command_show ### unused ### - service: send_command_show
variables: variables:
component: string component: string
then: then:
@@ -210,11 +211,11 @@ api:
code_format: string code_format: string
code_arm_required: bool code_arm_required: bool
entity: string entity: string
mui_alarm: string[] #std::vector<std::string> #std::map mui_alarm: string[]
then: then:
- lambda: |- - lambda: |-
// Is page Alarm visible? // Is page Alarm visible?
if (current_page->state == "alarm") // To do: This page constructor should be moved to Blueprint if (current_page->state == "alarm") // To do: This page constructor should be moved to Blueprint
{ // Update alarm page { // Update alarm page
detailed_entity->publish_state(entity); detailed_entity->publish_state(entity);
@@ -225,7 +226,8 @@ api:
} }
disp1->set_component_text_printf("page_label", "%s", page_title.c_str()); disp1->set_component_text_printf("page_label", "%s", page_title.c_str());
disp1->set_component_text_printf("code_format", "%s", code_format.c_str()); disp1->set_component_text_printf("code_format", "%s", code_format.c_str());
if (code_arm_required) disp1->set_component_text_printf("code_arm_req", "1"); else disp1->set_component_text_printf("code_arm_req", "0"); if (code_arm_required) disp1->set_component_text_printf("code_arm_req", "1");
else disp1->set_component_text_printf("code_arm_req", "0");
// Alarm page - Button's text // Alarm page - Button's text
display_wrapped_text->execute("bt_home_text", mui_alarm[0].c_str(), 10); display_wrapped_text->execute("bt_home_text", mui_alarm[0].c_str(), 10);
@@ -355,7 +357,7 @@ api:
- if: - if:
condition: condition:
- text_sensor.state: # Is boot page visible? - text_sensor.state: # Is boot page visible?
id: current_page id: current_page
state: boot state: boot
then: then:
@@ -365,13 +367,13 @@ api:
- wait_until: - wait_until:
condition: condition:
- not: - not:
- text_sensor.state: # Is boot page visible? - text_sensor.state: # Is boot page visible?
id: current_page id: current_page
state: 'boot' state: 'boot'
timeout: 2s timeout: 2s
- if: - if:
condition: condition:
- text_sensor.state: # Avoid this being called twice by multiple boot triggers - text_sensor.state: # Avoid this being called twice by multiple boot triggers
id: current_page id: current_page
state: 'boot' state: 'boot'
then: then:
@@ -484,7 +486,7 @@ api:
climate_icon: !lambda "return climate_icon;" climate_icon: !lambda "return climate_icon;"
embedded_climate: !lambda "return embedded_climate;" embedded_climate: !lambda "return embedded_climate;"
#### Service to set the buttons #### #### Service to set the buttons ####
- service: set_button - service: set_button
variables: variables:
page: string page: string
@@ -619,7 +621,6 @@ api:
- service: page_settings - service: page_settings
variables: variables:
reboot: string reboot: string
#sleep_mode: string
brightness: string brightness: string
bright: string bright: string
dim: string dim: string
@@ -1632,7 +1633,7 @@ script:
timer_dim->execute(page.c_str(), int(timeout_dim->state)); timer_dim->execute(page.c_str(), int(timeout_dim->state));
timer_sleep->execute(page.c_str(), int(timeout_sleep->state)); timer_sleep->execute(page.c_str(), int(timeout_sleep->state));
- id: timer_page # Handle the fallback to home page after a timeout - id: timer_page # Handles the fallback to home page after a timeout
mode: restart mode: restart
parameters: parameters:
page: string page: string
@@ -1663,7 +1664,7 @@ script:
ESP_LOGD("script.timer_page", "Fallback to page Home"); ESP_LOGD("script.timer_page", "Fallback to page Home");
disp1->goto_page("home"); disp1->goto_page("home");
} }
- id: timer_dim # Handle the brightness dimming after a timeout - id: timer_dim # Handles the brightness dimming after a timeout
mode: restart mode: restart
parameters: parameters:
page: string page: string
@@ -1690,7 +1691,7 @@ script:
timeout >= 1) { timeout >= 1) {
set_brightness->execute(id(display_dim_brightness_global)); set_brightness->execute(id(display_dim_brightness_global));
} }
- id: timer_sleep # Handle the sleep (go to screensaver page) after a timeout - id: timer_sleep # Handles the sleep (go to screensaver page) after a timeout
mode: restart mode: restart
parameters: parameters:
page: string page: string
@@ -1794,20 +1795,34 @@ script:
disp1->set_component_text_printf("home.meridiem", "%s", meridiem_text.c_str()); disp1->set_component_text_printf("home.meridiem", "%s", meridiem_text.c_str());
} }
else { disp1->set_component_text_printf("home.meridiem", " "); } else { disp1->set_component_text_printf("home.meridiem", " "); }
if (time_format_str.find("%-H") != std::string::npos) { time_format_str = time_format_str.replace(time_format_str.find("%-H"), sizeof("%-H")-1, to_string((int)(id(time_provider).now().hour))); } if (time_format_str.find("%-H") != std::string::npos) {
time_format_str = time_format_str.replace(time_format_str.find("%-H"),
sizeof("%-H")-1,
to_string((int)(id(time_provider).now().hour))
);
}
if (time_format_str.find("%-I") != std::string::npos) if (time_format_str.find("%-I") != std::string::npos)
{ {
if (id(time_provider).now().hour>12) if (id(time_provider).now().hour>12)
{ {
time_format_str = time_format_str.replace(time_format_str.find("%-I"), sizeof("%-I")-1, to_string((int)(id(time_provider).now().hour-12))); time_format_str = time_format_str.replace(time_format_str.find("%-I"),
sizeof("%-I")-1,
to_string((int)(id(time_provider).now().hour-12))
);
} }
else if (id(time_provider).now().hour==0) else if (id(time_provider).now().hour==0)
{ {
time_format_str = time_format_str.replace(time_format_str.find("%-I"), sizeof("%-I")-1, "12"); time_format_str = time_format_str.replace(time_format_str.find("%-I"),
sizeof("%-I")-1,
"12"
);
} }
else else
{ {
time_format_str = time_format_str.replace(time_format_str.find("%-I"), sizeof("%-I")-1, to_string((int)(id(time_provider).now().hour))); time_format_str = time_format_str.replace(time_format_str.find("%-I"),
sizeof("%-I")-1,
to_string((int)(id(time_provider).now().hour))
);
} }
} }
std::string time_text = id(time_provider).now().strftime(time_format_str); std::string time_text = id(time_provider).now().strftime(time_format_str);
@@ -2085,7 +2100,11 @@ script:
- lambda: |- - lambda: |-
int fg565 = -1; int fg565 = -1;
// Foreground // Foreground
if (foreground.size() == 3 and foreground[0] >= 0 and foreground[1] >= 0 and foreground[2] >= 0) fg565 = ((foreground[0] & 0b11111000) << 8) | ((foreground[1] & 0b11111100) << 3) | (foreground[2] >> 3); if (foreground.size() == 3 and
foreground[0] >= 0 and
foreground[1] >= 0 and
foreground[2] >= 0)
fg565 = ((foreground[0] & 0b11111000) << 8) | ((foreground[1] & 0b11111100) << 3) | (foreground[2] >> 3);
else if (foreground.size() == 1) fg565 = foreground[0]; else if (foreground.size() == 1) fg565 = foreground[0];
else fg565 = -1; else fg565 = -1;
if (fg565 >= 0) disp1->set_component_font_color(component.c_str(), fg565); if (fg565 >= 0) disp1->set_component_font_color(component.c_str(), fg565);

View File

@@ -7,6 +7,7 @@
##### ATTENTION: This will add climate elements to the core system and requires the core part. ##### ##### ATTENTION: This will add climate elements to the core system and requires the core part. #####
##################################################################################################### #####################################################################################################
---
substitutions: substitutions:
### Local thermostat defaults ### ### Local thermostat defaults ###
# https://esphome.io/components/climate/thermostat.html # https://esphome.io/components/climate/thermostat.html

View File

@@ -7,6 +7,7 @@
##### ATTENTION: This will add climate elements to the core system and requires the core part. ##### ##### ATTENTION: This will add climate elements to the core system and requires the core part. #####
##################################################################################################### #####################################################################################################
---
substitutions: substitutions:
### Local thermostat defaults ### ### Local thermostat defaults ###
# https://esphome.io/components/climate/thermostat.html # https://esphome.io/components/climate/thermostat.html