How to use a switch (button) with autoupdate=false and mapping

I’m trying to setup 3 buttons as in the demo site but as momentary push buttons

Here is my item:

Number Scene_General "Scene" {autoupdate="false"}

and in my sitemap

Switch item=Scene_General label=“Scene” mappings=[1=Dinner, 2=TV, 3=Reading]

But with autoupdate=false set the value of Scene_General doesn’t get updated

Do I need to drop the autoupdate and use a rule to run a command based on the value of Scene_General and then set it back to 0 after the command has been run?

That’s intended with autoupdate=“false”. Your rule would have to look like:

rule Test
when
  Item Scene_General received command
then
  if (receivedCommand == 1) {
    //...
  }
end

So the state of Scene_General never gets updated, but since you are only using it for commands, that should be OK.

Thanks, that’s exactly what is was trying to achieve.

ps commandReceived should have been receivedCommand :wink:

Oops. Sorry; it seemed wrong as I was typing it, but thinking more about coffee than what I was doing!

1 Like

solved this also by simply using,

Switch relay1 "Garage" <garage> { autoupdate="false",http=">[ON:GET:http://10.1.100.200/index.php?trigger=1] >[OFF:GET:http://10.1.100.200/index.php?trigger=1]"  }