Issue with Philips Hue rules

Hello,

I seem to be having an intermittent issue with my rules governing the state of hue lights.

My intent is to have a dimmer item that when it’s state is changed will, through rules, force its state on the hue lights. I believed I had achieved this but ~9 out of every 10 times I restart openhab I get this error:

2017-11-06 20:56:14.578 [ERROR] [.script.engine.ScriptExecutionThread] - Rule 'All Lighting': An error occurred during the script execution: Could not invoke method: org.eclipse.smarthome.model.script.actions.BusEvent.sendCommand(org.eclipse.smarthome.core.items.Item,java.lang.String) on instance: null

If this happened every time, I would be more confident this was an error in my rules file. However since it does work on occasion I’m almost leaning toward a hardware issue or maybe something went wrong with my java install? I’m completely at a loss here.

here is my .items file as it pertains to this issue:

Dimmer House_Lights "House Lighting" (Lights)

Dimmer Hue_1 "Downstairs Hallway 1" (GAF_Lights)
Dimmer Hue_2 "Bedroom Extra 1" (GAF_Lights)
Dimmer Hue_3 "Bedroom 1" (GAF_Lights)
Dimmer Hue_4 "Bedroom 2" (GAF_Lights)
Dimmer Hue_5 "Bedroom 3" (GAF_Lights)
Dimmer Hue_6 "Bedroom Extra 2" (GAF_Lights)
Dimmer Hue_7 "Dining Room Light 1" (GAF_Lights)
Dimmer Hue_8 "Office 1 Light 1" (GAF_Lights)
Dimmer Hue_9 "Downstairs Hallway 2" (GAF_Lights)
Dimmer Hue_10 "Second Floor Hallway Light 1" (GAF_Lights)
Dimmer Hue_11 "Second Floor Hallway Light 2" (GAF_Lights)
Dimmer Hue_12 "Office 1 Light 2" (GAF_Lights)
Dimmer Hue_13 "Downstairs Enterance Light 1" (GAF_Lights)
Dimmer Hue_14 "Office 2 Light 1" (GAF_Lights) 
Dimmer Hue_15 "Office 2 Light 2" (GAF_Lights)
Dimmer Hue_16 "Downstairs Enterance Light 2" (GAF_Lights) 
Dimmer Hue_17 "Garage Light" (GAF_Lights)
Dimmer Hue_18 "Kitchen Light 1" (GAF_Lights)
Dimmer Hue_19 "Kitchen Light 2" (GAF_Lights)
Dimmer Hue_20 "Kitchen Light 3" (GAF_Lights)
Dimmer Hue_21 "Dining Room Light 2" (GAF_Lights)
Dimmer Hue_22 "Dining Room Light 3" (GAF_Lights)
Dimmer Hue_23 "Bedside Light 1" (GAF_Lights)
Dimmer Hue_25 "Bedside Light 2" (GAF_Lights)
Dimmer Hue_24 "Laundry Room Light" (GAF_Lights)
Dimmer Hue_26 "Living Room Light 1" (GAF_Lights)
Dimmer Hue_27 "Living Room Light 2" (GAF_Lights)
Dimmer Hue_28 "Living Room Light 3" (GAF_Lights)
Dimmer Hue_29 "Living Room Light 4" (GAF_Lights)
Dimmer Hue_30 "Living Room Light 5" (GAF_Lights)
Dimmer Hue_32 "Basement Hallway Enterance Light 1" (GAF_Lights)
Dimmer Hue_31 "Basement Hallway Enterance Light 2" (GAF_Lights)
Dimmer Hue_36 "Basement Hallway Main Light 1" (GAF_Lights)
Dimmer Hue_35 "Basement Hallway Main Light 2" (GAF_Lights)
Dimmer Hue_40 "Furnace Room Light" (GAF_Lights)
Dimmer Hue_37 "Cold Room Light" (GAF_Lights)
Dimmer Hue_39 "Storage Room Light" (GAF_Lights)
Dimmer Hue_34 "Basement Office Light 1" (GAF_Lights)
Dimmer Hue_38 "Basement Office Light 2" (GAF_Lights)
Dimmer Hues_1 "Basement Staircase Light" (GAF_Lights)
Dimmer Hues_2 "Basement Living Room Light 2" (GAF_Lights)
Dimmer Hues_3 "Basement Living Room Light 3" (GAF_Lights)
Dimmer Hues_4 "Basement Living Room Light 4" (GAF_Lights)
Dimmer Hues_5 "Basement Living Room Light 5" (GAF_Lights)
Dimmer Hues_6 "Basement Living Room Light 1" (GAF_Lights)

here is the rule i am using:

rule "All Lighting"
when	
	Item House_Lights received update
then
	sendCommand (Hue_1, House_Lights.state)
	sendCommand (Hue_2, House_Lights.state)
	sendCommand (Hue_3, House_Lights.state)
	sendCommand (Hue_4, House_Lights.state)
	sendCommand (Hue_5, House_Lights.state)
	sendCommand (Hue_6, House_Lights.state)
	sendCommand (Hue_7, House_Lights.state)
	sendCommand (Hue_8, House_Lights.state)
	sendCommand (Hue_9, House_Lights.state)
	sendCommand (Hue_10, House_Lights.state)
	sendCommand (Hue_11, House_Lights.state)
	sendCommand (Hue_12, House_Lights.state)
	sendCommand (Hue_13, House_Lights.state)
	sendCommand (Hue_14, House_Lights.state)
	sendCommand (Hue_15, House_Lights.state)
	sendCommand (Hue_16, House_Lights.state)
	sendCommand (Hue_17, House_Lights.state)
	sendCommand (Hue_18, House_Lights.state)
	sendCommand (Hue_19, House_Lights.state)
	sendCommand (Hue_20, House_Lights.state)
	sendCommand (Hue_21, House_Lights.state)
	sendCommand (Hue_22, House_Lights.state)
	sendCommand (Hue_23, House_Lights.state)
	sendCommand (Hue_24, House_Lights.state)
	sendCommand (Hue_25, House_Lights.state)
	sendCommand (Hue_26, House_Lights.state)
	sendCommand (Hue_27, House_Lights.state)
	sendCommand (Hue_28, House_Lights.state)
	sendCommand (Hue_29, House_Lights.state)
	sendCommand (Hue_30, House_Lights.state)	
	sendCommand (Hue_31, House_Lights.state)
	sendCommand (Hue_32, House_Lights.state)
	sendCommand (Hue_33, House_Lights.state)
	sendCommand (Hue_34, House_Lights.state)
	sendCommand (Hue_35, House_Lights.state)
	sendCommand (Hue_36, House_Lights.state)
	sendCommand (Hue_37, House_Lights.state)
	sendCommand (Hue_38, House_Lights.state)
	sendCommand (Hue_39, House_Lights.state)
	sendCommand (Hue_40, House_Lights.state)
	sendCommand (Hues_1, House_Lights.state)
	sendCommand (Hues_2, House_Lights.state)
	sendCommand (Hues_3, House_Lights.state)
	sendCommand (Hues_4, House_Lights.state)
	sendCommand (Hues_5, House_Lights.state)
	sendCommand (Hues_6, House_Lights.state)

end

Thanks in advance.

  • Platform information:
    • Hardware: i3-4130/12GB RAM
    • OS: Win7 SP1
    • Java Runtime Environment: Zulu 9.0.0.15-jdk9.0.0
    • openHAB version: 2.1

It is almost certainly just a timing issue caused by your rule being triggered when the Item is updated during OH startup before all your Items have been loaded and are available.

First, try changing your rule to trigger on received command.

Second, this is a really inefficient (for you the programmer) and hard to manage way to implement this.

If you define GAF_Lights as:

Group:Dimmer:MAX GAF_Lights

Then you can put GAF_Lights on your sitemap or where every you use House_Lights using

Slider item=GAF_Lights

And you don’t need any rule at all.

At a minimum, you can replace the body of your existing rule with:

then
    GAF_Lights.sendCommand(House_Lights.state)
end

Thank you very much. as you can clearly tell i am not a programmer by trade and until now neither by hobby. Unsurprisingly this worked. I used your primary suggestion of controlling the group as a dimmer item in the sitemap. I have no issues as far as performance of the actual bulbs are concerned. However I seem to be getting a plethora of errors that all read:

2017-11-07 20:56:56.959 [ERROR] [rthome.core.library.items.DimmerItem] - Tried to set invalid state 1.00000000 on item GAF_Lights of type DimmerItem, ignoring it

My group in the items file now reads:

Group:Dimmer:MAX GAF_Lights "All Lights" (Lights)

And my sitemap now reads:

	Slider item=GAF_Lights

I have also removed my “All lighting” rule to avoid any conflict.

Any idea whats going on here?

For some reason, the Slider is returning a floating point number rather than an integer between 0 and 100. A Dimmer Item can only accept integers between 0 and 100. Slider isn’t supposed to do that so I’m not sure why this is happening.