[Solved] Rule not called for Color item on state change event

Hi
Having spent a couple of evening trying to get this to work I;m now stumped and hoping someone may be able to help.

I’m trying to setup OpenHab with a Colorpicker and for the life of me I cannot get a rule to fire for it when it is changed.

I have absolutely no problem with a rule for a simple Switch but the Colorpicker refuses to comply i.e. I see a message in the openhab.log when I toggle the Switch but none for the ColorPicker however I do see entries in the events.log so I know that the Colorpicker is posting events to the bus.

You can see from the log below that the CP1 rule is not fired as there is no log entry for it.

I’m using the lastest Docker image of OpenHab (pulled down last night) and have simplifed the items, sitemap and rules to a minimum - see below.

Thanks
Mark

Log

08:55:07.076 [INFO ] [smarthome.event.ItemCommandEvent ] - Item ‘TestSwitch1’ received command OFF
08:55:07.080 [INFO ] [marthome.event.ItemStateChangedEvent] - TestSwitch1 changed from ON to OFF
08:55:07.082 [INFO ] [smarthome.event.ItemCommandEvent ] - Item ‘TestSwitch2’ received command ON
08:55:07.082 [INFO ] [g.eclipse.smarthome.model.script.TS1] - XX
08:55:07.087 [INFO ] [marthome.event.ItemStateChangedEvent] - TestSwitch2 changed from OFF to ON
08:55:13.826 [INFO ] [smarthome.event.ItemCommandEvent ] - Item ‘CP1’ received command 141,55,100
08:55:13.831 [INFO ] [marthome.event.ItemStateChangedEvent] - CP1 changed from 160,55,100 to 141,55,100
08:55:14.384 [INFO ] [smarthome.event.ItemCommandEvent ] - Item ‘CP1’ received command 90,39,100
08:55:14.388 [INFO ] [marthome.event.ItemStateChangedEvent] - CP1 changed from 141,55,100 to 90,39,100
****** NO LOG ENTRY INDICATING RULE WAS FIRED ******
08:57:19.449 [INFO ] [smarthome.event.ItemCommandEvent ] - Item ‘TestSwitch1’ received command ON
08:57:19.454 [INFO ] [marthome.event.ItemStateChangedEvent] - TestSwitch1 changed from OFF to ON
08:57:19.457 [INFO ] [smarthome.event.ItemCommandEvent ] - Item ‘TestSwitch2’ received command ON
08:57:19.456 [INFO ] [g.eclipse.smarthome.model.script.TS1] - XX

Items

Switch TestSwitch1
Switch TestSwitch2
Color CP1
String CP1_RGB

Sitemap

sitemap demo label=“Main Menu”
{
Frame {
Colorpicker item=CP1
Text item=CP1_RGB
Switch item=TestSwitch1
Switch item=TestSwitch2
}
}

Rules

import org.openhab.core.library.types.*
import java.awt.Color

rule "TS1"
when
Item TestSwitch1 changed
then
sendCommand(TestSwitch2, ON)
logError(“TS1”,“XX”)
end

rule “CP1”
when
Item CP1 changed
then
logError(“CP1”,“YY”)
end

maybe: wrong quotation marks ? :slight_smile:

The first ones from the TS1 rule seem correct:

Use: http://docs.openhab.org/installation/designer.html

Sir, I thank you: kudos is due and awarded.

If you’ve ever in London ping me and I’ll buy you a pint by way of thanks.

Lessons learned:

  1. Don’t cut and pass example code from web pages
  2. Check stuff first in OpenHab designer

I’m just glad it was that simple.

1 Like