Help with simple ON/OFF timer code to use with Setpoint items

I need to setup On and Off time for power socket via Setpoint item.
Do anybody do this already?

You mean that you set a setpoint to a value, and you want that action to launch a timer for that value in minutes and then switch the socket on/off?

Basically you just need to catch the update to the setpoint item in a rule (when SetPoint received update) and create a timer:

myTimer = createTimer(now.plusMinutes(SetPoint.state)) [|
  sendCommand(Socket, OFF)

You may need some conversion from the setpoints value to integer, but I’m not sure.

In case you need it that conversion would be now.plusMinutes((SetPoint.state as DecimalType).intValue)

Thanks. Openhab needs “datetime set” control.

@rikoshak: Thanks, that’s the one I meant.

@martiniman: What do you mean by a datetime set control?

I mean this control

And i found very good example here

Were you able to use this control to set the date and time?