diff --git a/esphome/nspanel_esphome_addon_upload_tft.yaml b/esphome/nspanel_esphome_addon_upload_tft.yaml index 8cadca6..13a5095 100644 --- a/esphome/nspanel_esphome_addon_upload_tft.yaml +++ b/esphome/nspanel_esphome_addon_upload_tft.yaml @@ -187,6 +187,17 @@ script: condition: - lambda: return (current_page->state == "confirm"); timeout: 2s + - script.execute: + id: report_upload_progress + message: "Set Nextion unavailable for blueprint calls" + - script.wait: report_upload_progress + - binary_sensor.template.publish: + id: nextion_init + state: false + - script.execute: + id: report_upload_progress + message: "Preparing for upload..." + - script.wait: report_upload_progress # Then start the upload - lambda: |- static const char *const TAG = "addon_upload_tft.script.upload_tft"; @@ -235,13 +246,6 @@ script: condition: - lambda: return (current_page->state == "confirm"); timeout: 2s - - script.execute: - id: report_upload_progress - message: "Set Nextion unavailable for blueprint calls" - - script.wait: report_upload_progress - - binary_sensor.template.publish: - id: nextion_init - state: false - script.execute: id: report_upload_progress message: "Stopping other scripts" diff --git a/esphome/nspanel_esphome_core.yaml b/esphome/nspanel_esphome_core.yaml index 3b5922b..22067b2 100644 --- a/esphome/nspanel_esphome_core.yaml +++ b/esphome/nspanel_esphome_core.yaml @@ -1295,7 +1295,7 @@ binary_sensor: entity_category: diagnostic icon: mdi:tablet-dashboard lambda: |- - return disp1->is_setup(); + return (!id(is_uploading_tft) and disp1->is_setup()); ##### START - BUTTON CONFIGURATION ##### button: @@ -3304,7 +3304,7 @@ script: ESP_LOGI(TAG, " Queue size: %d", tf_uart->available()); // Report Nextion status - nextion_init->publish_state(nextion_init->state and disp1->is_setup()); + nextion_init->publish_state(!id(is_uploading_tft) and nextion_init->state and disp1->is_setup()); ESP_LOGI(TAG, "Nextion:"); ESP_LOGI(TAG, " Queue size: %d", disp1->queue_size()); if (disp1->is_setup()) diff --git a/nspanel_blueprint.yaml b/nspanel_blueprint.yaml index 424e7e1..f7cfdf7 100644 --- a/nspanel_blueprint.yaml +++ b/nspanel_blueprint.yaml @@ -3801,13 +3801,6 @@ trigger_variables: if nspanel_entities | selectattr(None, "search", "sensor.*_current_page") | list | count > 0 else ("sensor." ~ device_name ~ "_current_page") }} - detailed_entity: > - {{ - nspanel_entities | selectattr(None, "search", "sensor.*_detailed_entity") | list | last - if nspanel_entities | selectattr(None, "search", "sensor.*_detailed_entity") | list | count > 0 - else ("sensor." ~ device_name ~ "_detailed_entity") - }} - nspaneltemp: > {{ nspanel_entities | selectattr(None, "search", "sensor.*_temperature") | list | last @@ -3879,6 +3872,20 @@ variables: }} embedded_indoor_temperature: '{{ indoor_temperature_sensor == nspaneltemp }}' + nextion_display_sensor: > + {{ + nspanel_entities | selectattr(None, "search", "sensor.*_nextion_display") | list | last + if nspanel_entities | selectattr(None, "search", "sensor.*_nextion_display") | list | count > 0 + else ("sensor." ~ device_name ~ "_nextion_display") + }} + + detailed_entity: > + {{ + nspanel_entities | selectattr(None, "search", "sensor.*_detailed_entity") | list | last + if nspanel_entities | selectattr(None, "search", "sensor.*_detailed_entity") | list | count > 0 + else ("sensor." ~ device_name ~ "_detailed_entity") + }} + # yamllint disable rule:indentation rule:comments-indentation trigger: ##### Trigger - General ################################################################################################################# @@ -4657,7 +4664,11 @@ trigger: # yamllint disable rule:line-length condition: - - '{{ trigger.id in ["automation_reloaded", "ha_started", "nspanel_event"] or has_value(device_name_sensor) }}' + - > # Trigger is coming from panel's event or Nextion display must be connected + {{ + trigger.id in ["automation_reloaded", "ha_started", "nspanel_event"] or + (states(nextion_display_sensor) | default(false) and has_value(device_name_sensor)) + }} - > # Update page Home only when visible or home_page_background_update is enabled {{ trigger.id not in ["home_values_state", "trigger_chip_state"] or