How to send a command from sitemap?

I’d like to implement UI element that would allow to boost heating in one of our rooms for a limited time.

I figured out that the best way would be to run a command on a virtual item (heatingBoost) where command would be a number equal the time for the boost (10,20,30,60 and 90 minutes).

Is it possible to send a command from sitemap? Or do I need to use some workaround like a Switch item?

Is it possible to make an element to allow user to select time for the boost?

Use a switch or selection element that has mappings for these times. Then you’ll need a rule that triggers when heatingBoost receives a command. The rule will:

  1. Turn on your heating
  2. Set a timer that’s equal to the number of minutes in your heatingBoost command
  3. Turn off the heating when the timer expires

Note that there’s a bit of risk to this, because if your system reboots then the timer will be lost and your heating will never turn off. I personally avoid long timers to minimize the risk, but others are okay with it. I’d be more concerned with heat not turning off than a light not turning off.

Rather than boosting heat for an arbitrary period of time, I would recommend that you get a temperature sensor and set a target temperature for the room. You can find examples of rules that turn off heat when the target is reached, then turn it on again after the temperature has fallen a bit. It’s basically a do-it-yourself thermometer using openHAB.