From fb7b477f5d0d29f10db302bd10a92fa4f10c5298 Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Thu, 29 Feb 2024 19:15:22 +0100 Subject: [PATCH] Handle empty items in ids --- esphome/nspanel_esphome_core.yaml | 4 ++-- nspanel_blueprint.yaml | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/esphome/nspanel_esphome_core.yaml b/esphome/nspanel_esphome_core.yaml index f980d98..74c28f8 100644 --- a/esphome/nspanel_esphome_core.yaml +++ b/esphome/nspanel_esphome_core.yaml @@ -247,8 +247,8 @@ api: visible: bool # Set to true to show the component, or false to hide it. then: - lambda: |- - if (!id(is_uploading_tft)) { - for (const std::string& component_id : ids) { + for (const std::string& component_id : ids) { + if (!id(is_uploading_tft) and !component_id.empty()) { set_component_visibility->execute(component_id.c_str(), visible); } } diff --git a/nspanel_blueprint.yaml b/nspanel_blueprint.yaml index 615c866..091adfe 100644 --- a/nspanel_blueprint.yaml +++ b/nspanel_blueprint.yaml @@ -9837,7 +9837,16 @@ action: else: - service: '{{ nspanel.service.component.visibility }}' data: - ids: '{{ [ repeat.item.name, repeat.item.name ~ "_value2", repeat.item.name ~ "_icon", repeat.item.name ~ "_label", repeat.item.name ~ "_line" ] }}' + ids: > + {{ + [ + repeat.item.name, + repeat.item.name ~ "_value2", + repeat.item.name ~ "_icon", + repeat.item.name ~ "_label", + repeat.item.name ~ "_line" if repeat.item.name not in ["home", "grid"] + ] + }} visible: false continue_on_error: true