[SOLVED] Simple complete Example to control a Hue Bulb with rules

Hello all,

I have the problem, that I missunderstand something essential. I try to combine Hue Bulbs with my LCN Bus System.

In the Haus.item I define a LCN-Relay-Contact witch should switch on or off the hue bulb:
Contact LCN_M11_Relay_1 “M011 relay 1” (KG_Arbeitszimmer) {lcn="[lcn_home:RELAY_STATE.4.11.1]"}
Switch Hue3Switch “Switch Hue 3” { channel=“hue:0210:xxxxxxxxxxxxxx:3:color” }

In Haus.sidemap I wrote …
Switch item=Hue3Switch label=“Hue Lampe”

… and in Haus.rules
rule “corLightON”
when
Item LCN_M11_Relay_1 changed from CLOSE to OPEN
then
Hue.sendCommand (Hue3Switch,ON)
end

rule “corLightOFF”
when
Item LCN_M11_Relay_1 changed from OPEN to CLOSE
then
sendCommand (Hue3Switch, OFF)
end

So the first question, how will the correct “sendCommand”-Line has to look like ? I have tested several permutations, but without success.

I hope the the idear is clear, the hue light hast to toggle, depending of the state of LCN_M11_Relay_1.

I hope that someone can help me.
Thanks and best regards
Steffan

i am a noob - but try:

Hue3Switch.sendCommand(ON)
Hue3Switch.sendCommand("ON")

( set your code snippets in ``` for better reading )

Thanks Philipp for the fast answer,

but … it will not work. The error message display in the SmartHome Designer is “The method of field Hue3Switch is undefined”. My interpretation of this is, that Hue3Switch is not defined in the correct manner. But how is the correct manner ? So just let me summarize what I have made:

  • no explicit configuration (cfg-file) for Hue in the HomeDesigner. I use the one, defined by the Paper UI

  • Inside the Haus.item-File I make the following declaration:
    Switch Hue3Switch “Switch Hue 3” { channel=“hue:0210:xxxxxxxxxxx:3:color” }
    of course, the xxxxxxxxxxx is replaced by the correct address

  • Inside the Haus.sitemap I make a second definition
    Switch item=Hue3Switch label=“Hue Lampe”

  • and inside the Haus.rules-file I try to use the item withou success and the error message above.

So it seems that I make a mistake … but where ?

Thanks an best regards
Steffan

Use Hue3Switch.sendCommand(ON) and Hue3Switch.sendCommand(OFF).

https://docs.openhab.org/addons/actions.html#event-bus-actions

The file extension of an items file is items, so should be Haus.items. Or was that a typo?

Thanks to all, the problem is fixed. There where to mistakes:
a) my “sendCommand” interpretation. The correct form is Hue3Switch.sendCommand(ON), but the homeDesigner show errors. Okay, a problem of the HomeDesigner (I use version 0.8.0, X64) !!!
b) I thought that my rules where triggering but they didn’t, because
when
Item LCN_M11_Relay_1 changed from OPEN to CLOSE
is not correct. It should have been CLOSED !!!

Now everything works fine and I’m able to run in new problems, when going further with my project.

So, Thanks to all
Steffan