Switch nested groups


I’m trying to switch a nested group in habpanel but I doesn’t work. When I swicht on all “schemerlampen” (gLights3) everything works fine. But when I want to switch on the “schemerlampen voor” (gLights7) or "schemerlampen achter " (gLights8) it doesn’t work. Is there anything wrong in my items-file? Or do I interpret the groups incorrectly?

Group gLights (gLights_all)											
Group gLights_beneden (gLights_all)											
Group gLights_boven (gLights_all)											
Group gLights2 (gLights_all)											
Group gLights21 											
Group gLights22 											
Group gLights3 (gLights_all)											
Group gLights31 											
Group gLights32 											
Group gLights7 (gLights3)											
Group gLights8 (gLights3)											
Group:Switch:OR(ON, OFF) gLights_all "Alle Lichten [(%s)]" <light> (All)											
Switch	Licht_Eetkamer_Rechts 				Licht Eetkamer rechts 			(gLights2) 				
Dimmer 	Licht_Eetkamer_Rechts_Brightness 	Licht Eetkamer rechts			(gLights2) 						
Dimmer 	Licht_Eetkamer_Rechts_ColorTemperature 								(gLights21) 		
Color 	Licht_Eetkamer_Rechts_ColorLight 									(gLights22) 	
Number 	RemoteControlBatteryLevel1 			Battery [%d %%] 							
Switch 	RemoteControlBatteryLow1 										
Switch 	Licht_Eetkamer_Links 				Licht Eetkamer links 			(gLights2) 			
Dimmer 	Licht_Eetkamer_Links_Brightness 	Licht Eetkamer links 			(gLights2) 						
Dimmer 	Licht_Eetkamer_Links_ColorTemperature 								(gLights21) 		
Color 	Licht_Eetkamer_Links_ColorLight 									(gLights22) 	
Number 	RemoteControlBatteryLevel2 			Battery [%d %%] 							
Switch 	RemoteControlBatteryLow2 										
Switch 	Licht_Schemerlampen 				Schemerlampen1 					(gLights8) 		
Dimmer 	Licht_Schemerlampen_Brightness 		Schemerlampen1 					(gLights3) 				
Dimmer 	Licht_Schemerlampen_ColorTemperature 								(gLights31) 		    
Color 	Licht_Schemerlampen_ColorLight 										(gLights32) 
Switch 	Licht_Schemerlampen1 				Schemerlampen2 					(gLights7) 		
Dimmer 	Licht_Schemerlampen1_Brightness 	Schemerlampen2 					(gLights3) 					
Dimmer 	Licht_Schemerlampen1_ColorTemperature 								(gLights31) 		    
Color 	Licht_Schemerlampen1_ColorLight 									(gLights32) 	
Switch 	Licht_Schemerlampen2 				Schemerlampen3 					(gLights7) 		
Dimmer 	Licht_Schemerlampen2_Brightness 	Schemerlampen3 					(gLights3) 					
Dimmer 	Licht_Schemerlampen2_ColorTemperature 								(gLights31) 		    
Color 	Licht_Schemerlampen2_ColorLight 									(gLights32) 	
Switch 	Licht_Schemerlampen3 				Schemerlampen4 					(gLights7) 		
Dimmer 	Licht_Schemerlampen3_Brightness 	Schemerlampen4 					(gLights3) 					
Dimmer 	Licht_Schemerlampen3_ColorTemperature 								(gLights31) 		    
Color 	Licht_Schemerlampen3_ColorLight 									(gLights32) 	
Switch 	Licht_Schemerlampen4 				Schemerlampen5 					(gLights7) 		
Dimmer 	Licht_Schemerlampen4_Brightness 	Schemerlampen5 					(gLights3) 					
Dimmer 	Licht_Schemerlampen4_ColorTemperature 								(gLights31) 		    
Color 	Licht_Schemerlampen4_ColorLight 									(gLights32) 	
Switch 	Licht_Schemerlampen5 				Schemerlampen6 					(gLights8) 		
Dimmer 	Licht_Schemerlampen5_Brightness 	Schemerlampen6 					(gLights3) 					
Dimmer 	Licht_Schemerlampen5_ColorTemperature 								(gLights31) 		    
Color 	Licht_Schemerlampen5_ColorLight 									(gLights32) 	
Switch 	Licht_Schemerlampen6 				Schemerlampen7 					(gLights7) 		
Dimmer 	Licht_Schemerlampen6_Brightness 	Schemerlampen7 					(gLights3) 					
Dimmer 	Licht_Schemerlampen6_ColorTemperature 								(gLights31) 		    
Color 	Licht_Schemerlampen6_ColorLight 									(gLights32) 	
Switch 	Licht_Schemerlampen7 				Schemerlampen8 					(gLights7) 		
Dimmer 	Licht_Schemerlampen7_Brightness 	Schemerlampen8 					(gLights3) 					
Dimmer 	Licht_Schemerlampen7_ColorTemperature 								(gLights31) 		    
Color 	Licht_Schemerlampen7_ColorLight 									(gLights32) 	
Switch 	Licht_Schemerlampen8 				Schemerlampen9 					(gLights7) 		
Dimmer 	Licht_Schemerlampen8_Brightness 	Schemerlampen9 					(gLights3) 					
Dimmer 	Licht_Schemerlampen8_ColorTemperature 								(gLights31) 		    
Color 	Licht_Schemerlampen8_ColorLight 									(gLights32) 	
Switch 	Licht_Schemerlampen9 				Schemerlampen10 				(gLights7) 		
Dimmer 	Licht_Schemerlampen9_Brightness 	Schemerlampen10 				(gLights3) 					
Dimmer 	Licht_Schemerlampen9_ColorTemperature 								(gLights31) 		    
Color 	Licht_Schemerlampen9_ColorLight 									(gLights32) 	
Switch 	Licht_Kamer 						Licht Kamer 			<light> (gLights_beneden) 	
Switch 	Licht_Keuken 						Licht Keuken 			<light>	(gLights_beneden) 
Switch 	Licht_Boven 						Licht Onze Slaapkamer 	<light> (gLights_boven) 				
Switch 	Licht_Douche 						Licht Douche 			<light>	(gLights_beneden) 

