Hello all,
I’m trying to create scenes for different brightness and colour warmth combinations in OH2 using rules but I can’t get the brightness to work no matter what I do. Here’s the rule:
rule "Bedroom Scene"
when
Item Light_Bedroom_Scene changed
then
if (Light_Bedroom_Scene.state == 0)
{
sendCommand(Light_Bedroom_Clr, 0)
sendCommand(Light_Bedroom_Br,100)
}
else
if (Light_Bedroom_Scene.state == 1)
{
sendCommand(Light_Bedroom_Clr, 100)
sendCommand(Light_Bedroom_Br,2)
}
end
The web interface changes to reflect the number i.e. 2% or 100% but the brightness remains unchanged.
Add logging to your rule to see whether the rule is being triggered. If it is triggered then logging statements to see where in the rule it is failing.
Are there errors in the log when you load the rules file or when the rule executes?
To test and the rule is being triggered and the commands are executed. For example, the colour changes from 0 to 100 and back. It’s only the brightness that doesn’t seem to work
Here’s an example from the events.log file (corrected)
[ItemCommandEvent ] - Item ‘Light_Bedroom_Scene’ received command 0
[ItemStateChangedEvent ] - Light_Bedroom_Scene changed from 1 to 0
[ItemCommandEvent ] - Item ‘Light_Bedroom_Clr’ received command 0
[ItemCommandEvent ] - Item ‘Light_Bedroom_Br’ received command 100
[ItemStateChangedEvent ] - Light_Bedroom_Clr changed from 100 to 0
[ItemStateChangedEvent ] - Light_Bedroom_Br changed from 71 to 100
[ItemStateChangedEvent ] - Light_Bedroom_Br changed from 100 to 71
[ItemStateChangedEvent ] - Light_Bedroom_Br changed from 71 to 100
It seems to change the brightness to 100 (as expected) but then back to the original value then again to 100. Very odd!
The web interface changes to reflect the value albeit after I hit F5 to refresh the page but nothing happens except the colour. Do you think this is something to do with the binding itself? It works fine if I use a slider on the OH webpage to change.