Rule to cycle through all light colors

Hey Folks,

I’m looking to create a rule that will cycle through all colors for an RGB bulb. I created a rule that i’ll post below but it’s heavy and not overly reliable. I think there’s a race condition in there somewhere but I can’t isolate it. I’m hoping someone else has attempted this and has a better solution. Currently I have hue bulbs and I read something about sending a command to the API to change the colour the way I want. However, I didn’t understand much of what I was reading and there weren’t much details on how to do it. Plus, i’d like to not be limited to hue bulbs. I’m expecting an arduino and some arduino paraphernalia in the mail today so it wont be long before i’m pumping out custom RGB strips. I’d like my solution to be rule based so I can use it for any RGB bulb. I have no preference between fixing what I wrote or dumping it for something that works reliably.

The rule that only works 90% of the time:

		var DecimalType hue = new DecimalType(0) // 0-360; 0=red, 120=green, 240=blue, 360=red(again)
		var PercentType sat = new PercentType(75) // 0-100
		var PercentType bright = new PercentType(100) // 0-100		
		var HSBType light
		var String direction
		logDebug("TVRoom", "Starting Loop")
		while(TVRoom_FloorLamp_LightingAutomation.state == 12){		
			logDebug("TVRoom", "Color Looping")
			logDebug("TVRoom", "FloorLamp Light Direction: " + direction)
			if(direction != "down"){
				hue = new DecimalType(hue + 5)
				logDebug("TVRoom", "Hue: " +hue + " Sat: " +sat + " Bright: " +bright)
				Thread::sleep(200)
				light = new HSBType(hue,sat,bright)
				Light_FF_TVRoom_FloorLamp_Control.sendCommand("ON")
				logDebug("TVRoom", "Color: " +light)
				Light_FF_TVRoom_FloorLamp_Color_level.sendCommand(light)
			}
			else
			logDebug("TVRoom", "FloorLamp Light Direction: " + direction)
			if(direction == "down"){
				hue = new DecimalType(hue - 5)
				logDebug("TVRoom", "Hue: " +hue + " Sat: " +sat + " Bright: " +bright)
				Thread::sleep(200)
				light = new HSBType(hue,sat,bright)			
				Light_FF_TVRoom_FloorLamp_Control.sendCommand("ON")			
				logDebug("TVRoom", "Color: " +light)
				Light_FF_TVRoom_FloorLamp_Color_level.sendCommand(light)
			}		
			if(hue >= 360){
				direction = "down"
				logDebug("TVRoom", "FloorLamp Light New Direction: " + direction)
			}
			else
			if(hue <= 0){
				direction = "up"
				logDebug("TVRoom", "FloorLamp Light New Direction: " + direction)
			}
			
			Thread::sleep(200)
			logDebug("TVRoom", "Lighting FloorLamp - Automation Timer = " + TVRoom_FloorLamp_LightingAutomationTimer.state + " Automation Overide Timer = " + TVRoom_FloorLamp_LightingAutomationTimer_OR.state)
			logDebug("TVRoom", "Lighting FloorLamp - Light Steps = " + TVRoom_FloorLamp_Light_Adjuster.state + " Light Adjuster Delay " + TVRoom_FloorLamp_Light_Adjuster_Timer.state)
			logDebug("TVRoom", "Lighting FloorLamp - Light Color = " + Light_FF_TVRoom_FloorLamp_Color_level.state)
		
		}
import org.eclipse.xtext.xbase.lib.Functions

val Functions$Function3 <SwitchItem, ColorItem, NumberItem, Boolean> cycleColors = [ light, lightColor, mode |
    var hue = 0
    val sat = new PercentType(75)
    val bright = new PercentType(100)
    var direction = 1
    val long pause = 200

    logInfo("color", "Starting color loop for " + light.name)
    
    // Make sure the light is ON
    if(light.state != ON) light.sendCommand(ON)
    
    while(mode.state == 12 && light.state == ON) {
    	
    	Thread::sleep(pause)
    	
    	hue = hue + (5 * direction)
    	if(hue >= 360) {
    		hue = 360
    		direction = direction * -1
    	}
    	else if (hue < 0) {
    		hue = 0
    		direction = direction * -1
    	}
    	
    	lightColor.sendCommand(new HSBType(new DecimalType(hue), sat, bright).toString) // for some reason Designer marks just HSBType as ambiguous function call so I call toString
    }
    
    true    
]

