diff --git a/nspanel_blueprint.yaml b/nspanel_blueprint.yaml index ce24270..e08dd3e 100644 --- a/nspanel_blueprint.yaml +++ b/nspanel_blueprint.yaml @@ -3580,6 +3580,7 @@ trigger_variables: nspaneltemp: 'sensor.{{ nspanel_name }}_temperature' switch_sleep_mode: 'switch.{{ nspanel_name }}_sleep_mode' thermostat_embedded: 'climate.{{ nspanel_name }}_thermostat' + detailed_entity: 'sensor.{{ nspanel_name }}_detailed_entity' ##### notification Trigger ##### notification_unread: 'switch.{{ nspanel_name }}_notification_unread' @@ -7529,7 +7530,7 @@ action: - service: '{{ nextion.command.value }}' data: component: confirm - value: '{{ confirm_value }}' + val: '{{ confirm_value }}' continue_on_error: true ###### Display page while other elements are still loading ##### - variables: @@ -7722,7 +7723,7 @@ action: - service: '{{ nextion.command.value }}' data: component: light.lightslider - value: '{{ curr_brightness }}' + val: '{{ curr_brightness }}' continue_on_error: true - *delay-default - service: '{{ nextion.command.text_printf }}' @@ -7768,7 +7769,7 @@ action: - service: '{{ nextion.command.value }}' data: component: light.tempslider - value: '{{ curr_color_temp }}' + val: '{{ curr_color_temp }}' continue_on_error: true - *delay-default - service: '{{ nextion.command.printf }}' @@ -7820,7 +7821,7 @@ action: - service: '{{ nextion.command.value }}' data: component: cover.coverslider - value: '{{ (state_attr(cover_entity, "current_position") | int ) | round(0) }}' + val: '{{ (state_attr(cover_entity, "current_position") | int ) | round(0) }}' continue_on_error: true - *delay-default - service: '{{ nextion.command.text_printf }}' @@ -7905,7 +7906,7 @@ action: - service: '{{ nextion.command.value }}' data: component: fanslider - value: '{{ ((fan.percentage / 100) * fan.steps) | round(0) | int(0) }}' + val: '{{ ((fan.percentage / 100) * fan.steps) | round(0) | int(0) }}' continue_on_error: true - *delay-default - service: '{{ nextion.command.printf }}' @@ -9222,7 +9223,7 @@ action: - condition: or conditions: - '{{ page.current in page.buttonpages }}' - - '{{ page.current in [page.light, page.cover, page.climate, page.fan, page.alarm] }}' + - '{{ page.current in [page.light, page.cover, page.climate, page.fan, page.alarm] and trigger.entity_id == states(detailed_entity) }}' sequence: - choose: - alias: "Button pages" @@ -9338,6 +9339,7 @@ action: - if: - '{{ trigger.event.data.new_state.state not in ["unavailable", "unknown", "", None] }}' - '{{ page.current == page.climate }}' + - '{{ trigger.event.data.entity_id == states(detailed_entity) }}' then: - variables: climate_entity: '{{ trigger.event.data.entity_id }}' diff --git a/nspanel_esphome_addon_climate_base.yaml b/nspanel_esphome_addon_climate_base.yaml index 88fc863..2bf121d 100644 --- a/nspanel_esphome_addon_climate_base.yaml +++ b/nspanel_esphome_addon_climate_base.yaml @@ -70,7 +70,7 @@ script: then: - lambda: |- // Update home.climate_entity variable - detailed_entity_id->publish_state((id(is_embedded_thermostat)) ? "embedded_climate" : ""); + detailed_entity->publish_state((id(is_embedded_thermostat)) ? "embedded_climate" : ""); disp1->set_component_value("climate.embedded", (id(is_embedded_thermostat)) ? 1 : 0); // Update chips if (id(is_embedded_thermostat)) diff --git a/nspanel_esphome_core.yaml b/nspanel_esphome_core.yaml index 1f49444..58055dd 100644 --- a/nspanel_esphome_core.yaml +++ b/nspanel_esphome_core.yaml @@ -138,7 +138,7 @@ api: // Is page Alarm visible? if (current_page->state == "alarm") // To do: This page constructor should be moved to Blueprint { // Update alarm page - detailed_entity_id->publish_state(entity); + detailed_entity->publish_state(entity); // Alarm page - Header update_alarm_icon->execute("icon_state", state.c_str()); @@ -418,7 +418,7 @@ api: back_page: string then: - lambda: |- - detailed_entity_id->publish_state(entity); + detailed_entity->publish_state(entity); std::string cmd_page = std::string("page ") + page.c_str(); disp1->send_command_printf(cmd_page.c_str()); disp1->set_component_text_printf("page_label", "%s", page_label.c_str()); @@ -460,7 +460,7 @@ api: entity: string then: - lambda: |- - if (current_page->state == "climate") detailed_entity_id->publish_state(entity); + if (current_page->state == "climate") detailed_entity->publish_state(entity); - script.execute: id: set_climate @@ -604,7 +604,7 @@ api: - lambda: |- if (current_page->state == "media_player") { - detailed_entity_id->publish_state(entity); + detailed_entity->publish_state(entity); disp1->set_component_text_printf("page_label", "%s", friendly_name.c_str()); display_wrapped_text->execute("track", media_title.c_str(), id(display_mode) == 2 ? 16 : 27); display_wrapped_text->execute("artist", media_artist.c_str(), id(display_mode) == 2 ? 26 : 40); @@ -1288,7 +1288,7 @@ text_sensor: ##### Entity Id of the entity displayed on the detailed pages - name: ${device_name} Detailed Entity - id: detailed_entity_id + id: detailed_entity platform: template icon: mdi:tablet-dashboard internal: false @@ -1348,7 +1348,7 @@ text_sensor: std::string component = doc["component"]; if (not (component == "currentpage" and (page == "screensaver" or page == "home"))) timer_reset_all->execute(page.c_str()); std::string value = doc["value"]; - std::string entity = detailed_entity_id->state.c_str(); //doc["entity"]; + std::string entity = detailed_entity->state.c_str(); //doc["entity"]; ESP_LOGE(TAG, "page: %s", page.c_str()); ESP_LOGE(TAG, "component: %s", component.c_str()); ESP_LOGE(TAG, "value: %s", value.c_str()); @@ -1386,7 +1386,7 @@ text_sensor: std::string component = doc["component"]; std::string key = doc["key"]; std::string value = doc["value"]; - std::string entity = detailed_entity_id->state.c_str(); //doc["entity"]; + std::string entity = detailed_entity->state.c_str(); //doc["entity"]; int embedded = doc["embedded"]; std::string service = ""; @@ -1397,7 +1397,7 @@ text_sensor: { if (page == "home" and component == "climate") { - detailed_entity_id->publish_state((id(is_embedded_thermostat)) ? "embedded_climate" : ""); + detailed_entity->publish_state((id(is_embedded_thermostat)) ? "embedded_climate" : ""); disp1->set_component_value("climate.embedded", (id(is_embedded_thermostat)) ? 1 : 0); } disp1->goto_page("climate"); @@ -2070,7 +2070,7 @@ script: page != "media_player" && page != "confirm" && page != "keyb_num") { - detailed_entity_id->publish_state(""); + detailed_entity->publish_state(""); } if (page != "media_player") { id(last_volume_level) = 0; @@ -2080,7 +2080,7 @@ script: // Report new page to logs ESP_LOGD(TAG, "New page: %s", page.c_str()); - if (!detailed_entity_id->state.empty()) ESP_LOGD(TAG, "Entity shown: %s", detailed_entity_id->state.c_str()); + if (!detailed_entity->state.empty()) ESP_LOGD(TAG, "Entity shown: %s", detailed_entity->state.c_str()); // Reset timers timer_reset_all->execute(page.c_str()); @@ -2092,12 +2092,12 @@ script: { {"type", "page_changed"}, {"page", page.c_str()}, - {"entity", detailed_entity_id->state.c_str()} + {"entity", detailed_entity->state.c_str()} }); // Report new page to add-ons ESP_LOGV(TAG, "Call add-ons scripts for new page"); - addon_climate_set_climate->execute(page == "climate" and detailed_entity_id->state == "embedded_climate"); + addon_climate_set_climate->execute(page == "climate" and detailed_entity->state == "embedded_climate"); // Call page constructor if (page == "boot") page_boot->execute(true);