Use panel's events to reset timers

Possibly solves #1040
Possibly solves https://github.com/Blackymas/NSPanel_HA_Blueprint/discussions/995#discussioncomment-7020153
This commit is contained in:
Edward Firmo
2023-09-16 10:12:58 +02:00
parent aeb25f21ff
commit 22ba572d75

View File

@@ -224,7 +224,7 @@ api:
id(notification_label).publish_state(label.c_str());
id(notification_text).publish_state(text.c_str());
id(timer_reset_all).execute();
id(timer_reset_all).execute(id(current_page).state.c_str());
- switch.turn_on: notification_unread
- if:
condition:
@@ -254,13 +254,13 @@ api:
back_page: string
then:
- lambda: |-
ESP_LOGD("api.service.open_entity_settings_page", "Starting");
ESP_LOGD("api.service.open_entity_settings_page", "page: %s", page.c_str());
ESP_LOGD("api.service.open_entity_settings_page", "page_label: %s", page_label.c_str());
ESP_LOGD("api.service.open_entity_settings_page", "page_icon: %s", page_icon.c_str());
ESP_LOGD("api.service.open_entity_settings_page", "page_icon_color: %i, %i, %i", page_icon_color[0], page_icon_color[1], page_icon_color[2] );
ESP_LOGD("api.service.open_entity_settings_page", "entity: %s", entity.c_str());
ESP_LOGD("api.service.open_entity_settings_page", "back_page: %s", back_page.c_str());
ESP_LOGV("api.service.open_entity_settings_page", "Starting");
ESP_LOGV("api.service.open_entity_settings_page", "page: %s", page.c_str());
ESP_LOGV("api.service.open_entity_settings_page", "page_label: %s", page_label.c_str());
ESP_LOGV("api.service.open_entity_settings_page", "page_icon: %s", page_icon.c_str());
ESP_LOGV("api.service.open_entity_settings_page", "page_icon_color: %i, %i, %i", page_icon_color[0], page_icon_color[1], page_icon_color[2] );
ESP_LOGV("api.service.open_entity_settings_page", "entity: %s", entity.c_str());
ESP_LOGV("api.service.open_entity_settings_page", "back_page: %s", back_page.c_str());
id(entity_id) = entity;
std::string cmd_page = std::string("page ") + page.c_str();
id(disp1).send_command_printf(cmd_page.c_str());
@@ -277,7 +277,7 @@ api:
id(disp1).set_component_text_printf("icon_state", "%s", page_icon.c_str());
id(set_component_color).execute("icon_state", page_icon_color, {});
}
ESP_LOGD("api.service.open_entity_settings_page", "Finished");
ESP_LOGV("api.service.open_entity_settings_page", "Finished");
##### Service to play a rtttl tones #####
# Example tones : https://codebender.cc/sketch:109888#RTTTL%20Songs.ino
@@ -313,13 +313,13 @@ api:
entity: string
then:
- lambda: |-
ESP_LOGD("api.service.set_climate", "climateslider.maxval=%i", total_steps);
ESP_LOGD("api.service.set_climate", "temp_offset=%f", temp_offset);
ESP_LOGD("api.service.set_climate", "temp_step=%f", temp_step);
ESP_LOGD("api.service.set_climate", "current_temp=%f", current_temp);
ESP_LOGD("api.service.set_climate", "target_temp=%f", target_temp);
ESP_LOGD("api.service.set_climate", "target_icon=%s", climate_icon.c_str());
ESP_LOGD("api.service.set_climate", "embedded=%i", (embedded_climate) ? 1 : 0);
ESP_LOGV("api.service.set_climate", "climateslider.maxval=%i", total_steps);
ESP_LOGV("api.service.set_climate", "temp_offset=%f", temp_offset);
ESP_LOGV("api.service.set_climate", "temp_step=%f", temp_step);
ESP_LOGV("api.service.set_climate", "current_temp=%f", current_temp);
ESP_LOGV("api.service.set_climate", "target_temp=%f", target_temp);
ESP_LOGV("api.service.set_climate", "target_icon=%s", climate_icon.c_str());
ESP_LOGV("api.service.set_climate", "embedded=%i", (embedded_climate) ? 1 : 0);
if (id(current_page).state == "climate") id(entity_id) = entity;
- script.execute:
@@ -348,9 +348,9 @@ api:
#entity: string
then:
- lambda: |-
ESP_LOGD("service.set_button", "Starting");
ESP_LOGD("service.set_button", "btn_id: %s", btn_id.c_str());
ESP_LOGD("service.set_button", "btn_label: %s", btn_label.c_str());
ESP_LOGV("service.set_button", "Starting");
ESP_LOGV("service.set_button", "btn_id: %s", btn_id.c_str());
ESP_LOGV("service.set_button", "btn_label: %s", btn_label.c_str());
std::string btnicon = btn_id.c_str() + std::string("icon");
std::string btntext = btn_id.c_str() + std::string("text");
std::string btnbri = btn_id.c_str() + std::string("bri");
@@ -368,7 +368,7 @@ api:
id(disp1).set_component_text_printf(btnbri.c_str(), " ");
//id(disp1).set_component_value(btnconf.c_str(), (btn_confirm) ? 1 : 0);
//id(disp1).set_component_text_printf(btnentity.c_str(), "%s", entity.c_str());
ESP_LOGD("service.set_button", "Finished");
ESP_LOGV("service.set_button", "Finished");
##### SERVICE TO WAKE UP THE DISPLAY #####
- service: wake_up
@@ -378,11 +378,11 @@ api:
- lambda: |-
if (id(current_page).state == "screensaver") id(disp1).goto_page(id(wakeup_page_name).state.c_str());
if (reset_timer)
id(timer_reset_all).execute();
id(timer_reset_all).execute(id(wakeup_page_name).state.c_str());
else
{
id(timer_sleep).execute(int(id(timeout_sleep).state));
id(timer_dim).execute(int(id(timeout_dim).state));
id(timer_sleep).execute(id(wakeup_page_name).state.c_str(), int(id(timeout_sleep).state));
id(timer_dim).execute(id(wakeup_page_name).state.c_str(), int(id(timeout_dim).state));
}
#### Service to set the entities ####
@@ -395,18 +395,18 @@ api:
ent_value_xcen: string
then:
- lambda: |-
ESP_LOGD("service.set_entity", "entity: %s", ent_id.c_str());
ESP_LOGV("service.set_entity", "entity: %s", ent_id.c_str());
std::string enticon = ent_id.c_str() + std::string("_pic");
std::string entlabel = ent_id.c_str() + std::string("_label");
std::string entxcen = ent_id.c_str() + std::string(".xcen=") + ent_value_xcen.c_str();
id(disp1).set_component_text_printf(enticon.c_str(), "%s", ent_icon.c_str());
ESP_LOGD("service.set_entity", "%s: %s", enticon.c_str(), ent_id.c_str());
ESP_LOGV("service.set_entity", "%s: %s", enticon.c_str(), ent_id.c_str());
if (strcmp(ent_icon.c_str(), "0") != 0) id(disp1).set_component_text_printf(enticon.c_str(), "%s", ent_icon.c_str());
id(disp1).set_component_text_printf(entlabel.c_str(), "%s", ent_label.c_str());
ESP_LOGD("service.set_entity", "%s: %s", entlabel.c_str(), ent_label.c_str());
ESP_LOGV("service.set_entity", "%s: %s", entlabel.c_str(), ent_label.c_str());
//id(display_wrapped_text).execute(entlabel.c_str(), ent_label.c_str(), id(display_mode) == 2 ? 16 : 20);
id(disp1).set_component_text_printf(ent_id.c_str(), "%s", ent_value.c_str());
ESP_LOGD("service.set_entity", "%s: %s", ent_id.c_str(), ent_value.c_str());
ESP_LOGV("service.set_entity", "%s: %s", ent_id.c_str(), ent_value.c_str());
if (strcmp(ent_value_xcen.c_str(), "0") != 0) id(disp1).send_command_printf("%s", entxcen.c_str());
##### Service for transferring global settings from the blueprint to ESPHome #####
@@ -436,11 +436,11 @@ api:
ESP_LOGV("service.global_settings", "relay1_local_control: %i", (relay1_local_control) ? 1 : 0);
ESP_LOGV("service.global_settings", "relay1_icon: %s", relay1_icon.c_str());
ESP_LOGV("service.global_settings", "relay1_icon_color: %i", relay1_icon_color);
ESP_LOGD("service.global_settings", "relay1_fallback: %i", (relay1_fallback) ? 1 : 0);
ESP_LOGV("service.global_settings", "relay1_fallback: %i", (relay1_fallback) ? 1 : 0);
ESP_LOGV("service.global_settings", "relay2_local_control: %i", (relay2_local_control) ? 1 : 0);
ESP_LOGV("service.global_settings", "relay2_icon: %s", relay2_icon.c_str());
ESP_LOGV("service.global_settings", "relay2_icon_color: %i", relay2_icon_color);
ESP_LOGD("service.global_settings", "relay2_fallback: %i", (relay2_fallback) ? 1 : 0);
ESP_LOGV("service.global_settings", "relay2_fallback: %i", (relay2_fallback) ? 1 : 0);
ESP_LOGV("service.global_settings", "date_color: %i", date_color);
ESP_LOGV("service.global_settings", "time_format: %s", time_format.c_str());
ESP_LOGV("service.global_settings", "time_color: %i", time_color);
@@ -526,7 +526,7 @@ api:
- lambda: |-
ESP_LOGD("service.global_settings", "Jump to wake-up page: %s", id(wakeup_page_name).state.c_str());
id(disp1).goto_page(id(wakeup_page_name).state.c_str());
id(timer_reset_all).execute();
id(timer_reset_all).execute(id(wakeup_page_name).state.c_str());
- lambda: ESP_LOGV("service.global_settings", "Finished");
@@ -1120,7 +1120,7 @@ sensor:
on_value:
then:
- lambda: |-
id(timer_reset_all).execute();
id(timer_reset_all).execute(id(current_page).state.c_str());
##### Uptime Sensors #####
- name: ${device_name} Uptime seconds
@@ -1186,6 +1186,15 @@ sensor:
# Show panel's temperature if API or Wi-Fi are out
- lambda: id(display_embedded_temp).execute();
- name: ${device_name} Brightness
id: display_current_brightness
platform: nextion
variable_name: dim
internal: true
icon: mdi:tablet-dashboard
unit_of_measurement: '%'
accuracy_decimals : 0
###### Display Brightness GET VALUE FROM NSPanel SLIDER #####
- name: ${device_name} brightness Slider
platform: nextion
@@ -1197,6 +1206,9 @@ sensor:
- number.set:
id: display_brightness
value: !lambda 'return int(x);'
- lambda: |-
id(timer_reset_all).execute("settings");
id(display_current_brightness).update();
###### Display DIM Brightness GET VALUE FROM NSPanel SLIDER #####
- name: ${device_name} dim brightness slider
@@ -1209,6 +1221,9 @@ sensor:
- number.set:
id: display_dim_brightness
value: !lambda 'return int(x);'
- lambda: |-
id(timer_reset_all).execute("settings");
id(display_current_brightness).update();
##### START - TEXT SENSOR CONFIGURATION #####
text_sensor:
@@ -1233,6 +1248,8 @@ text_sensor:
if (x != "climate" and x != "cover" and x != "fan" and x != "light" and x != "media_player" ) id(entity_id) = "";
ESP_LOGD("text_sensor.current_page", "New page: %s", x.c_str());
if (!id(entity_id).empty()) ESP_LOGD("text_sensor.current_page", "Entity shown: %s", id(entity_id).c_str());
id(timer_reset_all).execute(x.c_str());
id(display_current_brightness).update();
##### ESPhome version used to compile the app #####
- name: ${device_name} ESPhome Version
@@ -1274,17 +1291,18 @@ text_sensor:
on_value:
then:
- lambda: |-
ESP_LOGD("text_sensor.nspanelevent", "Starting");
ESP_LOGV("text_sensor.nspanelevent", "Starting");
DynamicJsonDocument doc(1024);
deserializeJson(doc, x);
std::string page = doc["page"];
std::string component = doc["component"];
if (not (component == "currentpage" and (page == "screensaver" or page == "home"))) id(timer_reset_all).execute(page.c_str());
std::string value = doc["value"];
std::string entity = id(entity_id); //doc["entity"];
ESP_LOGD("text_sensor.nspanelevent", "page: %s", page.c_str());
ESP_LOGD("text_sensor.nspanelevent", "component: %s", component.c_str());
ESP_LOGD("text_sensor.nspanelevent", "value: %s", value.c_str());
ESP_LOGD("text_sensor.nspanelevent", "entity: %s", entity.c_str());
ESP_LOGV("text_sensor.nspanelevent", "page: %s", page.c_str());
ESP_LOGV("text_sensor.nspanelevent", "component: %s", component.c_str());
ESP_LOGV("text_sensor.nspanelevent", "value: %s", value.c_str());
ESP_LOGV("text_sensor.nspanelevent", "entity: %s", entity.c_str());
auto ha_event = new esphome::api::CustomAPIDevice();
ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint",
{
@@ -1296,17 +1314,15 @@ text_sensor:
});
if (component=="currentpage")
{
ESP_LOGD("text_sensor.nspanelevent", "New page: %s", page.c_str());
ESP_LOGD("text_sensor.nspanelevent", "Trigger HA event");
if (page != "boot" and page != "home" and page != "screensaver")
id(timer_reset_all).execute();
ESP_LOGV("text_sensor.nspanelevent", "New page: %s", page.c_str());
ESP_LOGV("text_sensor.nspanelevent", "Trigger HA event");
ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint",
{
{"type", "page_changed"},
{"page", page},
{"entity", entity}
});
ESP_LOGD("text_sensor.nspanelevent", "Call add-ons scripts for new page");
ESP_LOGV("text_sensor.nspanelevent", "Call add-ons scripts for new page");
id(addon_climate_set_climate).execute(page=="climate" and entity=="embedded_climate");
ESP_LOGV("text_sensor.nspanelevent", "Publish current_page sensor");
id(current_page).publish_state(page);
@@ -1406,44 +1422,43 @@ text_sensor:
on_value:
then:
- lambda: |-
ESP_LOGD("text_sensor.localevent", "Starting");
ESP_LOGV("text_sensor.localevent", "Starting");
DynamicJsonDocument doc(1024);
deserializeJson(doc, x);
std::string page = doc["page"];
ESP_LOGD("text_sensor.localevent", "page: %s", page.c_str());
ESP_LOGV("text_sensor.localevent", "page: %s", page.c_str());
std::string event = doc["event"];
ESP_LOGD("text_sensor.localevent", "event: %s", event.c_str());
ESP_LOGV("text_sensor.localevent", "event: %s", event.c_str());
if (not (event == "pagechanged" and (page == "screensaver" or page == "home"))) id(timer_reset_all).execute(page.c_str());
std::string component = doc["component"];
ESP_LOGD("text_sensor.localevent", "component: %s", component.c_str());
ESP_LOGV("text_sensor.localevent", "component: %s", component.c_str());
std::string key = doc["key"];
ESP_LOGD("text_sensor.localevent", "key: %s", key.c_str());
ESP_LOGV("text_sensor.localevent", "key: %s", key.c_str());
std::string value = doc["value"];
ESP_LOGD("text_sensor.localevent", "value: %s", value.c_str());
ESP_LOGV("text_sensor.localevent", "value: %s", value.c_str());
std::string entity = id(entity_id); //doc["entity"];
ESP_LOGD("text_sensor.localevent", "entity: %s", entity.c_str());
ESP_LOGV("text_sensor.localevent", "entity: %s", entity.c_str());
int embedded = doc["embedded"];
ESP_LOGD("text_sensor.localevent", "embedded: %i", embedded);
ESP_LOGV("text_sensor.localevent", "embedded: %i", embedded);
std::string service = "";
// send event to Home Assistant
auto ha_event = new esphome::api::CustomAPIDevice();
if (event=="pagechanged")
{
ESP_LOGD("text_sensor.localevent", "New page: %s", page.c_str());
if (page != "boot" and page != "home" and page != "screensaver")
id(timer_reset_all).execute();
ESP_LOGD("text_sensor.localevent", "Trigger HA event");
ESP_LOGV("text_sensor.localevent", "New page: %s", page.c_str());
ESP_LOGV("text_sensor.localevent", "Trigger HA event");
ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint",
{
{"type", "page_changed"},
{"page", page},
{"entity", entity}
});
ESP_LOGD("text_sensor.localevent", "Call add-ons scripts for new page");
ESP_LOGV("text_sensor.localevent", "Call add-ons scripts for new page");
id(addon_climate_set_climate).execute(page=="climate" and id(entity_id) == "embedded_climate");
ESP_LOGD("text_sensor.localevent", "Publish current_page sensor");
ESP_LOGV("text_sensor.localevent", "Publish current_page sensor");
id(current_page).publish_state(page);
ESP_LOGD("text_sensor.localevent", "Construct new page");
ESP_LOGV("text_sensor.localevent", "Construct new page");
}
else if (event=="short_click" or event=="long_click") id(ha_button).execute(page.c_str(), component.c_str(), event.c_str());
else if (event=="click")
@@ -1684,6 +1699,7 @@ number:
id(disp1).send_command_printf("settings.brightslider.val=%i", int(x));
if (id(current_page).state != "screensaver") id(disp1).set_backlight_brightness(x/100);
if (id(current_page).state == "settings") id(disp1).set_component_text_printf("bright_text", "%i%%", int(x));
id(display_current_brightness).update();
##### SCREEN BRIGHTNESS DIMMED DOWN #####
- platform: template
@@ -1736,9 +1752,7 @@ number:
icon: mdi:timer
unit_of_measurement: "s"
set_action:
- script.execute:
id: timer_page
timeout: !lambda return int(x);
- lambda: id(timer_page).execute(id(current_page).state.c_str(), int(x));
- name: ${device_name} Timeout Dimming
platform: template
id: timeout_dim
@@ -1752,9 +1766,7 @@ number:
icon: mdi:timer
unit_of_measurement: "s"
set_action:
- script.execute:
id: timer_dim
timeout: !lambda return int(x);
- lambda: id(timer_dim).execute(id(current_page).state.c_str(), int(x));
- name: ${device_name} Timeout Sleep
platform: template
id: timeout_sleep
@@ -1768,9 +1780,7 @@ number:
icon: mdi:timer
unit_of_measurement: "s"
set_action:
- script.execute:
id: timer_sleep
timeout: !lambda return int(x);
- lambda: id(timer_sleep).execute(id(current_page).state.c_str(), int(x));
select:
- id: wakeup_page_name
@@ -1812,7 +1822,7 @@ display:
id(disp1).goto_page("boot");
id(disp1).set_component_text_printf("boot.esph_version", "%s", "${version}"); // ### esphome-version ###
id(disp1).show_component("bt_reboot");
id(timer_reset_all).execute();
id(timer_reset_all).execute("boot");
- wait_until:
api.connected
- lambda: |-
@@ -1846,47 +1856,43 @@ display:
});
id(home_relay1_icon) = "\uE3A5";
id(home_relay1_icon) = "\uE3A8";
id(timer_reset_all).execute();
id(timer_reset_all).execute("boot");
- *notification_clear
- switch.turn_off: notification_unread
- logger.log: "Nextion start - Done!"
### Script for timer_reset_all
### Scripts ######
script:
###### Timers ######
## Global timer reset - Triggered with a touch on the screen
- id: timer_reset_all
mode: restart
parameters:
page: string
then:
- logger.log:
format: Reseting timers
level: VERBOSE
- script.execute:
id: timer_page
timeout: !lambda return int(id(timeout_page).state);
- script.execute:
id: timer_dim
timeout: !lambda return int(id(timeout_dim).state);
- script.execute:
id: timer_sleep
timeout: !lambda return int(id(timeout_sleep).state);
- lambda: |-
ESP_LOGD("script.timer_reset_all", "Resetting timers");
id(timer_page).execute(page.c_str(), int(id(timeout_page).state));
id(timer_dim).execute(page.c_str(), int(id(timeout_dim).state));
id(timer_sleep).execute(page.c_str(), int(id(timeout_sleep).state));
- id: timer_page # Handle the fallback to home page after a timeout
mode: restart
parameters:
page: string
timeout: int
then:
- lambda: |-
ESP_LOGD("script.timer_page", "Reset timer: %is", timeout);
- if:
condition:
- lambda: !lambda return (timeout >= 1);
- lambda: |-
return (page != "screensaver" and page != "boot" and page != "home" and timeout >= 1);
then:
- delay: !lambda return (timeout *1000);
- lambda: |-
ESP_LOGD("script.timer_page", "Timed out on page: %s", id(current_page).state.c_str());
if (id(current_page).state != "home" and id(current_page).state != "screensaver" and id(current_page).state != "boot" and timeout >= 1)
if (id(current_page).state != "screensaver" and id(current_page).state != "boot" and id(current_page).state != "home" and timeout >= 1)
{
ESP_LOGD("script.timer_page", "Fallback to page Home");
id(disp1).goto_page("home");
@@ -1894,39 +1900,45 @@ script:
- id: timer_dim # Handle the brightness dimming after a timeout
mode: restart
parameters:
page: string
timeout: int
then:
- lambda: |-
ESP_LOGD("script.timer_dim", "Reset timer: %is", timeout);
id(display_current_brightness).update();
if (id(is_dim_brightness))
{
if (id(current_page).state != "screensaver" and id(current_page).state != "boot")
if (page != "screensaver" and page != "boot")
{
ESP_LOGD("script.timer_dim", "Waking up on page: %s", id(current_page).state.c_str());
ESP_LOGD("script.timer_dim", "Waking up on page: %s", page.c_str());
id(disp1).send_command_printf("wakeup_timer.en=1");
}
id(is_dim_brightness) = false;
}
id(display_current_brightness).update();
- if:
condition:
- lambda: !lambda return (timeout >= 1);
then:
- delay: !lambda return (timeout *1000);
- lambda: |-
if (id(current_page).state != "screensaver" and id(current_page).state != "boot" and timeout >= 1)
id(display_current_brightness).update();
if (id(current_page).state != "screensaver" and id(current_page).state != "boot" and timeout >= 1 and id(display_current_brightness).state > id(display_dim_brightness_global))
{
ESP_LOGD("script.timer_dim", "Dimming the display to %i%%", id(display_dim_brightness_global));
id(disp1).send_command_printf("dim=%i", id(display_dim_brightness_global));
id(is_dim_brightness) = true;
}
id(display_current_brightness).update();
- id: timer_sleep # Handle the sleep (go to screensaver page) after a timeout
mode: restart
parameters:
page: string
timeout: int
then:
- lambda: |-
ESP_LOGD("script.timer_sleep", "Reset timer: %is", timeout);
if (id(current_page).state == "screensaver") id(disp1).goto_page(id(wakeup_page_name).state.c_str());
//if (id(current_page).state == "screensaver" and page == "screensaver") id(disp1).goto_page(id(wakeup_page_name).state.c_str());
- if:
condition:
- lambda: !lambda return (timeout >= 1);
@@ -1959,13 +1971,13 @@ script:
state: 'climate'
then:
- lambda: |-
ESP_LOGD("script.set_climate", "climateslider.maxval=%i", total_steps);
ESP_LOGD("script.set_climate", "temp_offset=%i", temp_offset);
ESP_LOGD("script.set_climate", "temp_step=%i", temp_step);
ESP_LOGD("script.set_climate", "current_temp=%f", current_temp);
ESP_LOGD("script.set_climate", "target_temp=%f", target_temp);
ESP_LOGD("script.set_climate", "target_icon=%s", climate_icon.c_str());
ESP_LOGD("script.set_climate", "embedded=%i", (embedded_climate) ? 1 : 0);
ESP_LOGV("script.set_climate", "climateslider.maxval=%i", total_steps);
ESP_LOGV("script.set_climate", "temp_offset=%i", temp_offset);
ESP_LOGV("script.set_climate", "temp_step=%i", temp_step);
ESP_LOGV("script.set_climate", "current_temp=%f", current_temp);
ESP_LOGV("script.set_climate", "target_temp=%f", target_temp);
ESP_LOGV("script.set_climate", "target_icon=%s", climate_icon.c_str());
ESP_LOGV("script.set_climate", "embedded=%i", (embedded_climate) ? 1 : 0);
id(addon_climate_set_climate).execute(embedded_climate);
id(disp1).send_command_printf("climateslider.maxval=%i", total_steps);
id(disp1).set_component_value("temp_offset", temp_offset);
@@ -1976,7 +1988,7 @@ script:
if (target_temp > -999)
{
float slider_val = round(((10*target_temp) - temp_offset) / temp_step);
ESP_LOGD("script.set_climate", "climateslider=%f", slider_val);
ESP_LOGV("script.set_climate", "climateslider=%f", slider_val);
id(disp1).set_component_value("climateslider", slider_val);
id(disp1).set_component_text_printf("target_temp", "%.1f°", target_temp);
id(disp1).set_component_text_printf("target_icon", "%s", climate_icon.c_str());
@@ -1995,7 +2007,7 @@ script:
id(disp1).hide_component("increase_temp");
}
id(disp1).set_component_value("embedded", (embedded_climate) ? 1 : 0);
- lambda: ESP_LOGD("script.set_climate", "Finished");
- lambda: ESP_LOGV("script.set_climate", "Finished");
- id: refresh_datetime
mode: restart
@@ -2185,7 +2197,7 @@ script:
ESP_LOGV("script.ha_button", "page: %s", page.c_str());
ESP_LOGV("script.ha_button", "component: %s", component.c_str());
ESP_LOGV("script.ha_button", "command: %s", command.c_str());
id(timer_reset_all).execute();
id(timer_reset_all).execute(page.c_str());
auto ha_event = new esphome::api::CustomAPIDevice();
ha_event->fire_homeassistant_event("esphome.nspanel_ha_blueprint",
{