Get/Store state of a Hue lightbulb

OH 3.1.0M4 on CentOS8

Is there a method to get and store the state of a Hue light for later use in rule or script?

I’d like to set up a rule that will change the state of the light, color, saturation and brightness but then I’d like a short pause and be able to revert the light to whatever it’s previous state was.

It depends on how your are working your rules. Which language? In Congress or the UI?

I don’t have any rules setup so far just an idea.

What I’d like to do is execute an action that will query the state of a Hue bulb and save it as a variable. Run an action or multiple actions on the bulb and then using the variable restore the bulb to it’s previous state.

The thought is use the bulb as a sort of visual alert but return it to it’s state before the alert.

Here’s my javascript which sets certain lights blue for 10 seconds which I use when the doorbell rings:

var ZonedDateTime = Java.type("java.time.ZonedDateTime");
var ScriptExecution = Java.type("org.openhab.core.model.script.actions.ScriptExecution");

var flashBlue = function(light, checkOn) {
  var state = light.getState();
  if (!checkOn || state.as(OnOffType.class).equals(OnOffType.ON)) {
    events.sendCommand(light.getName(), HSBType.BLUE);
    ScriptExecution.createTimer(ZonedDateTime.now().plusSeconds(10), function() {
      if(light.getState().equals(HSBType.BLUE)) {
         events.sendCommand(light.getName(), state);
      }
    });
  }
}

flashBlue(ir.getItem("studyLight"), true);
flashBlue(ir.getItem("bedroomLight"), true);
flashBlue(ir.getItem("hallLight"), false);
flashBlue(ir.getItem("conservatoryLight"), false);

But again, we need to know what languages you are using/want to use to implement this because it is significantly different. If using JavaScript in the UI you would save the variable in a special way. If using Rules DSL in the UI you’ll have to use a separate Item. If using Rules DSL, Python, or JavaScript in text based files you’ll save the variable as a global outside the rule. If you are doing everything inside one rule using Timers or sleeps then you would just use a variable local to the rule.

So in short, the answer is yes, it’s possible. But there are half a dozen different ways to do it depending on what language you are writing rules in and whether you are using the UI or text files.

1 Like

I’m really uncommitted to any particular method right now. I don’t know javascript so playing around with the example above I’m mostly just stumbling through it while tweaking things randomly to see how they work. I have experience writing perl scripts so if one method has similarities to perl then it would probably push me in that direction.

My concept:

If <this happens>
then <save state of thing A>
     change thing A to newState
     wait 2 seconds
     change thing A to anotherState
     wait 2 seconds
     change thing A back to saved state

I think those steps will handle everything I want to do and I can add or remove steps as necessary for differences in implementation.

Back when I was running OH2.5 I had something like this working in a text rule but did not have the saved state. The rule just turned the light off or left it on depending on whether the sun was up or not. I’d like to recreate that but add in the steps of saving the state and restoring at the end of the rule.

Right now I’m taking a state change from a Nanomote Scene number and playing an mp3 to a Sonos speaker, and then sending an ON to a relay switch to trigger a garage door to open or close. I’d like to add a Hue color bulb change to red (for a second or two), then green (for another second or two) then back return that Hue bulb to it’s previous state of color, saturation, and brightness.

Well, you kind of have to make a choice because I don’t have the time to show you all the possibilities in all the languages. Since you have some .rules files already…

Assuming it’s a Color Item

rule "blah blah blah"
when
    <something happens>
then
    val lastState = <NameOfLightItem>.state

    <NameOfLightItem>.sendCommand(<newState>)
    createTimer(now.plusSeconds(2), [ | <NameOfLightItem>.sendCommand(<anotherState>) ])
    createTimer(now.plusSeconds(4), [ | <NameOfLightItem>.sendCommand(lastState)])
end

Obviously the stuff marked with < > needs to be replaced with your Item name and triggers and such.

Review the rules docs for specifics on how to construct a rule in .rules files.

It’s better to use Timers than blocking sleeps so see Actions | openHAB for how to schedule something to happen in the future.

Not exactly what you want but maybe it works for you anyways: do you know the Hue binding offers a built-in alert for most bulb types, see Philips Hue - Bindings | openHAB. Link a String item and send the command LSELECT to it, it will make the bulb flash for 4-5 seconds - does the job.

This sounds very interesting but I’ve never had to “link a string item” before so I’m not sure how to do that. I tried sending the LSELECT command to a couple of Hue items and it didn’t work that way.

It’s an advanced channel so you have to check “Show advanced” to see it:

Once the alert item is created and linked to the alert channel, you’ll see a “None” box that you can click on it to test the alert:

You’ll get a menu with the options “Alert” (raw command: SELECT) and “Long Alert” (raw command: LSELECT) that you can send to the item via rules.

Found it now and got it working. It’s close to what I want. Playing with that and the code that Rich posted a bit ago.

Well I’m definitely getting close now. Put this together just to test it out fiddle with the settings and it’s mostly working the way I want.

rule "Color Cycle Lights"
when
    Item NanoMote_SceneNumber changed from 2.2 to 2.1
then
    val lastState = OfficeRoom_Color.state
    OfficeRoom_Color.sendCommand("1,100,100")
    createTimer(now.plusSeconds(1), [ | OfficeRoom_Color.sendCommand("140,100,50") ])
    createTimer(now.plusSeconds(2), [ | OfficeRoom_Color.sendCommand("250,100,50") ])
    createTimer(now.plusSeconds(3), [ | OfficeRoom_Color.sendCommand("0,0,0") ])
    createTimer(now.plusSeconds(4), [ | OfficeRoom_Color.sendCommand(lastState) ])
end

The HUE led strip turns on red, then green, then blue, then off but doesn’t revert to the previous state at the end and I get this in the openhab.log:

2021-05-18 15:00:45.543 [WARN ] [ore.internal.scheduler.SchedulerImpl] - Scheduled job failed and stopped
java.lang.IllegalStateException: Could not invoke method: org.openhab.core.model.script.actions.BusEvent.sendCommand(org.openhab.core.items.Item,java.lang.String) on instance: null
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeOperation(XbaseInterpreter.java:1209) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeOperation(XbaseInterpreter.java:1167) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._invokeFeature(XbaseInterpreter.java:1153) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeFeature(XbaseInterpreter.java:1098) ~[?:?]
	at org.openhab.core.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:151) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:878) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:243) ~[?:?]
	at org.openhab.core.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:227) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:475) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:251) ~[?:?]
	at org.openhab.core.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:227) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluate(XbaseInterpreter.java:213) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.ClosureInvocationHandler.doInvoke(ClosureInvocationHandler.java:47) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.AbstractClosureInvocationHandler.invoke(AbstractClosureInvocationHandler.java:30) ~[?:?]
	at com.sun.proxy.$Proxy427.apply(Unknown Source) ~[?:?]
	at org.openhab.core.model.script.actions.ScriptExecution.lambda$0(ScriptExecution.java:82) ~[?:?]
	at org.openhab.core.internal.scheduler.SchedulerImpl.lambda$12(SchedulerImpl.java:184) ~[?:?]
	at org.openhab.core.internal.scheduler.SchedulerImpl.lambda$1(SchedulerImpl.java:87) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:834) [?:?]
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@3ccb6aa4
	at jdk.internal.reflect.GeneratedMethodAccessor218.invoke(Unknown Source) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeOperation(XbaseInterpreter.java:1192) ~[?:?]
	... 25 more

It should be able to handle that as written. But based on the error it doesn’t seem to understand the HSBType.

Try this:

val lastState as OfficeRoom_Color.state as HSBType

If that doesn’t work try

Office_Color.sendCommand(lastState.toString)

For some reason it can’t figure out what the lastState is. NOTE: there will be a similar error if lastState is NULL or UNDEF. If neither of the above work double check that the Item isn’t NULL.

Note, instead of sending “0,0,0” you can sendCommand(OFF).

Here’s the testing rule that works now. Got errors when I tried the first suggestion, it didn’t like the “as” being in there. Typo in the val line you sent. Should be “val lastState = Office…”

I did test both suggestions and it appears that either will work by themselves or together.

rule "Color Cycle Lights"
when
    Item NanoMote_SceneNumber changed from 2.2 to 2.1
then
    val lastState = OfficeRoom_Color.state  
    OfficeRoom_Color.sendCommand("1,100,100")
    createTimer(now.plusSeconds(1), [ | OfficeRoom_Color.sendCommand("140,100,50") ])
    createTimer(now.plusSeconds(2), [ | OfficeRoom_Color.sendCommand("250,100,50") ])
    createTimer(now.plusSeconds(3), [ | OfficeRoom_Color.sendCommand(OFF) ])
    createTimer(now.plusSeconds(4), [ | OfficeRoom_Color.sendCommand(lastState.toString)])
end
1 Like

Hi Steve

Did you confirm that the light goes back to the initial state?

I have tried with a similar rule (modified with my devices). However it seems that my Hue Group somehow affects the individual light and as a result the specific light does not go back to what the initial state was?

Logs as follows:

12:03:46.981 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'Testing_Switch' received command ON
12:03:46.981 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Testing_Switch' changed from OFF to ON
12:03:48.008 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'Huecolorspot4_Color' received command 1,100,100
12:03:48.008 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item 'Huecolorspot4_Color' predicted to become 1,100,100
12:03:48.008 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Huecolorspot4_Color' changed from 78,71,85 to 1,100,100
12:03:49.178 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'Huecolorspot4_Color' received command 140,100,50
12:03:49.178 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item 'Huecolorspot4_Color' predicted to become 140,100,50
12:03:49.194 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Huecolorspot4_Color' changed from 1,100,100 to 140,100,50
12:03:50.215 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'Huecolorspot4_Color' received command 250,100,50
12:03:50.215 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item 'Huecolorspot4_Color' predicted to become 250,100,50
12:03:50.215 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Huecolorspot4_Color' changed from 140,100,50 to 250,100,50
12:03:52.050 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'Testing_Switch' received command OFF
12:03:52.050 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Testing_Switch' changed from ON to OFF
12:03:52.254 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'Huecolorspot4_Color' received command 78,71,85
12:03:52.254 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item 'Huecolorspot4_Color' predicted to become 78,71,85
12:03:52.254 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Huecolorspot4_Color' changed from 250,100,50 to 78,71,85

12:03:56.533 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Huecolorspot4_Color' changed from 78,71,85 to 65,73,85
12:03:56.548 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'LoungeRoom_Color' changed from 78,71,85 to 0,0,85
12:03:56.548 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'LoungeRoom_ColorTemperature' changed from 75 to 0

I can’t work out what causes the last three events?

Any suggestions?
Mark

This is a guess by autoupdate.

Some time later …

a real report from the device, causes another Item change because it doesn’t match the guess.
Maybe the device has different granularity/steps in its internal values. Maybe its ramping and this is an intermediate report before it reaches final values.

The last three log entries seem to happen after the rule has completed? The rest of the lights remain in the initial state, however the affected light does not go back to the state it should?

Rule with some logging:

rule "Color Cycle Lights"
when
    Item Testing_Switch changed to ON
then
    val lastState = Huecolorspot4_Color.state 
    logWarn("Hue", "lastState " + lastState  )
    //Huecolorspot4_Color.sendCommand(ON)
    createTimer(now.plusSeconds(1), [ | 
        Huecolorspot4_Color.sendCommand("1,100,100") 
        logWarn("Hue", "State 1 " + Huecolorspot4_Color.state  ) 
        ])
    createTimer(now.plusSeconds(2), [ | 
    Huecolorspot4_Color.sendCommand("140,100,50") 
    logWarn("Hue", "State 2 " + Huecolorspot4_Color.state  )
        ])
    createTimer(now.plusSeconds(3), [ | 
    Huecolorspot4_Color.sendCommand("250,100,50") 
    logWarn("Hue", "State 3 " + Huecolorspot4_Color.state  )
        ])
    //createTimer(now.plusSeconds(4), [ | Huecolorspot4_Color.sendCommand(OFF) ])
    createTimer(now.plusSeconds(5), [ | 
    Huecolorspot4_Color.sendCommand(lastState.toString)
    logWarn("Hue", "Reset " + Huecolorspot4_Color.state  )
        ])

end

Logs:

12:54:39.788 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'Testing_Switch' received command ON
12:54:39.788 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Testing_Switch' changed from OFF to ON
12:54:39.804 [WARN ] [org.openhab.core.model.script.Hue    ] - lastState 78,71,85
12:54:40.811 [WARN ] [org.openhab.core.model.script.Hue    ] - State 1 78,71,85
12:54:40.811 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'Huecolorspot4_Color' received command 1,100,100
12:54:40.811 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item 'Huecolorspot4_Color' predicted to become 1,100,100
12:54:40.811 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Huecolorspot4_Color' changed from 78,71,85 to 1,100,100
12:54:41.881 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'Huecolorspot4_Color' received command 140,100,50
12:54:41.881 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item 'Huecolorspot4_Color' predicted to become 140,100,50
12:54:41.881 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Huecolorspot4_Color' changed from 1,100,100 to 140,100,50
12:54:41.881 [WARN ] [org.openhab.core.model.script.Hue    ] - State 2 140,100,50
12:54:42.873 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Huecolorspot4_Color' changed from 140,100,50 to 139,100,50
12:54:42.936 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'LoungeRoom_Color' changed from 78,71,85 to 0,0,81
12:54:42.936 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'LoungeRoom_Brightness' changed from 85 to 81
12:54:42.936 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'LoungeRoom_ColorTemperature' changed from 75 to 0
12:54:42.952 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'Huecolorspot4_Color' received command 250,100,50
12:54:42.952 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item 'Huecolorspot4_Color' predicted to become 250,100,50
12:54:42.967 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Huecolorspot4_Color' changed from 139,100,50 to 250,100,50
12:54:42.967 [WARN ] [org.openhab.core.model.script.Hue    ] - State 3 250,100,50
12:54:45.040 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'Huecolorspot4_Color' received command 78,71,85
12:54:45.042 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item 'Huecolorspot4_Color' predicted to become 78,71,85
12:54:45.046 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Huecolorspot4_Color' changed from 250,100,50 to 78,71,85
12:54:45.048 [WARN ] [org.openhab.core.model.script.Hue    ] - Reset 78,71,85
12:54:45.406 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'Testing_Switch' received command OFF
12:54:45.406 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Testing_Switch' changed from ON to OFF
12:54:52.925 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Huecolorspot4_Color' changed from 78,71,85 to 77,70,85
12:54:52.989 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'LoungeRoom_Color' changed from 0,0,81 to 0,0,85
12:54:52.989 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'LoungeRoom_Brightness' changed from 81 to 85
12:55:02.985 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Huecolorspot4_Color' changed from 77,70,85 to 65,73,85

These ar ethe once I don’t understand the source of:

12:54:52.925 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Huecolorspot4_Color' changed from 78,71,85 to 77,70,85
12:54:52.989 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'LoungeRoom_Color' changed from 0,0,81 to 0,0,85
12:54:52.989 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'LoungeRoom_Brightness' changed from 81 to 85
12:55:02.985 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Huecolorspot4_Color' changed from 77,70,85 to 65,73,85

I’ve only implemented this against single lights so far. My rules reference the Hue Room but in my case that’s just a single bulb. I’ll experiment with a room that has multiple bulbs later today after the wife goes to work. (Far too early and not nearly enough coffee so far to annoy her with lights going on and off.)

Added: But so far yes, my tests have seen that the lights do revert back to whatever state they were in before the actions fired off.

1 Like

I don’t know how else to put it

observe the timestamps. It’s taking the hues some time to respond to the last command

Thanks, but the last command was logged as: Item 'Huecolorspot4_Color' changed from 250,100,50 to 78,71,85

The initial saved state was 78,71,85

Added some logging:

rule "Color Cycle Lights"
when
    Item Testing_Switch changed to ON
then
    val lastState = Huecolorspot4_Color.state 
    logWarn("Hue", "lastState " + lastState  )
    //Huecolorspot4_Color.sendCommand(ON)
    createTimer(now.plusSeconds(1), [ | 
        Huecolorspot4_Color.sendCommand("1,100,100") 
        logWarn("Hue", "State 1 " + Huecolorspot4_Color.state  ) 
        ])
    createTimer(now.plusSeconds(2), [ | 
    Huecolorspot4_Color.sendCommand("140,100,50") 
    logWarn("Hue", "State 2 " + Huecolorspot4_Color.state  )
        ])
    createTimer(now.plusSeconds(3), [ | 
    Huecolorspot4_Color.sendCommand("250,100,50") 
    logWarn("Hue", "State 3 " + Huecolorspot4_Color.state  )
        ])
    //createTimer(now.plusSeconds(4), [ | Huecolorspot4_Color.sendCommand(OFF) ])
    createTimer(now.plusSeconds(5), [ | 
    Huecolorspot4_Color.sendCommand(lastState.toString)
    logWarn("Hue", "Reset " + Huecolorspot4_Color.state  )
    logWarn("Hue", "Rules Done... " )
        ])
logWarn("Hue", "Rule Exit... " )
end
14:03:31.651 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'Testing_Switch' received command ON
14:03:31.760 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Testing_Switch' changed from OFF to ON
14:03:31.869 [WARN ] [org.openhab.core.model.script.Hue    ] - lastState 78,71,85
14:03:32.158 [WARN ] [org.openhab.core.model.script.Hue    ] - Rule Exit... 
14:03:32.891 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'Huecolorspot4_Color' received command 1,100,100
14:03:32.891 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item 'Huecolorspot4_Color' predicted to become 1,100,100
14:03:32.891 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Huecolorspot4_Color' changed from 78,71,85 to 1,100,100
14:03:32.891 [WARN ] [org.openhab.core.model.script.Hue    ] - State 1 78,71,85
14:03:33.990 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'Huecolorspot4_Color' received command 140,100,50
14:03:33.991 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item 'Huecolorspot4_Color' predicted to become 140,100,50
14:03:33.995 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Huecolorspot4_Color' changed from 1,100,100 to 140,100,50
14:03:33.998 [WARN ] [org.openhab.core.model.script.Hue    ] - State 2 140,100,50
14:03:34.741 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Huecolorspot4_Color' changed from 140,100,50 to 139,100,50
14:03:34.803 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'LoungeRoom_Color' changed from 78,71,85 to 0,0,81
14:03:34.803 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'LoungeRoom_Brightness' changed from 85 to 81
14:03:34.803 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'LoungeRoom_ColorTemperature' changed from 75 to 0
14:03:35.087 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'Huecolorspot4_Color' received command 250,100,50
14:03:35.087 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item 'Huecolorspot4_Color' predicted to become 250,100,50
14:03:35.087 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Huecolorspot4_Color' changed from 139,100,50 to 250,100,50
14:03:35.087 [WARN ] [org.openhab.core.model.script.Hue    ] - State 3 250,100,50
14:03:36.759 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'Testing_Switch' received command OFF
14:03:36.759 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Testing_Switch' changed from ON to OFF
14:03:37.182 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'Huecolorspot4_Color' received command 78,71,85
14:03:37.182 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item 'Huecolorspot4_Color' predicted to become 78,71,85
14:03:37.182 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Huecolorspot4_Color' changed from 250,100,50 to 78,71,85
14:03:37.182 [WARN ] [org.openhab.core.model.script.Hue    ] - Reset 78,71,85
14:03:37.182 [WARN ] [org.openhab.core.model.script.Hue    ] - Rules Done...
14:03:44.792 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Huecolorspot4_Color' changed from 78,71,85 to 77,70,85
14:03:44.861 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'LoungeRoom_Color' changed from 0,0,81 to 0,0,85
14:03:44.861 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'LoungeRoom_Brightness' changed from 81 to 85
14:03:54.839 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Huecolorspot4_Color' changed from 77,70,85 to 65,73,85

So it appears these events happen after the end of processing rules and Timer:

14:03:44.792 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Huecolorspot4_Color' changed from 78,71,85 to 77,70,85
14:03:44.861 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'LoungeRoom_Color' changed from 0,0,81 to 0,0,85
14:03:44.861 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'LoungeRoom_Brightness' changed from 81 to 85
14:03:54.839 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Huecolorspot4_Color' changed from 77,70,85 to 65,73,85