rule "TV Room Floor Lamp Color Cycle"
when
    Item TVRoom_FloorLamp_LightingAutomation changed
then
    if(TVRoom_FloorLamp_LightingAutomation.state == 12 )  {
        cycleColors.apply(Light_FF_TVRoom_FloorLamp_Control, Light_FF_TVRoom_FloorLamp_Color_level, TVRoom_FloorLamp_LightingAutomation)
    }
end

You do not explain what you mean by “only works 90% of the time.” What does it do/fail to do when if fails? I can’t say if this will fix anything.

The only major logical change I made above was to only send the ON command once just before the loop and even then only if the light isn’t already on.

This lambda can be called with other lights which should make it reusable without copy and paste.

You might consider passing in the loop pause time so you can control how fast or slowly it loops on a light by light basis.

I assumed that setting TVRoom_FloorLamp_LightingAutomation to 12 is what kicks off this rule and when that Item changes state the cycling through color should stop. I also added logic to stop the rule when the Light itself is turned off.

I removed most of the logging for code clarity.

While I did type the above into Designer so it is syntatically correct, it could have logic errors as I have no way to run it.

1 Like

@rlkoshak you’re my hero!!

I’ll give your re-write a try this weekend. It already looks sexier than what I created.

Sorry, I feel like i’m always writing a novel when I post because i’m such a talker and I’m assuming that’s annoying for you folks to read so I try to keep it short and sweet.

So, when it fails either the light doesn’t turn on at all or it turns on and is stuck on one color (usually a shade of red). Checking the logs reveals nothing useful and i added all those logging entries to see the state of the variables. When it fails all required items and variables have valid values so based on past issues I assumed there was a race condition.

Thanks! Light_FF_TVRoom_FloorLamp_Color_level is not bound to the actual bulb and there’s another rule block that will run interference if the bulb is or should be off. TVRoom_FloorLamp_LightingAutomation sets the lighting mode so as long as it’s not set to 10 the light is more than likely on or it should be turned on and this rule helps drive the turning on of the light(it’s only a small snippet of a much larger rule). Hmmm, after typing that out i’m realizing I may have to remove that condition of the bulb being on. I’ll play around with it and see what happens.

You sell this lambda thing hard. And you’ve convinced me in previous posts, I’ve already bought into it so I get why. Unfortunately I haven’t had time to really dive into this. I’ve seen you post a few times that it should make the rule reusable but I just don’t see how. At the risk of thread jacking my own post, how would you use this for multiple items?

if I have 2 items (Light_FF_TVRoom_FloorLamp_Color_level and Light_FF_TVRoom_Ceiling_Color_level) how would I control these two items with one rule and set them to different colors and/or brightness? I know it’s kind of a trick question because this rule cycles through all colors but I just I can’t visualize the syntax.

They are not a panacea. Personally, I prefer to figure out a way to only need one Rule to drive everything rather than a lot of different rules that all do the same thing only on different Items. But sometimes a lambda like this is the right solution. Without more context, a lambda is the best I could recommend given your stated requirements.

Look at the rule “TV Room Floor Lamp Color Cycle” in my example above. The lambda itself is just a global val. The rule shows you how to call the lambda. It is reusable because you pass in the Switch, Color, and Number Items when you call it. For example:

cycleColors.apply(Control1, Color1, Automation1)
cycleColors.apply(Control2, Color2, Automation2)
cycleColors.apply(Control3, Color3, Automation3)

Replace ControlN, ColorN, and AutomationN with the names of your various Items (see the example in the rule above).

Assuming the lambda above to make them both cycle, and assuming that both have corresponding Control Switch and LightingAutomation Items:

cycleColors.apply(Light_FF_TVRoom_FloorLamp_Control, Light_FF_TVRoom_FloorLamp_Color_level, TVRoom_FloorLamp_LightingAutomation)
cycleColors.apply(Light_FF_TVRoom_Ceiling_Control, Light_FF_TVRoom_Ceiling_Color_level, Light_FF_TVRoom_Ceiling_LightingAutomation)

Hi,
I have an issue with this rules.
My RGB lamp, is a YeeLight and have not a Switch Item associate, i send ON/OFF command to Color item.
When i use this code:

while(mode.state == ON && light.state == ON) {

Never work, because the .state for a color item, is the RGB value.
How can I get the ON/OFF state of a color item?

Many thanks
Marco

light.getStateAs(OnOffType)

Many Thanks

Regards

Hi
trying code but something gone wrong and I cannot understand what.
Running rules, it count hue from 0 to 360, and lamp change all colors, but when hue reach 360, the routine take 1st if:

if(hue >= 360) {
    		hue = 360
    		direction = direction * -1
            logInfo("CycleColor", "Direction up direction="+direction.toString)
    	}

and then stop here, i see last line of log with direction -1 and none after.
I’m fighting with this from 2 hours

Marco

Post your version of the full Rule.

here it is:

import org.eclipse.xtext.xbase.lib.Functions

val Functions$Function3 <SwitchItem, ColorItem, NumberItem, Boolean> cycleColors = [ light, lightColor, mode |
    var hue = 0
    val sat = new PercentType(75)
    val bright = new PercentType(100)
    var direction = 1
    val long pause = 200

    logInfo("CycleColor", "Starting color loop for " + light.name)
    
    // Make sure the light is ON
    if(light.state != ON) light.sendCommand(ON)
    
    logInfo("CycleColor", "mode " + mode.state)
    logInfo("CycleColor", "light " + light.getStateAs(OnOffType))

    while(mode.state == ON && light.getStateAs(OnOffType) == ON) {
    	
    	Thread::sleep(pause)
    	hue = hue + (5 * direction)
        logInfo("CycleColor", "Loop round for " + light.name + " hue="+hue.toString+" direction="+direction.toString)

    	if(hue >= 360) {
    		hue = 360
    		direction = direction * -1
            logInfo("CycleColor", "Direction up direction="+direction.toString)
    	}
    	else if (hue < 0) {
    		hue = 0
    		direction = direction * -1
            logInfo("CycleColor", "Direction down")
    	}
    	
    	lightColor.sendCommand(new HSBType(new DecimalType(hue), sat, bright).toString) // for some reason Designer marks just HSBType as ambiguous function call so I call toString
    }
    
    true    
]

rule "TV Room Floor Lamp Color Cycle"
when
    Item YL_1_CYCLE changed
then
    if(YL_1_CYCLE.state == ON )  {
        logInfo("CycleColor", "Color Loop Activated")
        cycleColors.apply(YL_1_RGB, YL_1_RGB, YL_1_CYCLE)
    } else {
        YL_1_RGB.sendCommand(OFF)
    }
end

Let’s bring the syntax up to date and get rid of the sleep.

The problem is if you have two Rules running this lambda at the same time, they will stomp over each other’s variables because lambdas are not thread safe. If at all possible, you would be much better off making a generic Rule rather than using a lambda for this.

import java.util.Map
import org.eclipse.smarthome.model.script.ScriptServiceUtil

val cycleSat = new PercentType(75)
val cycleBright = new PercentType(100)
val pause = 200
var Map<String, Timer> cycleTimers = newHashMap

rule "A light color cycle"
when
    Member of LightCyclers changed
then
    // Get the light associated with this cycler
    val light = ScriptServiceUtil.getItemRegistry.getItem(triggeringItem.name.replace("CYCLE", "RGB"))

    // turn off the cycling
    if(triggeringItem.state != ON) {
        light.sendCommand(OFF)
        return;
    }

    // Start cycling
    logInfo("CycleColor", "Color Loop Activated")
    
    var hue = 0
    val direction = 1

    // turn on the light if it isn't already
    if(light.getStateAs(OnOffType) != ON) light.sendCommand(ON)

    cycleTimers.get(triggeringItem.name)?.cancel // if there is a timer already running, cancel it

    // create a timer to trigger immediately
    cycleTimers.put(triggeringItem.name, createTimer(now, [ |

        // while the cycle flag is ON and the light remains ON, move the color
        if(triggeringItem.state == ON && light.getStateAs(OnOffType) == ON) {
            hue = hue + (5 * direction)
            
            if(hue >= 360) {
                hue = 360
                direction = direction * -1
            }
            else if(hue <=0) {
                hue = 0
                direction = direction * -1
            }

            light.sendCommand(new HSBType(new DecimalType(hue), sat, bright)) // shouldn't have the ambiguous function call problem any more

            // Set the timer to run again in pause milliseconds
            cycleTimers.get(triggeringItem.name).reschedule(now.plusMillis(pause))
        }

        // set the timer to null now that we are done
        else cycleTimers.put(triggeringItem.name, null)
    ]))

end

I just typed this in so there may be typos.

1 Like

Hi,
I have only one rule that fire this lambda, but to cancel any doubt, I’ll use a dedicated rule and I’ll let you know

Marco

Hi @rlkoshak,
opening your code to an editor i got some alert on variable and command inside timer:
image
image
image

In the log I got this exception when timer is reached:

2019-01-25 17:38:47.442 [ERROR] [org.quartz.core.JobRunShell         ] - Job DEFAULT.2019-01-25T17:38:47.439+01:00: Proxy for org.eclipse.xtext.xbase.lib.Procedures$Procedure0: [ | {
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  org.eclipse.xtext.xbase.impl.XIfExpressionImpl@34f28488
} ] threw an unhandled Exception:
java.lang.reflect.UndeclaredThrowableException: null
        at com.sun.proxy.$Proxy1732.apply(Unknown Source) ~[?:?]
        at org.eclipse.smarthome.model.script.internal.actions.TimerExecutionJob.execute(TimerExecutionJob.java:49) ~[?:?]
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh240]
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh240]
Caused by: org.eclipse.smarthome.model.script.engine.ScriptExecutionException: The name 'sat' cannot be resolved to an item or type; line 58, column 65, length 3
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:141) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:902) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:865) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:224) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluateArgumentExpressions(XbaseInterpreter.java:1116) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:746) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:238) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluateArgumentExpressions(XbaseInterpreter.java:1116) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._invokeFeature(XbaseInterpreter.java:1046) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeFeature(XbaseInterpreter.java:992) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:151) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:772) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:220) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:447) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:228) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:460) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:244) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:447) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:228) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluate(XbaseInterpreter.java:190) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.ClosureInvocationHandler.doInvoke(ClosureInvocationHandler.java:46) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.AbstractClosureInvocationHandler.invoke(AbstractClosureInvocationHandler.java:29) ~[?:?]
        ... 4 more
2019-01-25 17:38:47.447 [INFO ] [light.internal.lib.device.DeviceBase] - ######### this is control command response, don't need to notify status change!
2019-01-25 17:38:47.455 [ERROR] [org.quartz.core.ErrorLogger         ] - Job (DEFAULT.2019-01-25T17:38:47.439+01:00: Proxy for org.eclipse.xtext.xbase.lib.Procedures$Procedure0: [ | {
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  org.eclipse.xtext.xbase.impl.XIfExpressionImpl@34f28488
} ] threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception.
        at org.quartz.core.JobRunShell.run(JobRunShell.java:213) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh240]
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh240]
Caused by: java.lang.reflect.UndeclaredThrowableException
        at com.sun.proxy.$Proxy1732.apply(Unknown Source) ~[?:?]
        at org.eclipse.smarthome.model.script.internal.actions.TimerExecutionJob.execute(TimerExecutionJob.java:49) ~[?:?]
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202) ~[?:?]
        ... 1 more
Caused by: org.eclipse.smarthome.model.script.engine.ScriptExecutionException: The name 'sat' cannot be resolved to an item or type; line 58, column 65, length 3
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:141) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:902) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:865) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:224) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluateArgumentExpressions(XbaseInterpreter.java:1116) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:746) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:238) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluateArgumentExpressions(XbaseInterpreter.java:1116) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._invokeFeature(XbaseInterpreter.java:1046) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeFeature(XbaseInterpreter.java:992) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:151) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:772) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:220) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:447) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:228) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:460) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:244) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:447) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:228) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluate(XbaseInterpreter.java:190) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.ClosureInvocationHandler.doInvoke(ClosureInvocationHandler.java:46) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.AbstractClosureInvocationHandler.invoke(AbstractClosureInvocationHandler.java:29) ~[?:?]
        at com.sun.proxy.$Proxy1732.apply(Unknown Source) ~[?:?]
        at org.eclipse.smarthome.model.script.internal.actions.TimerExecutionJob.execute(TimerExecutionJob.java:49) ~[?:?]
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202) ~[?:?]
        ... 1 more