I want to turn it on with this code in habpanel:

<div style="margin:auto;padding:0px 0px 20px;">Schemerlampen</div>
   <div class="btn-group" btn-checkbox-true 
     ng-init="values = config.values.split(',');labels = config.labels.split(',')">
     <button type="button" class="btn btn-primary" ng-model="itemValue('gLights3', true)" uib-btn-radio="x"
     ng-click="sendCmd('gLights3', x)" ng-repeat="x in values track by $index">{{labels[$index]}}</button>

This works for me (OH 2.3)

Group gOver
Group gSub (gOver)
Switch testX "testing" (gOver)
Switch testY "testing" (gSub)

When I send gOver.sendCommand(ON)
events log

2018- ... ItemCommandEvent] - Item 'gOver' received command ON
2018- ... ItemCommandEvent] - Item 'gSub' received command ON
2018- ... ItemCommandEvent] - Item 'testX' received command ON
2018- ... ItemCommandEvent] - Item 'testY' received command ON

i.e it seems to work as expected, passing command to members of nested group

What do you see in your logs? (Sending an inappropriate command e.g. UP to a Switch type should result in a warning in openhab log)

When I send ‘ON’ to gLights3 it works. But when I send ‘ON’ too gLights3 it doesn’t work. I see in the log the gLights3 is turned on but the lights don’t turn on

Okay, I’m missing understanding there.

As gLights3 has no state or type defined in your Items file, it should not change state - just receive the command.

Does my simple example work for you?

I tried it with the test Items as Dimmer types too

Group gOver
Group gSub (gOver)
Dimmer testX "testing" (gOver)
Dimmer testY "testing" (gSub)

gOver.sendCommand ON gives me

2018-... .ItemCommandEvent] - Item 'gOver' received command ON
2018-... .ItemCommandEvent] - Item 'gSub' received command ON
2018-... .ItemCommandEvent] - Item 'testX' received command ON
2018-... .ItemCommandEvent] - Item 'testY' received command ON
2018-....ItemStateChangedEvent] - testX changed from NULL to 100
2018-... .ItemStateChangedEvent] - testY changed from NULL to 100

The command ON is passed via nested group and nested group to the Items.
Because the Items are Dimmers, they convert ON to 100%

Sorry but that doesn’t make much sense

Sorry it has to be:
When I send ‘ON’ to gLights3 it works. But when I send ‘ON’ too gLights7 or gLights8 it doesn’t work. I see in the log the gLights7 or gLichts8 is turned on but the lights don’t turn on.

That’s true but when I sendCmd ‘ON’ to gLights3 the lights are turned on. But this doesn’t work.
I tried
Group:Switch:OR(ON, OFF) gLights7 but this doesn’t work either.

Can you tell us what your Items do, members of the group you are having trouble with, like Licht_Schemerlampen ?

There’s not much to go on here, for example your Item bindings are secret so we don’t know what technologies you are using.

My guess is that it’s a timing issue and a flood of device commands generated by Group commands is getting ignored.

this is the whole items file:

