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!
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:
long startTimeInSecs = param.asLong(); // this would result in startTimeInSecs = 0
long endTimeInSecs = param.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…