I’m little bit disoriented, your code is using method and functionality I don’t know yet.
Kindly regards

Marco

Hi @rlkoshak
I think the issue was here:

 light.sendCommand(new HSBType(new DecimalType(hue), cycleSat, cycleBright))

now cycle start, but I have same behavoiur, when hue reach 360, loop stop and an exception in the log:

2019-01-25 17:54:52.233 [INFO ] [se.smarthome.model.script.CycleColor] - Trigger Item:YL_1_CYCLE light:YL_1_RGB
2019-01-25 17:54:52.233 [INFO ] [se.smarthome.model.script.CycleColor] - Trigger Item:ON light:ON
2019-01-25 17:54:52.235 [INFO ] [se.smarthome.model.script.CycleColor] - Light State=285,75,100
2019-01-25 17:54:52.235 [INFO ] [se.smarthome.model.script.CycleColor] - hue=355
2019-01-25 17:54:52.238 [INFO ] [light.internal.lib.device.DeviceBase] - status = DeviceStatus [isPowerOff=false, r=207, g=63, b=255, color=13582335, brightness=50, ct=5108, hue=285, sat=75, isFlowing=false, delayOff=-1, mFlowItems=null, mode=MODE_COLOR, isMusicOn=false, name=]
2019-01-25 17:54:52.437 [INFO ] [se.smarthome.model.script.CycleColor] - Trigger Item:YL_1_CYCLE light:YL_1_RGB
2019-01-25 17:54:52.437 [INFO ] [se.smarthome.model.script.CycleColor] - Trigger Item:ON light:ON
2019-01-25 17:54:52.439 [ERROR] [org.quartz.core.JobRunShell         ] - Job DEFAULT.2019-01-25T17:54:37.887+01:00: Proxy for org.eclipse.xtext.xbase.lib.Procedures$Procedure0: [ | {
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  org.eclipse.xtext.xbase.impl.XIfExpressionImpl@1853057a
} ] threw an unhandled Exception:
java.lang.IllegalArgumentException: Hue must be between 0 and 360
        at org.eclipse.smarthome.core.library.types.HSBType.validateValue(HSBType.java:106) ~[?:?]
        at org.eclipse.smarthome.core.library.types.HSBType.<init>(HSBType.java:81) ~[?:?]
        at sun.reflect.GeneratedConstructorAccessor1318.newInstance(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:752) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:238) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluateArgumentExpressions(XbaseInterpreter.java:1116) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._invokeFeature(XbaseInterpreter.java:1046) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeFeature(XbaseInterpreter.java:992) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:151) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:772) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:220) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:447) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:228) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:460) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:244) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:447) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:228) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluate(XbaseInterpreter.java:190) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.ClosureInvocationHandler.doInvoke(ClosureInvocationHandler.java:46) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.AbstractClosureInvocationHandler.invoke(AbstractClosureInvocationHandler.java:29) ~[?:?]
        at com.sun.proxy.$Proxy1732.apply(Unknown Source) ~[?:?]
        at org.eclipse.smarthome.model.script.internal.actions.TimerExecutionJob.execute(TimerExecutionJob.java:49) ~[?:?]
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh240]
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh240]
2019-01-25 17:54:52.452 [ERROR] [org.quartz.core.ErrorLogger         ] - Job (DEFAULT.2019-01-25T17:54:37.887+01:00: Proxy for org.eclipse.xtext.xbase.lib.Procedures$Procedure0: [ | {
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  org.eclipse.xtext.xbase.impl.XIfExpressionImpl@1853057a
} ] threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception.
        at org.quartz.core.JobRunShell.run(JobRunShell.java:213) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh240]
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh240]
Caused by: java.lang.IllegalArgumentException: Hue must be between 0 and 360
        at org.eclipse.smarthome.core.library.types.HSBType.validateValue(HSBType.java:106) ~[?:?]
        at org.eclipse.smarthome.core.library.types.HSBType.<init>(HSBType.java:81) ~[?:?]
        at sun.reflect.GeneratedConstructorAccessor1318.newInstance(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:752) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:238) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluateArgumentExpressions(XbaseInterpreter.java:1116) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._invokeFeature(XbaseInterpreter.java:1046) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeFeature(XbaseInterpreter.java:992) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:151) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:772) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:220) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:447) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:228) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:460) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:244) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:447) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:228) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluate(XbaseInterpreter.java:190) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.ClosureInvocationHandler.doInvoke(ClosureInvocationHandler.java:46) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.AbstractClosureInvocationHandler.invoke(AbstractClosureInvocationHandler.java:29) ~[?:?]
        at com.sun.proxy.$Proxy1732.apply(Unknown Source) ~[?:?]
        at org.eclipse.smarthome.model.script.internal.actions.TimerExecutionJob.execute(TimerExecutionJob.java:49) ~[?:?]
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202) ~[?:?]
        ... 1 more

Marco

For the hue problem, honestly, we don’t really need that variable. I only continued to use it be a little closer to the old code. But the error is a little odd because I’ve done this before. I think that VSCode is marking that as an error incorrectly. Let’s ignore it for now.

The second error (“Ambiguous feature call”) is referenced in the comment I added to that line. That used to be a problem but I thought it no longer is. It was fixed in the original code using toString on the new HSBType in the sendCommand.

The third error is because direction is defined as a val instead of a var and we are trying to change a val. It should be a var. Of course, once we do that we will get the same error we got with the hue variable.

Hi @rlkoshak
when hue reach 360 I got an exception:

2019-01-25 17:54:52.233 [INFO ] [se.smarthome.model.script.CycleColor] - Trigger Item:YL_1_CYCLE light:YL_1_RGB
2019-01-25 17:54:52.233 [INFO ] [se.smarthome.model.script.CycleColor] - Trigger Item:ON light:ON
2019-01-25 17:54:52.235 [INFO ] [se.smarthome.model.script.CycleColor] - Light State=285,75,100
2019-01-25 17:54:52.235 [INFO ] [se.smarthome.model.script.CycleColor] - hue=355
2019-01-25 17:54:52.238 [INFO ] [light.internal.lib.device.DeviceBase] - status = DeviceStatus [isPowerOff=false, r=207, g=63, b=255, color=13582335, brightness=50, ct=5108, hue=285, sat=75, isFlowing=false, delayOff=-1, mFlowItems=null, mode=MODE_COLOR, isMusicOn=false, name=]
2019-01-25 17:54:52.437 [INFO ] [se.smarthome.model.script.CycleColor] - Trigger Item:YL_1_CYCLE light:YL_1_RGB
2019-01-25 17:54:52.437 [INFO ] [se.smarthome.model.script.CycleColor] - Trigger Item:ON light:ON
2019-01-25 17:54:52.439 [ERROR] [org.quartz.core.JobRunShell         ] - Job DEFAULT.2019-01-25T17:54:37.887+01:00: Proxy for org.eclipse.xtext.xbase.lib.Procedures$Procedure0: [ | {
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  org.eclipse.xtext.xbase.impl.XIfExpressionImpl@1853057a
} ] threw an unhandled Exception:
java.lang.IllegalArgumentException: Hue must be between 0 and 360
        at org.eclipse.smarthome.core.library.types.HSBType.validateValue(HSBType.java:106) ~[?:?]
        at org.eclipse.smarthome.core.library.types.HSBType.<init>(HSBType.java:81) ~[?:?]
        at sun.reflect.GeneratedConstructorAccessor1318.newInstance(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:752) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:238) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluateArgumentExpressions(XbaseInterpreter.java:1116) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._invokeFeature(XbaseInterpreter.java:1046) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeFeature(XbaseInterpreter.java:992) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:151) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:772) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:220) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:447) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:228) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:460) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:244) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:447) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:228) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluate(XbaseInterpreter.java:190) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.ClosureInvocationHandler.doInvoke(ClosureInvocationHandler.java:46) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.AbstractClosureInvocationHandler.invoke(AbstractClosureInvocationHandler.java:29) ~[?:?]
        at com.sun.proxy.$Proxy1732.apply(Unknown Source) ~[?:?]
        at org.eclipse.smarthome.model.script.internal.actions.TimerExecutionJob.execute(TimerExecutionJob.java:49) ~[?:?]
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh240]
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh240]
2019-01-25 17:54:52.452 [ERROR] [org.quartz.core.ErrorLogger         ] - Job (DEFAULT.2019-01-25T17:54:37.887+01:00: Proxy for org.eclipse.xtext.xbase.lib.Procedures$Procedure0: [ | {
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  org.eclipse.xtext.xbase.impl.XIfExpressionImpl@1853057a
} ] threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception.
        at org.quartz.core.JobRunShell.run(JobRunShell.java:213) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh240]
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh240]
Caused by: java.lang.IllegalArgumentException: Hue must be between 0 and 360
        at org.eclipse.smarthome.core.library.types.HSBType.validateValue(HSBType.java:106) ~[?:?]
        at org.eclipse.smarthome.core.library.types.HSBType.<init>(HSBType.java:81) ~[?:?]
        at sun.reflect.GeneratedConstructorAccessor1318.newInstance(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:752) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:238) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluateArgumentExpressions(XbaseInterpreter.java:1116) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._invokeFeature(XbaseInterpreter.java:1046) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeFeature(XbaseInterpreter.java:992) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:151) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:772) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:220) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:447) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:228) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:460) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:244) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:447) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:228) ~[?:?]
        at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluate(XbaseInterpreter.java:190) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.ClosureInvocationHandler.doInvoke(ClosureInvocationHandler.java:46) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.AbstractClosureInvocationHandler.invoke(AbstractClosureInvocationHandler.java:29) ~[?:?]
        at com.sun.proxy.$Proxy1732.apply(Unknown Source) ~[?:?]
        at org.eclipse.smarthome.model.script.internal.actions.TimerExecutionJob.execute(TimerExecutionJob.java:49) ~[?:?]
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202) ~[?:?]
        ... 1 more

I think this is the reason because loop stop here and i a lambda function.
I have no Idea what exception mean

Marco

Add logging to the timer code and log out the value of hue and direction each time through the loop. Is it actually stopping the loop or is it continuing to loop and just continuing to set the Hue to 360?

It means that the

            if(hue >= 360) {
                hue = 360
                direction = direction * -1
            }

is not running.

java.lang.IllegalArgumentException: Hue must be between 0 and 360

Or it means that 360 is not value and 359 is the maximum value. You can try to change the 360’s to 359s.

the values are 0-359.
There also an error in paperui, When you go to the “control” section, you see your things…
You can see eg a hue extended color bulb.
There’s a slider for color,brightnes,saturation and another one for color temperature (if you have defined items for all channels…)
When you push the slider for color to the most right, you get something like
“Received HTTP POST request at ‘items/GV_Woonkamer_Tafellamp_1_Color’ with an invalid status value ‘360,89,0’”
As long you don’t slide the slider to the most right position, (so it doesn’t reach 360,) there’s no problem.
I guess it’s a little problem in paperui…

BTW, can we create the same layout in sitemaps? I don’t know how to separate the hsbtype value (as is done in paperui). I would like to have three sliders in this case for them, in stead of that color wheel.
(I know, I can do some programming for it, but if it’s available for paperui,maybe I’m missing something)

Only if you create Design Pattern: Proxy Item for each value and a simple Rules to sync between the Color Item and the individual proxies.