upd: set_entity-service
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user