@@ -2383,6 +2383,7 @@ variables:
|
|||||||
show_all: "esphome.{{ nspanel_name }}_send_command_show_all"
|
show_all: "esphome.{{ nspanel_name }}_send_command_show_all"
|
||||||
tft_upload: "esphome.{{ nspanel_name }}_upload_tft"
|
tft_upload: "esphome.{{ nspanel_name }}_upload_tft"
|
||||||
set_button: "esphome.{{ nspanel_name }}_set_button"
|
set_button: "esphome.{{ nspanel_name }}_set_button"
|
||||||
|
set_entity: "esphome.{{ nspanel_name }}_set_entity"
|
||||||
icons:
|
icons:
|
||||||
battery: "\U0000F2A1" #F2A1
|
battery: "\U0000F2A1" #F2A1
|
||||||
blank: "\U0000FFFF" #blank macbook bug
|
blank: "\U0000FFFF" #blank macbook bug
|
||||||
@@ -4815,30 +4816,18 @@ action:
|
|||||||
{% if repeat.item.icon is string and repeat.item.icon | length > 0 %}{{ nextion.icons.all[repeat.item.icon.split(':')[1]] | default(repeat.item.icon) }}
|
{% if repeat.item.icon is string and repeat.item.icon | length > 0 %}{{ nextion.icons.all[repeat.item.icon.split(':')[1]] | default(repeat.item.icon) }}
|
||||||
{% elif state_attr(repeat.item.entity, 'icon') | default('') not in ['unavailable', 'unknown', '', None] %}{{ nextion.icons.all[state_attr(repeat.item.entity, 'icon').split(':')[1]] | default(None) }}
|
{% elif state_attr(repeat.item.entity, 'icon') | default('') not in ['unavailable', 'unknown', '', None] %}{{ nextion.icons.all[state_attr(repeat.item.entity, 'icon').split(':')[1]] | default(None) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
- if: "{{ repeat_item_icon is string and repeat_item_icon | length > 0 }}"
|
- service: "{{ nextion.commands.set_entity }}"
|
||||||
then:
|
|
||||||
- *delay-default
|
|
||||||
- service: "{{ nextion.commands.text_printf }}"
|
|
||||||
data:
|
|
||||||
component: "{{ repeat.item.component }}_pic"
|
|
||||||
message: "{{ repeat_item_icon }}"
|
|
||||||
continue_on_error: true
|
|
||||||
- *delay-default
|
|
||||||
- service: "{{ nextion.commands.text_printf }}"
|
|
||||||
data:
|
data:
|
||||||
component: "{{ repeat.item.component }}_label"
|
ent_id: "{{ repeat.item.component }}"
|
||||||
message: >-
|
ent_icon: "{{ repeat_item_icon }}"
|
||||||
|
ent_label: >-
|
||||||
{%- if repeat.item.name | length > 0 -%} {{ repeat.item.name }}
|
{%- if repeat.item.name | length > 0 -%} {{ repeat.item.name }}
|
||||||
{%- elif repeat_item_state in ['unavailable', 'unknown', None] -%} {{ repeat.item.entity }}
|
{%- elif repeat_item_state in ['unavailable', 'unknown', None] -%} {{ repeat.item.entity }}
|
||||||
{%- else -%} {{ state_attr(repeat.item.entity, 'friendly_name') | default(mui[language].no_name) }}
|
{%- else -%} {{ state_attr(repeat.item.entity, 'friendly_name') | default(mui[language].no_name) }}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
ent_value: "{{ repeat_item_state ~ ((state_attr(repeat.item.entity, 'unit_of_measurement') | default('')) if state_attr(repeat.item.entity, 'unit_of_measurement') else '') }}"
|
||||||
continue_on_error: true
|
continue_on_error: true
|
||||||
- *delay-default
|
|
||||||
- service: "{{ nextion.commands.text_printf }}"
|
|
||||||
data:
|
|
||||||
component: "{{ repeat.item.component }}"
|
|
||||||
message: "{{ repeat_item_state ~ ((state_attr(repeat.item.entity, 'unit_of_measurement') | default('')) if state_attr(repeat.item.entity, 'unit_of_measurement') else '') }}"
|
|
||||||
continue_on_error: true
|
|
||||||
|
|
||||||
## PAGE CLIMATE ##
|
## PAGE CLIMATE ##
|
||||||
- alias: Climate page
|
- alias: Climate page
|
||||||
|
|||||||
@@ -355,6 +355,26 @@ api:
|
|||||||
} else {
|
} else {
|
||||||
id(disp1).set_component_text_printf(btnbri.c_str(), " ");
|
id(disp1).set_component_text_printf(btnbri.c_str(), " ");
|
||||||
}
|
}
|
||||||
|
#### Service to set the entities ####
|
||||||
|
- service: set_entity
|
||||||
|
variables:
|
||||||
|
ent_id: string
|
||||||
|
ent_icon: string
|
||||||
|
ent_label: string
|
||||||
|
ent_value: string
|
||||||
|
then:
|
||||||
|
- wait_until:
|
||||||
|
switch.is_on: nextion_init
|
||||||
|
- lambda: |-
|
||||||
|
// ESP_LOGD("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");
|
||||||
|
id(disp1).set_component_text_printf(enticon.c_str(), "%s", ent_icon.c_str());
|
||||||
|
if (strcmp(ent_icon.c_str(), "0") != 0) {
|
||||||
|
id(disp1).set_component_text_printf(enticon.c_str(), "%s", ent_icon.c_str());
|
||||||
|
}
|
||||||
|
id(disp1).set_component_text_printf(entlabel.c_str(), "%s", ent_label.c_str());
|
||||||
|
id(disp1).set_component_text_printf(ent_id.c_str(), "%s", ent_value.c_str());
|
||||||
|
|
||||||
##### START - GLOBALS CONFIGURATION #####
|
##### START - GLOBALS CONFIGURATION #####
|
||||||
globals:
|
globals:
|
||||||
|
|||||||
Reference in New Issue
Block a user