I’m trying to reset the time input widget once it has executed.
When executing the code below the widget shows a reset (–:--). Though it sets the start time to 23280 seconds (6:28 am). Moreover the t.hasStartTime() shows -1.
When resetting the widget from app side the start time has a value of -16 and the t.hasStartTime() is empty.
What value needs to have the “startAt” in order to properly reset the time input widget from hardware side by having the t.hasStartTime() empty?
FYI: I’m using an ESP8266 and a local server on a Rspberry Pi. The App is for Android. Everything is up to date.
//individual time
BLYNK_WRITE(V8) { // Scheduler #7 Time Input widget
TimeInputParam t(param);
long nowseconds = ((hour() * 3600) + (minute() * 60) + second());
long startseconds = (t.getStartHour() * 3600) + (t.getStartMinute() * 60);
int dayadjustment = -1;
Blynk.virtualWrite(V15, startseconds);
if (weekday() == 1) {
dayadjustment = 6; // needed for Sunday Time library is day 1 and Blynk is day 7
}
if (t.isWeekdaySelected((weekday() + dayadjustment))) { //Time library starts week on Sunday, Blynk on Monday
//Schedule is ACTIVE today
if (nowseconds >= startseconds - ((brewtime/1000) + 31) && nowseconds < startseconds - ((brewtime/1000) - 31) && coffeeactive == false) { // 62s on 60s timer ensures 1 trigger command is sent
//reset timer in app
int startAt = -1;
int stopAt = -1;
char tz[]= "Europe/Berlin";
Blynk.virtualWrite(V8, startAt, stopAt, tz);
//start button
timer3.setTimeout(780L, []() {
coffeeaction();
});
}
}
}
When being able to reset the widget from hardware side I will put the whole function into something like
if (t.hasStartTime()) {
}