Performance of HUE Rules with RPI 3

At first of all i have to say, that openHAB is great. Im very impressed because of the well designed openhabian Image. I switched from FHEM to openHAB because FHEM had too much perl in it and expected too much customization.

To my Problem:
My Requirement: Set HUE Scenes via openHAB. In this case the color of light has to Change dependend from time. This Scene does stand for 11 other Scenes, where i working with more than one color at once. i Can imagine that in this case i could group my bulbs to set them
Problem: The Scenes turning on very slow over 5 Seconds (sometimes they either doesnt turn on)
My Hardware: RPI 3 This Problem does not occur on other Rules(like homematic).

My Expectation from this Thread:
Check whether my way of coding and concept are the best practice and verify, that there arent any slow performers.

To my Solution:

Switch Wohnzimmer_Licht "Wohnzimmerlicht" <light> [ "Switchable" ]


rule "Wohnzimmerlicht einschalten"
        Item Wohnzimmer_Licht changed to ON
        var DecimalType whitecolor = new DecimalType(47) // 0-360; 0=red, 120=green, 240=blue, 360=red(again)
        var DecimalType whitecolor_hell = new DecimalType(0)
        var PercentType sat = new PercentType(40) // 0-100
        var PercentType bright = new PercentType(100) // 0-100
        var PercentType sat_hell = new PercentType(0) // 0-100
        var PercentType bright_hell = new PercentType(100) // 0-100
        var HSBType white = new HSBType(whitecolor,sat,bright)
        var HSBType white_bright = new HSBType(whitecolor_hell,sat_hell,bright_hell)
        if (now.getHourOfDay() >= 19 || now.getHourOfDay() <= 6) {
                sendCommand(Wohnzimmer_Hue_1_Color , white)
                sendCommand(Wohnzimmer_Hue_2_Color , white)
                sendCommand(Wohnzimmer_Hue_3_Color , white)
                sendCommand(Wohnzimmer_Hue_4_Color , white)
                sendCommand(Wohnzimmer_Hue_5_Color , white)
        else {
                sendCommand(Wohnzimmer_Hue_1_Color , white_bright)
                sendCommand(Wohnzimmer_Hue_2_Color , white_bright)
                sendCommand(Wohnzimmer_Hue_3_Color , white_bright)
                sendCommand(Wohnzimmer_Hue_4_Color , white_bright)
                sendCommand(Wohnzimmer_Hue_5_Color , white_bright)
        postUpdate(Wohnzimmerbeleuchtung, ON)
        postUpdate(Wohnzimmer_Rotlicht, OFF)
        postUpdate(Wohnzimmer_Blaulicht, OFF)

one more rule, that uses 2 colors, but is based on the above one:

rule "Effekt 3 einstellen"
        Item Wohnzimmer_Effekt_3 changed to ON
        var DecimalType hue1 = new DecimalType(58.98) // 0-360; 0=red, 120=green, 240=blue, 360=red(again)
        var PercentType sat1 = new PercentType(80.99) // 0-100
        var PercentType bright1 = new PercentType(100) // 0-100
        var DecimalType hue2 = new DecimalType(4.98) // 0-360; 0=red, 120=green, 240=blue, 360=red(again)
        var PercentType sat2 = new PercentType(80.99) // 0-100
        var PercentType bright2 = new PercentType(100) // 0-100
        var HSBType color1  = new HSBType(hue1,sat1,bright1)
        var HSBType color2  = new HSBType(hue2,sat2,bright2)
        sendCommand(Wohnzimmer_Hue_1_Color , color1)
        sendCommand(Wohnzimmer_Hue_2_Color , color2)
        sendCommand(Wohnzimmer_Hue_3_Color , color2)
        sendCommand(Wohnzimmer_Hue_4_Color , color2)
        sendCommand(Wohnzimmer_Hue_5_Color , color1)

I Also stumbled over increasing the Java Memory Sizes. Any Hints where i can do this and how this looks? The last Comment was in 2015 and i think, the has changed in this time.

Any Ideas?

Best regards!

Update: I resolved my own problem:
I did not reset the effects to Off when turning on another effect(some effects did turn off other effects, but only a few, so it was a random thing). As a consequence after a time all effects are turned on and a Change state from ON to ON does not trigger.
Okay. solved with creating an item with a rule, that updates all States of the other effects to OFF.
Group updating of states did not work (sadly), so i had do go this way.

Kind regards

Hi Dennis (@Der_Gute) ,

would you mind sharing your final, working code. I am interested in this as I am also looking for scenes/animations to be triggered with openhab and Alexa.



Hi Uwe (@uweb),
I going to send you my configuration on tuesday :slight_smile:
Best regards

At first of all i have to say, that the HUE Binding does not work as proper as i wanted(sometimes not all bulbs turned on or off). Therefore i used curl request to directly push the requests to hue api. This way i was able to set the Scenes with the hue app and call them.

My Scenario:
Samsung TV turns on (tell me if you want this code). A Rule triggers a switch, which is a randomizer for effectlight. A random number is generated and is passed to the switch condition that calls the specific scenes

rule "Effektlicht Zufall"
        Item Wohnzimmer_Effektlicht changed to ON
        var randomNum = rand.nextInt(11)
        logInfo("rules","randomnr" + randomNum)
        postUpdate(Wohnzimmer_Licht, OFF)
        switch randomNum {
        case 1: sendCommand(Wohnzimmer_Rotlicht, ON)
        case 2: sendCommand(Wohnzimmer_Bayernlicht, ON)
        case 3: sendCommand(Wohnzimmer_Blaulicht, ON)
        case 4: sendCommand(Wohnzimmer_Effekt_1, ON)
        case 5: sendCommand(Wohnzimmer_Effekt_2, ON)
        case 6: sendCommand(Wohnzimmer_Effekt_3, ON)
        case 7: sendCommand(Wohnzimmer_Effekt_4, ON)
        case 8: sendCommand(Wohnzimmer_Effekt_5, ON)
        case 9: sendCommand(Wohnzimmer_Effekt_6, ON)
        case 10: sendCommand(Wohnzimmer_Effekt_7, ON)
        case 0: sendCommand(Wohnzimmer_Effekt_8, ON)

An example for calling a Scene:

rule "Effekt 8 einstellen"
        Item Wohnzimmer_Effekt_8 changed to ON
        var String hueApiCall = "curl@@-X@@PUT@@-d@@{\"scene\": \"%s\" }@@"
        executeCommandLine(String::format(hueApiCall, "ZjFI5attO7dvmoY"))
        postUpdate(Wohnzimmer_Effektlicht_Status, OFF)
        postUpdate(Wohnzimmer_Effektlicht_Status, ON)

Explanation of the rule:
“scene”: “%s” }<— This is the String you have to Pass to JSON API is the URL you have to call (despite of group number and IP)
executeCommandLine(String::format(hueApiCall, “ZjFI5attO7dvmoY”)) <-- this string is the Scene ID you get from the hue JSON API ( )
To get all Scenes, set a get request to http://ip/api/yourapikey/scenes
postUpdate(Wohnzimmer_Effektlicht_Status, OFF)<— calls a rule that sets all other lights to OFF (to get proper status)
postUpdate(Wohnzimmer_Effektlicht_Status, ON)<— just sets the status to ON after setting it OFF
Relating to Alexa: you can pass all the homekit tags to your items. Alexa can grab them so you can call these items. Official Alexa Smart Home Skill for openHAB 2 helped me alot.

If you have questions, feel free to ask :slight_smile:


Hey Dennis, great post. I will dig into it on one of the next weekends. Looks promising to me.
As you have a Bayernlicht defined, are you located in Bavaria?
If so, greetings from FFB area :wink:


very nice idea!
I will use this randomizer also in my stair led dimmer rule for fun (when I enter the house to dim the lights from 1% to 100%) :slight_smile:

Hi Uwe,

no im from Herne, a town near dortmund! I called this Scene Bayernlicht because i looked for some easy names for alexa :smiley: This Scene combines blue light with red light. I Gave up looking for names after realizing, that i have to look for 8 more names :smiley:

Have fun with realizing your solution!