Rules for Lighting Scenes - Lights Not Always Reacting

I have a rule that will mimic some lighting scenes in my bedroom. The issue I have is that they are not working all the time. Sometimes pressing one of the buttons on my sitemap will trigger the lights properly, but often time it takes several presses to get all the lights to react.

For example I will press “Read” which will trigger brReadingLamp and brBedside to HSBType(“51,20,100”) (hue bulbs) as well as brFan and brCeiling to 60% (zwave dimmer).

Then I will press “Morn.” which should trigger brFan and brCeiling OFF and brReadingLamp and brBedside to HSBType(“60,91,70”).

But what happens is that brFan and brCeiling trigger OFF as expected but brBedside will stay at the configuration for “Read” while the brReadingLamp goes to the right configuration.

Subsequent presses will eventually get the lights in sync.

Any ideas?

/* home.items */
Color	brReadingLamp	"Reading Light [%s]"		<hue>			(Bedroom,MyLights) 			{channel="hue:LCT007:001788267973:1:color"}
Color	brBedside		"Bedside Light [%s]"		<hue>			(Bedroom,MyLights) 			{channel="hue:LCT007:001788267973:3:color"}
Dimmer	brFan			"Fan Light [%s]"			<hue>			(Bedroom,MyLights)			["homekit:DimmableLightbulb"]	{channel="zwave:device:1b210286:node4:switch_dimmer"} 	//["homekit:DimmableLightbulb"]	
Dimmer	brCeiling		"Recessed Lights [%s]"		<hue>			(Bedroom,MyLights)			["homekit:DimmableLightbulb"]	{channel="zwave:device:1b210286:node5:switch_dimmer"} 	//["homekit:DimmableLightbulb"]	

Switch brMovie			"Bedroom Movie" 					 ["homekit:Lightbulb"]
Switch brReading		"Bedroom Reading" 					 ["homekit:Lightbulb"]
Switch brMorning		"Bedroom Morning" 					 ["homekit:Lightbulb"]
Switch brNightlight		"Bedroom Nightlight" 				 ["homekit:Lightbulb"]


/* home.sitemap */
Switch item=brScene mappings=[0="OFF", 1="Morn.",2="Read", 3="Movie", 4="Nightlight"]


/* home.rules */
rule "scene for lights in bedroom"
when
	Item brScene received command
then
	logInfo('Scenes', 'brScene received state:' + brScene.state)
	switch (receivedCommand) {
		case 0: { // OFF
			sendCommand(brBedside, OFF)
			sendCommand(brReadingLamp, OFF)
			sendCommand(brFan,OFF)
			sendCommand(brCeiling,OFF)		
		}
		case 1: { // MORNING
			var HSBType light = new HSBType("60,91,70")
			sendCommand(brBedside, light)
			sendCommand(brReadingLamp, light)
			sendCommand(brFan,OFF)
			sendCommand(brCeiling,OFF)	
				
		}
		case 2: { // READING
			var HSBType light = new HSBType("51,20,100")
			sendCommand(brBedside, light)
			sendCommand(brReadingLamp, light)
			sendCommand(brFan,60)
			sendCommand(brCeiling,60)
				
		}		
		case 3: { // MOVIE
			var HSBType light = new HSBType("0,100,25")
			sendCommand(brBedside, light)
			sendCommand(brReadingLamp, light)
			sendCommand(brFan,OFF)
			sendCommand(brCeiling,OFF)	
				
		}
		case 4: { // NIGHLIGHT
			var HSBType light = new HSBType("60,91,25")
			sendCommand(brBedside, light)
			sendCommand(brReadingLamp, light)
			sendCommand(brFan,OFF)
			sendCommand(brCeiling,OFF)	
				
		}
	}	
	logInfo('Scenes', 'brScene updated to: ' + brScene.state)
end

This is really just a stab in the dark.

Try using the sendCommand method instead of the action:

brBedside.sendCommand(light)

When 1.8.2 was released I’ve seen the actions to be a lot less forgiving in handling pretty much any state that isn’t a String.

OK, I’ll give that a shot, thanks!

That appears to have done the trick. Thanks again!