Mapping issue

Hey guys,

I got a couple of scenes that work pretty well on my wall mounted tablet.
Only “issue” i have is that i want dont want the off buttons on it.
See here:

As you can see i need the off buttons when there has been a different event in my home.
Like when i get home or move away from home i got automated rules to turn everything on or off trough presence.

So when i want to sleep the button is still on Going to sleep, but i cant press that button twice so i need to go to the off button and then press Going to sleep again.

Is there a way to bypass this and just have the mapping buttons without the off button. That they get deselected after they are pressed or something like that.

Items:

Number Mijnscenes "Light Scenes" <bulb> 
Number myScenes2 "Master Switches" <bed>

Rules:

rule "my scenes switch"
when
    Item Mijnscenes changed
then
    switch (Mijnscenes.state) {
        case 1: {
          sendCommand (Huiskamer_lichten, ON)
		sendCommand (Kitchendimmer, 100)
		sendCommand (Huiskamerdimmer, 0)
		sendCommand (KitchenKleur, 0)
		sendCommand (Keukenled,ON)
		
        }
        case 2: {
           sendCommand (Huiskamer_lichten, ON)
		sendCommand (Kitchendimmer, 0)
		sendCommand (Huiskamerdimmer, 0)
		sendCommand (Keukenled,OFF)
		
        }
        case 3: {
          sendCommand (Huiskamer_lichten, ON)
		sendCommand (Kitchendimmer, 100)
		sendCommand (Huiskamerdimmer, 100)
		sendCommand (KitchenKleur, 100)
		sendCommand (Keukenled,OFF)
		
        }
        
      
        default: { 
            logInfo("Mijnscenes","incorrect state: {}",Mijnscenes.state)
         
        
    
        }
        
    }
end

Sitemap:

Frame label= Scenes
		{
		Switch item=Mijnscenes mappings=[0="off",1="Cooking",2="Chilling",3="Working"] labelcolor=["gold"]
		Switch item=myScenes2 mappings=[0="OFF",1="Wake Up",2="Going To Sleep"]
		}

I hope some of you understand my question, my english is not really good.
I hope someone has a solution for this. Its not a big problem but it would be more cleaner looking in the sitemap.

Greetings,

Freddy

Have you tried it? You just get the buttons that you ask for in mappings=

Oh wait - you mean a press of a “lit” button does not trigger your rule?
That’s because you have the wrong trigger, changed.
Try received command.

Im allready running this for 2 months, do you mean that?

I tried it first without the off buttons but then i had to press another button to go back to the other one.
So i first have to turn other lights on to go back to the other one.

It does trigger my rule perfectly
but when the button is selected i cant press it another time, so i have to go to OFF (just a dummy button) so its unselected and then press the button again.

Yes, you have to make it change to trigger the changed rule. A command trigger needs a command, it doesn’t care if it is the same as last time.

So i have to change this:

rule "my scenes switch"
when
    Item Mijnscenes changed
then

To this:

**rule "my scenes switch"
when
    Item Mijnscenes recieved command
then**

?

You will also have to use the receivedCommand implicit variable in your rule to find out what the command was.
Don’t use the Item.state

Allright, thanks for putting me in the right direction.

Because the item is a number item i had to change it to “recieved update”

rule "my scenes switch"
when
    Item Mijnscenes received update
then
    switch (Mijnscenes.state) {
        case 1: {
          sendCommand (Huiskamer_lichten, ON)
		sendCommand (Kitchendimmer, 100)
		sendCommand (Huiskamerdimmer, 0)
		sendCommand (KitchenKleur, 0)
		sendCommand (Keukenled,ON)
		

I didnt change the mijnscenes.state. But tested it and it works now.
Can press the same lit button multiple times.

Thanks!

Trust me, Numbers have commands too.

Not needed to change if not using command.
As you wait for the Item to update, the state will be the “new” state.
It’ was a timing concern.