I’m struggling on how to make changeable start and stop times on the GUI for a user.
What I want : there is a device that needs to start on a certain time of the dat and stop on a certain time of the day. I want to change these start and stop times on the GUI.
There are several ways to accomplish this, but none seem to work very well, or are to crude to put an a GUI. For my specific situation there is less need to be specific on minutes, working with round hours is doable. But perhaps more users are looking for this option ?
Approach 1 : Add DummySwitches for every round hours
Not very clean. I would need to add 48 dummy switches on the system and in the GUI. 24 for start hour and 24 for stop hour.
Also this would need 48 rules to check if the current hour matches the switch for that hour to start or stop.
Approach 2 : Work with ButtonsDevice
With ButtonsDevice I could make up/down buttons for the start and stop time. So far I’m not sure how to make this work. This would nee 2 variables for creating on ‘time’ : the hour and the minute. Not sure how create a rule to take $varHour and $varMinute and put them in a expression variable (explanation : you can create a variable with a expression containing a time in hh:mm format. This var can be used in rule to trigger time. But I can’t update this expression build from the hour and minute variable).
Approach 3 : Work with seconds since 00:00
Create a variable for the starttime, in seconds (counting from the start of the day). A start time of 08:00 would be 28800 seconds. Display this variable as time unit. Use DummyShutter to increase the time. Every push up or down would kick a rule adding blocks of 10 minutes (to avoid extremely extreme clicking on the buttons.
Perhaps I could break the hours and minutes with separate shutter device, one for the hours and one for the minutes. Every plus or min for the hours would raise/lower the HourSeconds with 3600 and the minutes with 60. Add both values into a new variable. Use that variable in rules (if it is $StartTime seconds THEN …)
Approach 4 : Make formfield for user to enter text
At this point there is no function for a user changeable formfield to enter time. Someone should make this as a plugin, including errorhandling
For now, approach 3 seems to be the best option.
If anyone can help with this problem to see how to solve my puzzle? Would be appreciated