Group gLights (gLights_all)
Group gLights_beneden (gLights_all)
Group gLights_boven (gLights_all)
Group gLights2 (gLights_all)
Group gLights21 
Group gLights22 
Group gLights3 (gLights_all)
Group gLights31 
Group gLights32 
Group:Switch:OR(ON,OFF) gLights7 "Schemerlampen voor" <light> (gLights3)
Group:Switch:OR(ON,OFF) gLights8 "Schemerlampen achter" <light> (gLights3)
Group:Switch:OR(ON, OFF) gLights_all "Alle Lichten [(%s)]" <light> (All)
Switch	Licht_Eetkamer_Rechts 				"Licht Eetkamer rechts" 		(gLights2, gLights_all) 								{ channel="tradfri:0100:gwb8d7af2c7f95:myDimmableBulb1:brightness" }
Dimmer 	Licht_Eetkamer_Rechts_Brightness 	"Licht Eetkamer rechts"			(gLights2) 								{ channel="tradfri:0220:gwb8d7af2c7f95:myColorTempBulb1:brightness" }
Dimmer 	Licht_Eetkamer_Rechts_ColorTemperature 								(gLights21) 							{ channel="tradfri:0220:gwb8d7af2c7f95:myColorTempBulb1:color_temperature" }
Color 	Licht_Eetkamer_Rechts_ColorLight 									(gLights22) 							{ channel="tradfri:0210:gwb8d7af2c7f95:myColorBulb1:color" }
Number 	RemoteControlBatteryLevel1 			"Battery [%d %%]" 														{ channel="tradfri:0830:gwb8d7af2c7f95:myRemoteControl1:battery_level" } 
Switch 	RemoteControlBatteryLow1 																					{ channel="tradfri:0830:gwb8d7af2c7f95:myRemoteControl1:battery_low" }
Switch 	Licht_Eetkamer_Links 				"Licht Eetkamer links" 			(gLights2, gLights_all) 								{ channel="tradfri:0100:gwb8d7af2c7f95:myDimmableBulb2:brightness" }
Dimmer 	Licht_Eetkamer_Links_Brightness 	"Licht Eetkamer links" 			(gLights2) 								{ channel="tradfri:0220:gwb8d7af2c7f95:myColorTempBulb2:brightness" }
Dimmer 	Licht_Eetkamer_Links_ColorTemperature 								(gLights21) 							{ channel="tradfri:0220:gwb8d7af2c7f95:myColorTempBulb2:color_temperature" }
Color 	Licht_Eetkamer_Links_ColorLight 									(gLights22) 							{ channel="tradfri:0210:gwb8d7af2c7f95:myColorBulb2:color" }
Number 	RemoteControlBatteryLevel2 			"Battery [%d %%]" 														{ channel="tradfri:0830:gwb8d7af2c7f95:myRemoteControl2:battery_level" } 
Switch 	RemoteControlBatteryLow2 																					{ channel="tradfri:0830:gwb8d7af2c7f95:myRemoteControl2:battery_low" }
Switch 	Licht_Schemerlampen 				"Schemerlampen1" 				(gLights8, gLights_all) 				{ channel="tradfri:0100:gwb8d7af2c7f95:myDimmableBulb3:brightness" }
Dimmer 	Licht_Schemerlampen_Brightness 		"Schemerlampen1" 				(gLights3) 								{ channel="tradfri:0220:gwb8d7af2c7f95:myColorTempBulb3:brightness" }
Dimmer 	Licht_Schemerlampen_ColorTemperature 								(gLights31) 		    				{ channel="tradfri:0220:gwb8d7af2c7f95:myColorTempBulb3:color_temperature" }
Color 	Licht_Schemerlampen_ColorLight 										(gLights32) 							{channel="tradfri:0210:gwb8d7af2c7f95:myColorBulb3:color" }
Switch 	Licht_Schemerlampen1 				"Schemerlampen2" 				(gLights7, gLights_all) 				{ channel="tradfri:0100:gwb8d7af2c7f95:myDimmableBulb4:brightness" }
Dimmer 	Licht_Schemerlampen1_Brightness 	"Schemerlampen2" 				(gLights3) 								{ channel="tradfri:0220:gwb8d7af2c7f95:myColorTempBulb4:brightness" }
Dimmer 	Licht_Schemerlampen1_ColorTemperature 								(gLights31) 		    				{ channel="tradfri:0220:gwb8d7af2c7f95:myColorTempBulb4:color_temperature" }
Color 	Licht_Schemerlampen1_ColorLight 									(gLights32) 							{ channel="tradfri:0210:gwb8d7af2c7f95:myColorBulb4:color" }
Switch 	Licht_Schemerlampen2 				"Schemerlampen3" 				(gLights7, gLights_all) 				{ channel="tradfri:0100:gwb8d7af2c7f95:myDimmableBulb5:brightness" }
Dimmer 	Licht_Schemerlampen2_Brightness 	"Schemerlampen3" 				(gLights3) 								{ channel="tradfri:0220:gwb8d7af2c7f95:myColorTempBulb5:brightness" }
Dimmer 	Licht_Schemerlampen2_ColorTemperature 								(gLights31) 		    				{ channel="tradfri:0220:gwb8d7af2c7f95:myColorTempBulb5:color_temperature" }
Color 	Licht_Schemerlampen2_ColorLight 									(gLights32) 							{ channel="tradfri:0210:gwb8d7af2c7f95:myColorBulb5:color" }
Switch 	Licht_Schemerlampen3 				"Schemerlampen4" 				(gLights7, gLights_all) 				{ channel="tradfri:0100:gwb8d7af2c7f95:myDimmableBulb6:brightness" }
Dimmer 	Licht_Schemerlampen3_Brightness 	"Schemerlampen4" 				(gLights3) 								{ channel="tradfri:0220:gwb8d7af2c7f95:myColorTempBulb6:brightness" }
Dimmer 	Licht_Schemerlampen3_ColorTemperature 								(gLights31) 		    				{ channel="tradfri:0220:gwb8d7af2c7f95:myColorTempBulb6:color_temperature" }
Color 	Licht_Schemerlampen3_ColorLight 									(gLights32) 							{ channel="tradfri:0210:gwb8d7af2c7f95:myColorBulb6:color" }
Switch 	Licht_Schemerlampen4 				"Schemerlampen5" 				(gLights7, gLights_all) 				{ channel="tradfri:0100:gwb8d7af2c7f95:myDimmableBulb7:brightness" }
Dimmer 	Licht_Schemerlampen4_Brightness 	"Schemerlampen5" 				(gLights3) 								{ channel="tradfri:0220:gwb8d7af2c7f95:myColorTempBulb7:brightness" }
Dimmer 	Licht_Schemerlampen4_ColorTemperature 								(gLights31) 		    				{ channel="tradfri:0220:gwb8d7af2c7f95:myColorTempBulb7:color_temperature" }
Color 	Licht_Schemerlampen4_ColorLight 									(gLights32) 							{ channel="tradfri:0210:gwb8d7af2c7f95:myColorBulb7:color" }
Switch 	Licht_Schemerlampen5 				"Schemerlampen6" 				(gLights8, gLights_all) 				{ channel="tradfri:0100:gwb8d7af2c7f95:myDimmableBulb8:brightness" }
Dimmer 	Licht_Schemerlampen5_Brightness 	"Schemerlampen6" 				(gLights3) 								{ channel="tradfri:0220:gwb8d7af2c7f95:myColorTempBulb8:brightness" }
Dimmer 	Licht_Schemerlampen5_ColorTemperature 								(gLights31) 		    				{ channel="tradfri:0220:gwb8d7af2c7f95:myColorTempBulb8:color_temperature" }
Color 	Licht_Schemerlampen5_ColorLight 									(gLights32) 							{ channel="tradfri:0210:gwb8d7af2c7f95:myColorBulb8:color" }
Switch 	Licht_Schemerlampen6 				"Schemerlampen7" 				(gLights7, gLights_all) 				{ channel="tradfri:0100:gwb8d7af2c7f95:myDimmableBulb9:brightness" }
Dimmer 	Licht_Schemerlampen6_Brightness 	"Schemerlampen7" 				(gLights3) 								{ channel="tradfri:0220:gwb8d7af2c7f95:myColorTempBulb9:brightness" }
Dimmer 	Licht_Schemerlampen6_ColorTemperature 								(gLights31) 		    				{ channel="tradfri:0220:gwb8d7af2c7f95:myColorTempBulb9:color_temperature" }
Color 	Licht_Schemerlampen6_ColorLight 									(gLights32) 							{ channel="tradfri:0210:gwb8d7af2c7f95:myColorBulb9:color" }
Switch 	Licht_Schemerlampen7 				"Schemerlampen8" 				(gLights7, gLights_all) 				{ channel="tradfri:0100:gwb8d7af2c7f95:myDimmableBulb10:brightness" }
Dimmer 	Licht_Schemerlampen7_Brightness 	"Schemerlampen8" 				(gLights3) 								{ channel="tradfri:0220:gwb8d7af2c7f95:myColorTempBulb10:brightness" }
Dimmer 	Licht_Schemerlampen7_ColorTemperature 								(gLights31) 		    				{ channel="tradfri:0220:gwb8d7af2c7f95:myColorTempBulb10:color_temperature" }
Color 	Licht_Schemerlampen7_ColorLight 									(gLights32) 							{ channel="tradfri:0210:gwb8d7af2c7f95:myColorBulb10:color" }
Switch 	Licht_Schemerlampen8 				"Schemerlampen9" 				(gLights7, gLights_all) 				{ channel="tradfri:0100:gwb8d7af2c7f95:myDimmableBulb11:brightness" }
Dimmer 	Licht_Schemerlampen8_Brightness 	"Schemerlampen9" 				(gLights3) 								{ channel="tradfri:0220:gwb8d7af2c7f95:myColorTempBulb11:brightness" }
Dimmer 	Licht_Schemerlampen8_ColorTemperature 								(gLights31) 		    				{ channel="tradfri:0220:gwb8d7af2c7f95:myColorTempBulb11:color_temperature" }
Color 	Licht_Schemerlampen8_ColorLight 									(gLights32) 							{ channel="tradfri:0210:gwb8d7af2c7f95:myColorBulb11:color" }
Switch 	Licht_Schemerlampen9 				"Schemerlampen10" 				(gLights7, gLights_all) 				{ channel="tradfri:0100:gwb8d7af2c7f95:myDimmableBulb12:brightness" }
Dimmer 	Licht_Schemerlampen9_Brightness 	"Schemerlampen10" 				(gLights3) 								{ channel="tradfri:0220:gwb8d7af2c7f95:myColorTempBulb12:brightness" }
Dimmer 	Licht_Schemerlampen9_ColorTemperature 								(gLights31) 		    				{ channel="tradfri:0220:gwb8d7af2c7f95:myColorTempBulb12:color_temperature" }
Color 	Licht_Schemerlampen9_ColorLight 									(gLights32) 							{ channel="tradfri:0210:gwb8d7af2c7f95:myColorBulb12:color" }
Switch 	Licht_Kamer 						"Licht Kamer" 			<light> (gLights_beneden, gLights_all) 			{ channel="rfxcom:lighting2:usb0:14160886_1:command" }
Switch 	Licht_Keuken 						"Licht Keuken" 			<light>	(gLights_beneden, gLights_all) 			{ channel="rfxcom:lighting4:usb0:262145:command" }
Switch 	Licht_Boven 						"Licht Onze Slaapkamer" <light> (gLights_boven, gLights_all) 			{ channel="rfxcom:lighting2:usb0:14166714_5:command" }
Switch 	Licht_Douche 						"Licht Douche" 			<light>	(gLights_beneden, gLights_all) 			{ channel="rfxcom:lighting2:usb0:14159582_4:command" }

