I am trying to use a slider value in as a timer value and also send that value in a notification, both of which I have seen done in examples but nothing will work for me. Could someone please assist with working examples or point me in the right direction.
I have these in a dsl rule and have tried many variants of data manipulation to get it to work as shown below, can some one help
//var duration = timer_length.state as DecimalType
//var duration = (timer_length.state as Number).intValue
//Number timerDuration
var Timer timer = null //Global variable
// timerDuration = (timer_length.state as Number).intValue // transforms the Timer item value into an integer as timers only accept integers as arguments
Theatre_Lights.sendCommand(OFF)
var duration = (timer_length.state as Number).intValue * 10
Thread::sleep(2000)
//sendNotification("xxx@xxxl.com", duration) //doesn't work
//sendNotification("xxx@xxx.com" , 'Timer= ' + String.format("%.3f", duration.state) + ' mm') //doesn't work
Theatre_Lights.sendCommand(ON)
sendNotification("xxx@xxx.com", "Timer finished")
// the timer below also never works as the value is never parsed correctly either????
//var runtime = v_water_rf_timesilder.state as DecimalType
//var timerval = timer_length.state as DecimalType
//var duration = (timer_length.state as Number).intValue
sendNotification("xxx@xxx.com", duration)
Theatre_Lights.sendCommand(OFF)
sendNotification("xxx@xxx.com", "Timer finished")
//MinutesRemainingOnTimer.postUpdate(TotalRuntime.state)
//timer1 = createTimer(now.plusSeconds(runtime.timerval), [ |
// timer1 = createTimer(now.plusSeconds(duration), [ |
//var remain = MinutesRemainingOnTimer.state - 1
// if( remain < 0 ) remain = 0
//MinutesRemainingOnTimer.postUpdate(remain)
//if( remain > 0) timer1.reschedule(now.plusMinutes(1))
// Theatre_Lights.sendCommand(OFF)
// sendNotification("xxx@xxx.com", "Timer finished")
// ]
///End