Enable users select alignment for entity values (#753)

* Enable users select alignment for entity values

Users will be able to select the alignment for the column with values on the entity pages.
The options are:
- Right (default)
- Center
- Left

solves #732

* Add support to `xcen` on `set_entity`
This commit is contained in:
Edward Firmo
2023-05-22 13:56:34 +02:00
committed by GitHub
parent 3a5f562c20
commit 1a46c85e6e
2 changed files with 32 additions and 0 deletions

View File

@@ -410,6 +410,7 @@ api:
ent_icon: string
ent_label: string
ent_value: string
ent_value_xcen: string
then:
- wait_until:
binary_sensor.is_on: nextion_init
@@ -417,12 +418,16 @@ api:
// 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");
std::string entxcen = ent_id.c_str() + std::string(".xcen=") + ent_value_xcen.c_str();
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());
if (strcmp(ent_value_xcen.c_str(), "0") != 0) {
id(disp1).send_command_printf("%s", entxcen.c_str());
}
##### START - GLOBALS CONFIGURATION #####
globals: