Light switches

Excellent idea, I need door sensors then… But how do you handle multiple persons?

I was trying to use the associated design pattern but I did not make myself clear enough. In your DP it is required one item linked to another item… In this case this will not work, because you might have two physical switches(contact items) linked to that room(Number item/scene).

So what I am trying to do is:
Contact Contact_BathroomL {gpio=“pin:24 debounce:0 activelow:yes”}//SW3
Contact Contact_BathroomR {gpio=“pin:25 debounce:0 activelow:yes”}//SW4

to link both these to
Number Scene_BathRoom "Scene" <sofa>

So I guess what we need to do is to extract Bathroom from Contact_BathroomL if we somehow figure out that it was that switch that were pressed(This is where I am stuck :wink: ), then we get the associated scene by using:

val sceneItem= Group_RoomScenes.members.findFirst[g | g.name.contains(room.name)] as NumberItem

then we check if it light is off, if so, then check the time of day, if night, then night light on…

 val sceneItem= Group_RoomScenes.members.findFirst[g | g.name.contains(room.name)] as NumberItem
        if (sceneItem!=null){
          if(sceneItem.state == 0){
		if (vTimeOfDay.state.toString.contains("NIGHT")){
			sceneItem.sendCommand(2)
		}
		else{
			sceneItem.sendCommand(1)
		}
	}
	else {
		sceneItem.sendCommand(0)
	}

So the big question is how can I get the room name from any random pressed switch(contact item) in the light_switch item?

Does this make things more clear?