upd: set_entity-service

This commit is contained in:
deejaybeam
2023-04-14 23:22:19 +02:00
parent 9d822e7ee9
commit 642a78364a
2 changed files with 27 additions and 18 deletions

View File

@@ -355,6 +355,26 @@ api:
} else {
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 #####
globals: