(How to use) Time Input Widget

I’m quite new at this so I may not be grasping the Timer Input widget in its entirety, but I find that the Timer Input is seriously complicated in terms of software manipulation. I’ve been at it for the last two days, using and trying lots of examples but fail to get it to work.
From what I can see is the widget is read, and the information is captured. It is then up to you to manipulate the data. The widget also has to be constantly interrogated to see if there is an event change.

Can’t the Timer Input Widget be simplified and just work like the Timer Widget, where one gets a HIGH at the start time and a LOW at the end time as selected. The Timer Input Widget would then work much like an “off the shelf electronic timer” where you set the local time, and then select the days and start and stop time for that day. What then follows is a logic HIGH/LOW on the selected days/time.
Like I say I may be missing the point!

4 Likes

I agree… I’ve been playing around with thr timer input advance code and haven’t had success. I also wish it was as simplistic as the timer widget.

@Costas do you know much about the timer input widget? Should it just work or is there time conversions to be done?

http://docs.blynk.cc/#widgets-interface-time-input

The way the Time Input widget works is that it sends the start and stop time in seconds of the day as parameters associated with a Vpin… but it sends this assigned data as soon as someone sets the timer and hits OK, not as the start/stop time happens.

For example the Time Input, on V0, is set for every day of the week but starts at Midnight (0 seconds into the day) and runs for one hour (3600 seconds into the day).

As soon as that info is entered into the widget and the OK button is pressed, this code will provide two numbers, one for the start time and one for the stop time:

BLYNK_WRITE(V0) {
  long startTimeInSecs = param[0].asLong();  // this would result in startTimeInSecs = 0
  long endTimeInSecs = param[1].asLong();   // this would result in endTimeInSecs = 3600
}

From there you need to write some code logic to break down the seconds of the day (probably compared to the RTC time) into whatever actions you wish to happen at the appropriate time.

Hopefully this basic example helps you understand it better. It has gotten a bit more in-depth with advanced mode inputs of days of week, timezone, sunrise/sunset formatted values, etc… things that I haven’t worked with yet…

1 Like

The Time Input widget is very powerful and allows you to set proper schedules for your events e.g. some action from 10am to 6pm every Tuesday.

However it does require you to do some coding to create the schedules.

There is code on this site to do just that and a good project to look at is the ESP01 Scheduler by @psoro at https://community.blynk.cc/t/automatic-scheduler-esp-01-with-4-time-input-widgets

1 Like

That’s awesome @Costas. Thanks heaps. I’ll learn a lot from @psoro project.

i am from indonesia i was setting GMT + 7 asia/jakarta…if now the clock e.g at 06.00 a.m…the relay is ON stop time only can setting until under 10 :00… but above at 10:00 relay is can not setting ON.

if now the clock e.g at 18.00…the relay start time only can setting above 10 :00…but under 10:00 relay can not setting ON…

please help me to solve the case above…?

@Kangmas_Hadi you already have a question about this in another topic… please stay within that topic for now.