I want to compare the HSBType of an Item with another HSBType (is it equal)? So I did something along the lines
rule "Example"
when
Item Something changed
then
if ((Hue_Example.state as HSBType).equals(someotherHSBvariable)) { do something }
end
However this does not work. So I wanted to log the contents of the Hue_Example.state.
var HSBType temp=Hue_Example.state as HSBType
var temp2=temp.toString
loginfo(“test”,temp2)
But this results in
22:26:42.547 [ERROR] [.script.engine.ScriptExecutionThread] - Rule ‘HueWZScenes’: An error occured during the script execution: The name ‘loginfo(,)’ cannot be resolved to an item or type.
What am I missing? Hue_Example is an Item associated with a hue color channel:
Turns out I was doing most things correctly. Using logInfo instead of loginfo helps tremendously.
The .equal does not work since the hue bridge seems to randomly change some setting. E.g. I am setting th me brightness to 69 and a few seconds later openHAB notices a change to 68. I wrote my own comparison rule which allows for some small deviations and all is fine now. Case closed.