webcall_demo.tc¶
WebCall Demo — Widgets on the Tasmota main page
// WebCall Demo — Widgets on the Tasmota main page
// Demonstrates interactive widgets rendered in the sensor section
//
// Upload compiled .tcb to device, check main page for widgets
int power;
int brightness;
int mode;
char devname[32];
void WebCall() {
// These widgets appear in the sensor section of the main page
webButton(power, "Power");
webSlider(brightness, 0, 100, "Brightness");
webPulldown(mode, "Mode", "Off|Auto|Manual");
webText(devname, 32, "Device Name");
}
void EverySecond() {
if (mode == 1) {
if (brightness > 50) {
power = 1;
} else {
power = 0;
}
}
}
int main() {
power = 0;
brightness = 50;
mode = 0;
strcpy(devname, "Test");
return 0;
}