the “Schemerlampen” are my livingrooms and diningroom lights, the lights on the wall, on the closet.

the group “gLights3” contains the following lights:


when I send an ‘ON’ command to the group ‘gLights3’ the light are going to the ON-state.

The group “gLights7” contains the following lights (these are the llghts in my livingroom):


when I send an ‘ON’ command to the group ‘gLights3’ the light are going to the ON-state according to the log. But they do not physically go ‘ON’.

And the group “gLights8” contains the following lights:


when I send an ‘ON’ command to the group ‘gLights8’ the light are going to the ON-state according to the log. But they do not physically go ‘ON’.

If it would be a timing issue than “gLights3” won’t work either, I think.

But the timing will be different with a nested group, as OpenHAB is doing different processing working through subgroups. It will probably do Items in a different order as well.

If you can see the member Items of your suspect group receiving commands in your events.log, then it’s not a groups issue.

Write yourself a test rule that sends individual commands to a list of members of one of your suspect groups, try with and without a short delay in between.

I wrote the following rule with and without the delay but no luck:

rule "Deurbel"

        Item Licht100 changed to ON                                                                                                                   

and this is the log:

2018-09-05 10:06:23.826 [ome.event.ItemCommandEvent] - Item 'Licht100' received command ON

2018-09-05 10:06:23.836 [vent.ItemStateChangedEvent] - Licht100 changed from OFF to ON

