Invalid State with Group Items

I’m trying to eliminate Errors in my logs and I see these 3 continually popping up that relate to Group items.

The error I see is this:

2017-11-22 11:28:17.258 [ERROR] [pse.smarthome.core.items.GenericItem] - Tried to set invalid state 1 (DecimalType) on item Lights of type SwitchItem, ignoring it
2017-11-22 11:28:17.263 [ERROR] [pse.smarthome.core.items.GenericItem] - Tried to set invalid state 1 (DecimalType) on item Family_Lights of type SwitchItem, ignoring it
2017-11-22 11:28:17.264 [ERROR] [pse.smarthome.core.items.GenericItem] - Tried to set invalid state 1 (DecimalType) on item Kitchen_Lights of type SwitchItem, ignoring it

And it relates to these items

/* active groups */
Group:Switch:OR(ON, OFF) 	Lights 		        "All Lights [(%d)]" 			<light>     (All)
Group:Switch:OR(ON, OFF) 	Family_Lights 		"All Family Lights [(%d)]" 	    <light>		(All)
Group:Switch:OR(ON, OFF) 	Kitchen_Lights 		"All Kitchen Lights [(%d)]" 	<light>		(All)

/* Family Room */
Dimmer FF_Fan_FamilyCF				"CF Fan Switch"			<fan_ceiling>   (FF_Family, gdashboard)     						{ channel="zwave:device:1587fb1d72a:node8:switch_dimmer" }

Switch FF_Light_FamilyCF			"Ceiling Fan"			<light>         (FF_Family, Family_Lights, Lights, gdashboard)	 	{ channel="zwave:device:1587fb1d72a:node7:switch_binary" }
Color  FF_Light_FamilyColorGroup	"All Family Color"		<colorwheel>    (FF_Family, Family_Lights, Lights, gdashboard)			
Color  FF_Light_FamilyCF_1 			"Ceiling Fan 1"			<colorwheel>    (FF_Family, Family_Lights, Lights, gdashboard)		{ channel="hue:0210:00178824e7e9:13:color" }
Color  FF_Light_FamilyCF_2 			"Ceiling Fan 2"			<colorwheel>    (FF_Family, Family_Lights, Lights, gdashboard)		{ channel="hue:0210:00178824e7e9:14:color" }
Color  FF_Light_FamilyCF_3 			"Ceiling Fan 3"			<colorwheel>    (FF_Family, Family_Lights, Lights, gdashboard)		{ channel="hue:0210:00178824e7e9:15:color" }
Color  FF_Light_FamilyCF_4 			"Ceiling Fan 4"			<colorwheel>    (FF_Family, Family_Lights, Lights, gdashboard)		{ channel="hue:0210:00178824e7e9:16:color" }
Color  FF_Light_FamilyLeft 			"Family Left"			<colorwheel>    (FF_Family, Family_Lights, Lights, gdashboard)		{ channel="hue:0210:00178824e7e9:10:color" }
Color  FF_Light_FamilyRight 		"Family Right"			<colorwheel>    (FF_Family, Family_Lights, Lights, gdashboard)		{ channel="hue:0210:00178824e7e9:11:color" }
Color  FF_Lightify_LED_TV           "TV Backlighting"       <colorwheel>    (FF_Family, Family_Lights, Lights, gdashboard)      { channel="osramlightify:rgbw:84-18-26-00-00-04-EA-17:color"}

//Remaining code for Kitchen and other lights

Would this by any chance have to possible do something with Hue Light Bulbs reporting a DecimalType?

That is exactly it. While you can send an ON/OFF to a Color Item, the Color Item itself stores and reports its state as an HSBType. Similarly, a Dimmer stores its value as a PercentType. I’m pretty sure the functions that aggregate the states of the are not smart enough to aggregate HSBTypes and PercentTypes into a Switch state and so you see the error.

So you can send an ON/OFF command to all the members of Lights, but you can’t use Lights’ state to determine if any of your lights are ON. You will need to use a proxy Item and Rule to do that.

I think this topic/discussion has come up before that Dimmer and Hue type bulbs did report an ON, OFF value when they are in use? I know I can sendCommand(MyHueBulb, OFF) and that will work as well using a normal Switch with Hue bulbs to turn them On or Off.

I can also see that when I do use the group switch, it does report the number of lights On and Off including the Hue Bulbs. And I confirmed if I turn off a Hue bulb with the Hue App, the group switch in OH2 also updates reducing the number of lights on.

In a Rule you can use


But that only works from Rules. If you just get the state then it comes as a HSBType. I haven’t looked at the code but based on observations it does not appear that the code that calculates the new State for a Group is smart enough to use getStateAs instead of getState.

Then perhaps it is smart enough. The last time I tried it it didn’t work but I can’t remember when that was.

Maybe it only works with SUM and not OR and AND???

I wanted to hopefully revisit as seems I still have this error in my logs and not really sure on the best or proper solution to solve it.

My understanding is that I have various Hue (and Lightify) Color and bulbs in a group. So how to place Dimmer and Color light items into a group without getting the Decimal error?