Temperature Button - some problems

Hi
I added two item

Number TargetTemp "Temperatura [%.1f °C]"
Switch TargetTempButton "Ust. temp." 

and also I added it to my sitemap

Switch item=TargetTempButton label="Ust. temp." mappings=[1="PLUS", 2="MINUS"]
Text item=TargetTemp

and I added this rule


rule "TargetTemp plus/minus."
when
  Item TargetTempButton received command
then
  if (receivedCommand == 1) {
    TargetTemp = TargetTemp + 1 
 }

  if (receivedCommand == 2) {
    TargetTemp = TargetTemp - 1  
  } 
end

The idea is to control temperature in home and when I push plus button it should add 1 degree to TargetTemp (Text item) but unfortunately when i push plus button I receive unknown command ‘1’ for item 'TargetTempButton’
I’m beginner and I don’t know what should I do next

Hi,

what you’re looking for is actually a SetPoint. This control automatically gives you the + and - controls as well as handling the value produced by them.

That is a very, very brief explanation of the control. I’d suggest you take a look at some of the thermostat bindings for more practical examples. If you get stuck, let me know.

Cheers,

PelliX

1 Like

Thanks a lot
Now it is easy for me;)

SiteMap

Setpoint item=Docelowa_Temp label="P2 ustaw na: [%.1f °C]" step=0.5 minValue=12 maxValue=30

Item

Number Docelowa_Temp

Glad to hear you got it sorted out. Polish is not a language I claim to understand, but I get the gist of it :slight_smile:

Cheers,

PelliX