2018-09-05 10:06:23.880 [ome.event.ItemCommandEvent] - Item 'Licht_Schemerlampen1' received command ON

2018-09-05 10:06:23.895 [ome.event.ItemCommandEvent] - Item 'Licht_Schemerlampen2' received command ON

2018-09-05 10:06:23.909 [ome.event.ItemCommandEvent] - Item 'Licht_Schemerlampen3' received command ON

2018-09-05 10:06:23.927 [ome.event.ItemCommandEvent] - Item 'Licht_Schemerlampen4' received command ON

2018-09-05 10:06:23.942 [ome.event.ItemCommandEvent] - Item 'Licht_Schemerlampen6' received command ON

2018-09-05 10:06:23.958 [ome.event.ItemCommandEvent] - Item 'Licht_Schemerlampen7' received command ON

2018-09-05 10:06:23.976 [ome.event.ItemCommandEvent] - Item 'Licht_Schemerlampen8' received command ON

2018-09-05 10:06:23.992 [ome.event.ItemCommandEvent] - Item 'Licht_Schemerlampen9' received command ON

So, it comes down to this simple command not working. Not to do with groups, to with the channel/binding.

I don’t know anything about Tradfri, but I can see you have an OH Switch type Item bound to a Tradfri brightness channel. Is that usual? The example docs only talk about Dimmer Items.

@rossko57 I figured it out. My items where not linked to an Thing anymore.

1 Like