I'm using a dashboard tile as an interface to set a variable for how long a sprinkler should run. In Rule Machine, the sprinkler is turned on (alterate days, only if the ground is dry), then turned off with a delay set by the variable.
That's all good.
The issue is that the delay-until-off argument is in seconds, while it makes sense for the user to set the watering duration in minutes.
Is there a way to any of:
Do math within RM (ie, multiply the value of the WateringDuration variable by 60)
Automatically do math whenever a variable is set? For example, the user sets WateringDuration via the dashboard to 15, and WateringDurationSecs is immediately set to (WateringDuration * 60), and the rule uses WateringDurationSecs as the delay variable
Within the rule, specify the unit used for the WateringDuration variable as “minutes”
The first two are easy: yes, you can do this in rule machine. Just create a rule for which the trigger is WateringDuration is changed. Then use variable math to set WateringDurationSc to WateringDuration * 60.
Not quite sure what you mean with the third one. There is a time format, but you could just use number for this
Currently, an integer argument to the delay option in an action is treated as “seconds”, and I believe other time periods must be colon-separated, as in hh:mm:ss (hours and minutes are optional). I was asking if there is a way to specify the units used in the delay. In pseudo code:
// The current behavior
Delayformat=[h]:[m]:seconds;
Delaytype naptime;