Timer = setpoint value

I try to make timer who depens on setpoint value but i have 2 problems.

Number timer_set_dd “Set Time [%.0f]”
Switch test1 “Test 1”
Setpoint item=timer_set_dd icon=“timer” minValue=“0” maxValue=“15” step=“1”

1.1 Furst problem is when try to change value for timer_set_dd from arrows in web interface givving me error
Received unknown command 'Uninitialized' for item 'timer_set_dd'
afret i change item value with arrows in HABdroid no problem in web interface until next restart.
1.2 In HABdroid sitemaps are no dinamic(no live updates) if item valie is 0 and i hit “+” button item recived update ot 1 but in HABdroid still stay 0 and when i hit “+” button again item is updated not to 2 but to 1

  1. I make this rule bit something wrong with varrible types (may be)
    rule "timer test1" when Item test1 received command then var Integer timeset = timer_set_dd.state as DecimalType if(receivedCommand==ON) sendCommand(Relay0, ON) { if(timer0==null) { // first ON command, so create a timer to turn the light off again timer0 = createTimer(now.plusSeconds(timeset)) sendCommand(Relay0, OFF) } else { // subsequent ON command, so reschedule the existing timer timer0.reschedule(now.plusSeconds(timeset)) } } else if(receivedCommand==OFF) { // remove any previously scheduled timer if(timer0!=null) { timer0.cancel timer0 = null } } end

and i have error

Error during the execution of rule 'timer test1': Could not invoke method: org.joda.time.DateTime.plusSeconds(int) on instance: 2015-12-21T07:00:29.765+02:00

somebodey can help me to sove this

Hmmm, sounds like a bug in the UI. You can avoid having this problem though if you set up persistence which will restore the last value the Item had before openHAB restarted when it comes back online, avoiding the whole Uninitialized state.

That is a known bug stemming from the library/framework OH 1 uses to communicate with clients. Sometimes changes to Items are not reflected in the UI until the client refreshes (e.g. go to a subframe then come back). This won’t be fixed until OH 2. Sometimes it will work but sometimes it wont.



I think the plusSeconds method needs a primitive int and can’t handle an Integer.

With this givving me"
Error during the execution of rule 'timer test1': Could not invoke method: java.lang.Integer.intValue() on instance: 9.0

That doesn’t make much sense. It is not clear what is going on here, but perhaps it is the original definition of timeset. A DecimalType is not an Integer so perhaps that is the source of our problem.


val int timeset = (timer_set_dd.state as DecimalType).intValue
timer0 = createTimer(now.plusSeconds(timeset))

Though I gotta say the error is not making much sense. For any of these fixes to work I would have expected a different error.