Here described for ShellExecute but might be also realized as generic device or for Homeduino.
The Ui should contain from left to right
(Don’t know to add pictures, so I had a nice illustration)
- name
- elapsed time
- remaining time (optional as edit field)
- slider to change remaining time quickly
-optional up/down buttons to change remaining time - flip switch to start stop timer
The timer is already started it can be resceduled by chaning the value without switching off.
Here a rough draft to explain the idea
{
"id": "party-timer",
"name": "Party Timer",
"class": "ShellTimer",
"unit": "minutes",
"unitname": "min",
"min": 0,
"max": 240,
"remain": 50,
"elapse": 190,
"onCommand": "echo start with $this.remain $this.unitname",
"offCommand": "echo off",
"changeCommand": "echo changed value to $this.remain $this.unitname"
"getStateCommand": "echo 50",
"interval": "20000"
}
Some explanations:
unit - the unit for the timer calculation, can be seconds, minutes, hours, days
unitname - string to display for unit
min - the minum value which can be entered in the UI
max - the maximum value which can be entered in the UI
remain - the remaining time until switch off, shown and editable in UI
elapse - actual time since start of timer, might be greater than max in case of resceduling, shown in the UI
getStateCommand - rescedule timer, only in range of min to max, -1: keep unchanged
interval - for the getStateCommand