diff --git a/esphome/nspanel_esphome_core.yaml b/esphome/nspanel_esphome_core.yaml index fa90abf..ca15f6d 100644 --- a/esphome/nspanel_esphome_core.yaml +++ b/esphome/nspanel_esphome_core.yaml @@ -468,8 +468,14 @@ api: visible: bool then: - lambda: |- - if (!id(is_uploading_tft)) { - // Do something + if (!id(is_uploading_tft) and !(id.empty())) { + if (!(icon.empty())) disp1->set_component_text_printf("%s_icon", id.c_str(), icon.c_str()); + if (icon_color.size() == 3) set_component_color->execute((id + "_icon").c_str(), icon_color); + if (visible) { + disp1->show_component(id.c_str()); + } else { + disp1->hide_component(id.c_str()); + } } # Init Global Service diff --git a/nspanel_blueprint.yaml b/nspanel_blueprint.yaml index ce44374..2542cbe 100644 --- a/nspanel_blueprint.yaml +++ b/nspanel_blueprint.yaml @@ -7340,10 +7340,10 @@ action: else "unavailable"] | default(1) }} continue_on_error: true + ##### NSPanel Outdoor Temp ##### - &refresh-page_home-outdoor_temp if: '{{ true }}' then: - ##### NSPanel Outdoor Temp ##### - variables: outdoor_temp_entity: !input 'outdoortemp' outdoor_temp_state: > @@ -7369,10 +7369,10 @@ action: value_color: !input home_outdoor_temp_label_color continue_on_error: true + ##### NSPanel Indoor Temp ##### - &refresh-page_home-indoor_temp if: '{{ true }}' then: - ##### NSPanel Indoor Temp ##### - variables: temperature_sensor: > {{ @@ -7478,33 +7478,20 @@ action: }} sequence: - &display_home_page_custom_buttons - if: '{{ repeat.item.entity is defined and repeat.item.entity is string and repeat.item.entity | length > 0 }}' + if: '{{ repeat.item.entity is defined and repeat.item.entity is string and repeat.item.entity.split(".") | count == 2 }}' then: - variables: entity_id: '{{ repeat.item.entity }}' overlap: icon: '{{ repeat.item.icon if repeat.item.icon is defined else None }}' - *variable_entity - - if: '{{ entity.icon_color is defined }}' - then: - - service: '{{ nspanel.service.component.color }}' - data: - id: 'home.{{ repeat.item.component }}' - color: '{{ entity.icon_color }}' - continue_on_error: true - - if: '{{ entity.icon is defined }}' - then: - - service: '{{ nspanel.service.component.text }}' - data: - id: 'home.{{ repeat.item.component }}' - txt: '{{ entity.icon }}' - continue_on_error: true - - if: '{{ page.current == page.home }}' - then: - - service: '{{ nspanel.service.component.show }}' - data: - id: '{{ repeat.item.component }}' - continue_on_error: true + - service: '{{ nspanel.service.icon }}' + data: + id: 'home.{{ repeat.item.component }}' + icon: '{{ entity.icon if entity.icon is defined else "" }}' + icon_color: '{{ entity.icon_color if entity.icon_color is defined else [] }}' + visible: '{{ page.current == page.home }}' + continue_on_error: true else: - if: '{{ page.current == page.home }}' then: