s00500 / ESPUI

A simple web user interface library for ESP32 and ESP8266

Home Page:https://valencia.lbsfilm.at/midterm-presentation/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Show or hide controls dynamically during runtime

AWSW-de opened this issue · comments

Hi,
how can you hide or show controls dynamically during runtime?

In my project it is possible to set e.g. the LED intensity with the ESPUI and in addition for smart home usage with the use of seperate web urls...
To be able to set the smart home controller as primary control of the device i use the global variable "set_web_intensity" and the internal ESPUI controls should be hidden and replaced with the below in the code named hint box, when the set_web_intensity is 1.

I had a look into the documenation and had a look into similar older questions here, but i don`t get it, how you can hide or show such controls dynamically...

Thanks for any hint to this in advance.

Kind regards :)

`
// Control intensity via web urls or via the internal web configuration:
if (set_web_intensity == 0) {
// Intensity DAY slider selector:
ESPUI.slider("Brightness during the day", &sliderBrightnessDay, ControlColor::Dark, intensity_day, 0, LEDintensityLIMIT);

// Use night mode function:
ESPUI.switcher("Use night mode to reduce brightness", &switchNightMode, ControlColor::Dark, usenightmode);

// Night mode status:
statusNightModeID = ESPUI.label("Night mode status", ControlColor::Dark, "Night mode not used");

// Intensity NIGHT slider selector: 
ESPUI.slider("Brightness at night", &sliderBrightnessNight, ControlColor::Dark, intensity_night, 0, LEDintensityLIMIT);

// Day mode start time:
ESPUI.number("Day time starts at", call_day_time_start, ControlColor::Dark, day_time_start, 0, 11);

// Day mode stop time:
ESPUI.number("Day time ends after", call_day_time_stop, ControlColor::Dark, day_time_stop, 12, 23);

} else {
// Show note when intensity is currently controlled via web-url usage and these internal settings get disabled:
ESPUI.label("Status:", ControlColor::Dark, "Manual intensity setting and Day/Night mode currently disabled due to the active intensity setting set via web URL.");
}
`

Just found it myself after reading the text here again, thanks. I missed to add the controlId in front...
Thanks a lot :)

No worries, have fun.