diff --git a/nspanel_esphome.yaml b/nspanel_esphome.yaml index 764a129..ced9245 100644 --- a/nspanel_esphome.yaml +++ b/nspanel_esphome.yaml @@ -6,12 +6,9 @@ ##################################################################################################### substitutions: - # Defaults - verbose_log: "false" ##### DON'T CHANGE THIS ##### version: "4.0" - addon_climate: "false" ############################# ##### WIFI SETUP ##### @@ -84,7 +81,7 @@ time: id: refresh_datetime on_time_sync: then: - - logger.log: "Synchronized system clock" + - logger.log: "System clock synchronized" - script.execute: id: refresh_datetime @@ -319,16 +316,13 @@ api: embedded_climate: bool then: - lambda: |- - if (${verbose_log}) - { - 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); - script.execute: id: set_climate @@ -356,7 +350,7 @@ api: - wait_until: binary_sensor.is_on: nextion_init - lambda: |- - // ESP_LOGD("nextion", "set button %s", btn_id.c_str()); + // ESP_LOGV("nextion", "set button %s", btn_id.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"); @@ -419,7 +413,7 @@ api: - wait_until: binary_sensor.is_on: nextion_init - lambda: |- - // ESP_LOGD("nextion", "set entity %s", ent_id.c_str()); + // ESP_LOGV("nextion", "set 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(); @@ -448,26 +442,22 @@ api: embedded_climate: bool wakeup_page: int then: - ## Logs - - lambda: if (${verbose_log}) ESP_LOGD("service.global_settings", "Starting"); - lambda: |- - if (${verbose_log}) - { - ESP_LOGD("service.global_settings", "relay1_local_control: %i", (relay1_local_control) ? 1 : 0); - ESP_LOGD("service.global_settings", "relay1_icon: %s", relay1_icon.c_str()); - ESP_LOGD("service.global_settings", "relay1_icon_color: %i", relay1_icon_color); - ESP_LOGD("service.global_settings", "relay2_local_control: %i", (relay2_local_control) ? 1 : 0); - ESP_LOGD("service.global_settings", "relay2_icon: %s", relay2_icon.c_str()); - ESP_LOGD("service.global_settings", "relay2_icon_color: %i", relay2_icon_color); - ESP_LOGD("service.global_settings", "date_color: %i", date_color); - ESP_LOGD("service.global_settings", "time_format: %s", time_format.c_str()); - 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); - } + // Logs - Begin + ESP_LOGV("service.global_settings", "Starting"); + 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_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_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); + ESP_LOGV("service.global_settings", "embedded_climate: %i", (embedded_climate) ? 1 : 0); + ESP_LOGV("service.global_settings", "wakeup_page: %i", wakeup_page); - ## Relays - - lambda: |- + // Relays id(relay1_local).publish_state(relay1_local_control); id(relay2_local).publish_state(relay2_local_control); id(home_relay1_icon) = relay1_icon.c_str(); @@ -475,36 +465,30 @@ api: id(home_relay1_icon_color) = relay1_icon_color; id(home_relay2_icon_color) = relay2_icon_color; - ## Localization - - lambda: id(mui_time_format) = time_format; + // Localization + id(mui_time_format) = time_format; - ## Date/Time colors - - lambda: |- + // Date/Time colors id(home_date_color) = date_color; id(home_time_color) = time_color; - ## Embedded thermostat - - script.execute: - id: addon_climate_global_settings - embedded_climate: !lambda return embedded_climate; - #- lambda: id(is_embedded_thermostat) = embedded_climate; + // Embedded thermostat + id(addon_climate_global_settings)->execute(embedded_climate); - ## Wakeup page - - lambda: |- - if (${verbose_log}) ESP_LOGD("service.global_settings", "Wakeup page - Start"); + // Wakeup page + ESP_LOGV("service.global_settings", "Wakeup page - Start"); id(wakeup_page_id) = wakeup_page; - ## Refresh colors of global components - #- lambda: if (${verbose_log}) ESP_LOGD("service.global_settings", "Refresh colors of global components"); - #- script.execute: - # id: refresh_colors + // Refresh colors of global components + ESP_LOGV("service.global_settings", "Refresh colors of global components"); + id(refresh_colors).execute; - ## Update home page - - lambda: if (${verbose_log}) ESP_LOGD("service.global_settings", "Update home page"); - - script.execute: - id: update_page_home + // Update home page + ESP_LOGV("service.global_settings", "Update home page"); + id(update_page_home).execute; - - lambda: if (${verbose_log}) ESP_LOGD("service.global_settings", "Finished"); + // Logs - End + ESP_LOGV("service.global_settings", "Finished"); #### Service to populate the page Home ##### - service: page_home_settings @@ -517,40 +501,36 @@ api: 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"); + // Logs - Begin + ESP_LOGV("service.page_home_settings", "Starting"); + ESP_LOGV("service.page_home_settings", "qrcode: %i", (qrcode) ? 1 : 0); + ESP_LOGV("service.page_home_settings", "qrcode_icon: %s", qrcode_icon.c_str()); + ESP_LOGV("service.page_home_settings", "qrcode_icon_color: %i", qrcode_icon_color); + ESP_LOGV("service.page_home_settings", "entities_pages: %i", (entities_pages) ? 1 : 0); + ESP_LOGV("service.page_home_settings", "entities_pages_icon: %s", entities_pages_icon.c_str()); + ESP_LOGV("service.page_home_settings", "entities_pages_icon_color: %i", entities_pages_icon_color); + ESP_LOGV("service.page_home_settings", "alarm_state: %s", alarm_state.c_str()); + + // QRCode button + ESP_LOGV("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"); + // Entities pages button + ESP_LOGV("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"); + // Alarm button + ESP_LOGV("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"); + // Logs - End + ESP_LOGV("service.page_home_settings", "Finished"); #### Service to populate the alarm settings page ##### - service: alarm_settings @@ -564,32 +544,24 @@ api: mui_alarm: string[] #std::vector #std::map then: - lambda: |- - // log - if (${verbose_log}) - { - ESP_LOGD("service.alarm_settings", "Starting"); - ESP_LOGD("service.alarm_settings", "page_title: %s", page_title.c_str()); - ESP_LOGD("service.alarm_settings", "state: %s", state.c_str()); - ESP_LOGD("service.alarm_settings", "supported_features: %i", supported_features); - ESP_LOGD("service.alarm_settings", "code_format: %s", code_format.c_str()); - ESP_LOGD("service.alarm_settings", "code_arm_required: %i", (code_arm_required) ? 1 : 0); - ESP_LOGD("service.alarm_settings", "entity: %s", entity.c_str()); - } + // Logs - Begin + ESP_LOGV("service.alarm_settings", "Starting"); + ESP_LOGV("service.alarm_settings", "page_title: %s", page_title.c_str()); + ESP_LOGV("service.alarm_settings", "state: %s", state.c_str()); + ESP_LOGV("service.alarm_settings", "supported_features: %i", supported_features); + ESP_LOGV("service.alarm_settings", "code_format: %s", code_format.c_str()); + ESP_LOGV("service.alarm_settings", "code_arm_required: %i", (code_arm_required) ? 1 : 0); + ESP_LOGV("service.alarm_settings", "entity: %s", entity.c_str()); // set alarm icon on home page - if (${verbose_log}) ESP_LOGD("service.alarm_settings", "Updating home page icon"); + ESP_LOGV("service.alarm_settings", "Updating home page icon"); id(disp1).send_command_printf("is_alarm=%i", (state=="" or state.empty()) ? 0 : 1); id(update_alarm_icon)->execute("home.bt_alarm", state.c_str()); - ## Update alarm page - - if: - condition: - - text_sensor.state: # Is alarm page visible? - id: current_page - state: 'alarm' - then: - - lambda: |- - if (${verbose_log}) ESP_LOGD("service.alarm_settings", "Updating alarm page"); + // Is page Alarm visible? + if (id(current_page).state=="alarm") + { // Update alarm page + ESP_LOGV("service.alarm_settings", "Updating alarm page"); // Alarm page - Header id(update_alarm_icon)->execute("icon_state", state.c_str()); id(disp1).set_component_text_printf("page_label", "%s", page_title.c_str()); @@ -668,7 +640,10 @@ api: id(disp1).set_component_font_color("bt_disarm_icon", (state=="disarmed") ? 65535 : 0); if (state=="disarmed") id(disp1).hide_component("bt_disarm"); else id(disp1).show_component("bt_disarm"); } - - lambda: if (${verbose_log}) ESP_LOGD("service.alarm_settings", "Finished"); + } + + // Logs - End + ESP_LOGV("service.alarm_settings", "Finished"); ##### START - GLOBALS CONFIGURATION ##### globals: @@ -1038,14 +1013,11 @@ text_sensor: std::string entity = doc["entity"]; int embedded = doc["embedded"]; std::string service = ""; - if (${verbose_log}) - { - ESP_LOGD("text_sensor.localevent", "domain=%s", domain.c_str()); - ESP_LOGD("text_sensor.localevent", "key=%s", key.c_str()); - ESP_LOGD("text_sensor.localevent", "value=%s", value.c_str()); - ESP_LOGD("text_sensor.localevent", "entity=%s", entity.c_str()); - ESP_LOGD("text_sensor.localevent", "embedded=%i", embedded); - } + ESP_LOGV("text_sensor.localevent", "domain=%s", domain.c_str()); + ESP_LOGV("text_sensor.localevent", "key=%s", key.c_str()); + ESP_LOGV("text_sensor.localevent", "value=%s", value.c_str()); + ESP_LOGV("text_sensor.localevent", "entity=%s", entity.c_str()); + ESP_LOGV("text_sensor.localevent", "embedded=%i", embedded); if (domain == "climate") id(service_call_climate)->execute(entity.c_str(), key.c_str(), value.c_str(), (embedded==1)); else if (domain == "alarm") { @@ -1366,7 +1338,7 @@ script: parameters: delay: int then: - - lambda: if (${verbose_log}) ESP_LOGD("script.page_timer", "start page-timer delay %i", int(id(page_timeout).state)); + - lambda: ESP_LOGV("script.page_timer", "start page-timer delay %i", int(id(page_timeout).state)); - delay: !lambda return delay *1000; - lambda: |- DynamicJsonDocument doc(1024); @@ -1374,11 +1346,11 @@ script: std::string page = doc["page"]; if (page == "home" or page == "screensaver" or page == "boot" or int(id(page_timeout).state) == 0) { - if (${verbose_log}) ESP_LOGD("script.page_timer", "no page-jump"); + ESP_LOGD("script.page_timer", "no page-jump"); } else { - if (${verbose_log}) ESP_LOGD("script.page_timer", "timer->home"); + ESP_LOGD("script.page_timer", "timer->home"); id(disp1).send_command_printf("page 0"); } @@ -1401,16 +1373,13 @@ script: state: 'climate' then: - lambda: |- - if (${verbose_log}) - { - 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); @@ -1421,7 +1390,7 @@ script: if (target_temp > -999) { float slider_val = round(((10*target_temp) - temp_offset) / temp_step); - if (${verbose_log}) 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()); @@ -1444,90 +1413,66 @@ script: - id: refresh_colors ## Refresh colors of global components mode: restart then: - - if: - condition: - - binary_sensor.is_on: nextion_init - #- text_sensor.state: # Is home page visible? - # id: current_page - # state: 'home' - then: - - lambda: |- - id(disp1).set_component_font_color("home.date", id(home_date_color)); - id(disp1).set_component_font_color("home.time", id(home_time_color)); - id(disp1).set_component_font_color("home.icon_top_01", id(home_relay1_icon_color)); - id(disp1).set_component_font_color("home.icon_top_02", id(home_relay2_icon_color)); + - lambda: |- + id(disp1).set_component_font_color("home.date", id(home_date_color)); + id(disp1).set_component_font_color("home.time", id(home_time_color)); + id(disp1).set_component_font_color("home.icon_top_01", id(home_relay1_icon_color)); + id(disp1).set_component_font_color("home.icon_top_02", id(home_relay2_icon_color)); - id: refresh_datetime mode: restart then: - - lambda: if (${verbose_log}) ESP_LOGD("script.refresh_datetime", "Starting"); - - if: - condition: - - binary_sensor.is_on: nextion_init - #- text_sensor.state: # Is home page visible? - # id: current_page - # state: 'home' - then: - - lambda: |- - std::string time_format_str = id(mui_time_format); - if (time_format_str.find("%p") != std::string::npos) + - lambda: |- + ESP_LOGV("script.refresh_datetime", "Starting"); + std::string time_format_str = id(mui_time_format); + if (time_format_str.find("%p") != std::string::npos) + { + std::string meridiem_text = id(time_provider).now().strftime("%p"); + id(disp1).set_component_text_printf("home.meridiem", "%s", meridiem_text.c_str()); + } + else { id(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("%-I") != std::string::npos) + { + if (id(time_provider).now().hour>12) { - std::string meridiem_text = id(time_provider).now().strftime("%p"); - id(disp1).set_component_text_printf("home.meridiem", "%s", meridiem_text.c_str()); + 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 { id(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("%-I") != std::string::npos) + else if (id(time_provider).now().hour==0) { - 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))); - } - else if (id(time_provider).now().hour==0) - { - time_format_str = time_format_str.replace(time_format_str.find("%-I"), sizeof("%-I")-1, "12"); - } - 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, "12"); } - std::string time_text = id(time_provider).now().strftime(time_format_str); - id(disp1).set_component_text_printf("home.time", "%s", time_text.c_str()); - - lambda: if (${verbose_log}) ESP_LOGD("script.refresh_datetime", "Finished"); + else + { + 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); + id(disp1).set_component_text_printf("home.time", "%s", time_text.c_str()); + ESP_LOGV("script.refresh_datetime", "Finished"); - id: refresh_relays mode: restart then: - - lambda: if (${verbose_log}) ESP_LOGD("script.refresh_relays", "Starting"); - - if: - condition: - - binary_sensor.is_on: nextion_init - #- text_sensor.state: # Is home page visible? - # id: current_page - # state: 'home' - then: - - lambda: |- - // Chips - Relays - if (id(relay_1).state) id(disp1).set_component_text_printf("home.icon_top_01", "%s", id(home_relay1_icon).c_str()); - else id(disp1).set_component_text_printf("icon_top_01", "\uFFFF"); - if (id(relay_2).state) id(disp1).set_component_text_printf("home.icon_top_02", "%s", id(home_relay2_icon).c_str()); - else id(disp1).set_component_text_printf("home.icon_top_02", "\uFFFF"); - // Hardware buttons - Fallback mode - if (id(relay_1).state and (id(relay1_local).state or (id(relay1_fallback).state and not id(api_status).state))) id(disp1).send_command_printf("home.left_bt_pic.pic=%i", (id(relay_1).state) ? 78 : 77); - if (id(relay_2).state and (id(relay2_local).state or (id(relay2_fallback).state and not id(api_status).state))) id(disp1).send_command_printf("home.right_bt_pic.pic=%i", (id(relay_2).state) ? 78 : 77); - - lambda: if (${verbose_log}) ESP_LOGD("script.refresh_relays", "Finished"); + - lambda: |- + ESP_LOGV("script.refresh_relays", "Starting"); + // Chips - Relays + if (id(relay_1).state) id(disp1).set_component_text_printf("home.icon_top_01", "%s", id(home_relay1_icon).c_str()); + else id(disp1).set_component_text_printf("icon_top_01", "\uFFFF"); + if (id(relay_2).state) id(disp1).set_component_text_printf("home.icon_top_02", "%s", id(home_relay2_icon).c_str()); + else id(disp1).set_component_text_printf("home.icon_top_02", "\uFFFF"); + // Hardware buttons - Fallback mode + if (id(relay_1).state and (id(relay1_local).state or (id(relay1_fallback).state and not id(api_status).state))) id(disp1).send_command_printf("home.left_bt_pic.pic=%i", (id(relay_1).state) ? 78 : 77); + if (id(relay_2).state and (id(relay2_local).state or (id(relay2_fallback).state and not id(api_status).state))) id(disp1).send_command_printf("home.right_bt_pic.pic=%i", (id(relay_2).state) ? 78 : 77); + ESP_LOGV("script.refresh_relays", "Finished"); - id: refresh_wifi_icon mode: restart then: - - lambda: if (${verbose_log}) ESP_LOGD("script.refresh_wifi_icon", "Starting"); + - lambda: ESP_LOGV("script.refresh_wifi_icon", "Starting"); - if: condition: - binary_sensor.is_on: nextion_init - #- text_sensor.state: # Is home page visible? - # id: current_page - # state: 'home' then: # Update Wi-Fi icon - if: @@ -1549,12 +1494,12 @@ script: - lambda: id(disp1).send_command_printf("api=0"); - lambda: id(disp1).set_component_text_printf("home.wifi_icon", "%s", "\uE5A9"); - lambda: id(disp1).set_component_font_color("home.wifi_icon", 63488); - - lambda: if (${verbose_log}) ESP_LOGD("script.refresh_wifi_icon", "Finished"); + - lambda: ESP_LOGV("script.refresh_wifi_icon", "Finished"); - id: update_page_home mode: restart then: - - lambda: if (${verbose_log}) ESP_LOGD("script.update_page_home", "Starting"); + - lambda: ESP_LOGV("script.update_page_home", "Starting"); - if: condition: #- binary_sensor.is_on: nextion_init @@ -1566,7 +1511,7 @@ script: - script.execute: refresh_relays - script.execute: refresh_wifi_icon - script.execute: addon_climate_update_page_home - - lambda: if (${verbose_log}) ESP_LOGD("script.update_page_home", "Finished"); + - lambda: ESP_LOGV("script.update_page_home", "Finished"); - id: service_call_alarm_control_panel mode: restart @@ -1577,14 +1522,11 @@ script: pin: string then: - lambda: |- - if (${verbose_log}) - { - ESP_LOGD("service_call_alarm_control_panel", "ESPHome remote service call"); - ESP_LOGD("service_call_alarm_control_panel", "entity=%s", entity.c_str()); - ESP_LOGD("service_call_alarm_control_panel", "key=%s", key.c_str()); - ESP_LOGD("service_call_alarm_control_panel", "code_format=%s", code_format.c_str()); - ESP_LOGD("service_call_alarm_control_panel", "pin=%s", entity.c_str()); - } + ESP_LOGV("service_call_alarm_control_panel", "ESPHome remote service call"); + ESP_LOGV("service_call_alarm_control_panel", "entity=%s", entity.c_str()); + ESP_LOGV("service_call_alarm_control_panel", "key=%s", key.c_str()); + ESP_LOGV("service_call_alarm_control_panel", "code_format=%s", code_format.c_str()); + ESP_LOGV("service_call_alarm_control_panel", "pin=%s", entity.c_str()); std::string service = ""; if (key=="home") service = "alarm_control_panel.alarm_arm_home"; else if (key=="away") service = "alarm_control_panel.alarm_arm_away"; @@ -1592,10 +1534,10 @@ script: else if (key=="vacation") service = "alarm_control_panel.alarm_arm_vacation"; else if (key=="bypass") service = "alarm_control_panel.alarm_arm_custom_bypass"; else if (key=="disarm") service = "alarm_control_panel.alarm_disarm"; - if (${verbose_log}) ESP_LOGD("service_call_alarm_control_panel", "service=%s", service.c_str()); + ESP_LOGV("service_call_alarm_control_panel", "service=%s", service.c_str()); if (service != "" and not service.empty()) { - if (${verbose_log}) ESP_LOGD("service_call_alarm_control_panel", "ESPHome remote service call"); + ESP_LOGV("service_call_alarm_control_panel", "ESPHome remote service call"); HomeassistantServiceResponse resp; HomeassistantServiceMap resp_kv; resp.service = service.c_str(); @@ -1654,8 +1596,8 @@ script: component: string state: string then: - - logger.log: "script.update_alarm_icon: Starting" - lambda: |- + ESP_LOGV("script.update_alarm_icon", "Starting"); std::string alarm_icon = "\uEECC"; //mdi:shield-alert-outline int alarm_color = 65535; // Standard colors: @@ -1722,7 +1664,7 @@ script: } id(disp1).set_component_text_printf(component.c_str(), alarm_icon.c_str()); id(disp1).set_component_font_color(component.c_str(), alarm_color); - - logger.log: "script.update_alarm_icon: Finished" + ESP_LOGV("script.update_alarm_icon", "Finished"); ##### ADD-ONS ############################################################ ##### Add-on - Climate ##### @@ -1733,33 +1675,38 @@ script: value: string then: # Reserved for Add-on Climate - - lambda: if (${verbose_log}) ESP_LOGD("script.addon_climate_service_call", "Starting"); - - lambda: if (${verbose_log}) ESP_LOGD("script.addon_climate_service_call", "Finished"); + - lambda: |- + ESP_LOGV("script.addon_climate_service_call", "Starting"); + ESP_LOGV("script.addon_climate_service_call", "Finished"); - id: addon_climate_update_page_home mode: restart then: # Reserved for Add-on Climate - - lambda: if (${verbose_log}) ESP_LOGD("script.addon_climate_update_page_home", "Starting"); - - lambda: if (${verbose_log}) ESP_LOGD("script.addon_climate_update_page_home", "Finished"); + - lambda: |- + ESP_LOGV("script.addon_climate_update_page_home", "Starting"); + ESP_LOGV("script.addon_climate_update_page_home", "Finished"); - id: addon_climate_set_climate mode: restart parameters: embedded_climate: bool then: # Reserved for Add-on Climate - - lambda: if (${verbose_log}) ESP_LOGD("script.addon_climate_set_climate", "Starting"); - - lambda: if (${verbose_log}) ESP_LOGD("script.addon_climate_set_climate", "Finished"); + - lambda: |- + ESP_LOGV("script.addon_climate_set_climate", "Starting"); + ESP_LOGV("script.addon_climate_set_climate", "Finished"); - id: addon_climate_global_settings mode: restart parameters: embedded_climate: bool then: # Reserved for Add-on Climate - - lambda: if (${verbose_log}) ESP_LOGD("script.addon_climate_global_settings", "Starting"); - - lambda: if (${verbose_log}) ESP_LOGD("script.addon_climate_global_settings", "Finished"); + - lambda: |- + ESP_LOGV("script.addon_climate_global_settings", "Starting"); + ESP_LOGV("script.addon_climate_global_settings", "Finished"); - id: addon_climate_update_page_climate mode: restart then: # Reserved for Add-on Climate - - lambda: if (${verbose_log}) ESP_LOGD("script.addon_climate_update_page_climate", "Starting"); - - lambda: if (${verbose_log}) ESP_LOGD("script.addon_climate_update_page_climate", "Finished"); + - lambda: |- + ESP_LOGV("script.addon_climate_update_page_climate", "Starting"); + ESP_LOGV("script.addon_climate_update_page_climate", "Finished");