LCN-Relais and Rules

All,

I have the following use case:

I want to control my HUE lamps with a GT12 button:
Button A1 - short = 100% brightness
Button A2 - short = 50% Brightness
Key A1 - long = 0% Brightness
Button A2 - long = 0% Brightness

Since I cannot enter the HUE parameters directly via the LCN-PRO, I only switch virtual relays via the GT12.
A1 short: Relay1=on, Relay2=off
A2 short: relay1=off, relay2=on
A1 or A2 long: relay1=off, relay2=off

The LCN Openhab connection is established. I can switch the relays via the Openhab app and via the GT12.
The HUE lamps are at output 1. The actual value of output1 is always 100%.

Via an Openhab-Rule I want to switch my lamps depending on the relay status changes.

Now to the questions:

  • Is this the right way? Or is there a better way?
  • How can I formulate the rule?

Unfortunately, this rule does not work (logwarn stands instead of the HUE lamp).

rule "Item Esstisch"
when
    Item LCNEsstisch1 received command
then
    switch(receivedCommand.toString.toUpperCase){
        case "10000000": {
           logWarn("Esstisch", "Relais 1 an")
        }
        case "01000000": {
           logWarn("Esstisch", "Relais 2 an")
        }
        case "00000000": {
           logWarn("Esstisch", "Relais aus")
        }      
    }
end

I hope one of you guys has some advice for me…

Not familiar with Hue buttons and not aware what ‘LCN-PRO’ is - but wouldn’t you use something like the following to react on a triggered button? And have a separate rule for each triggered event?

rule "bla"
when
   Channel "hue:0820:1:dimmer-switch:dimmer_switch_event" triggered <EVENT>
then
    val String color = "<0-359>"
    val String brightness = "50"
    val String hsb_triple = color + ",100," + brightness
    Hue_LR_TV_Color.sendCommand(hsb_triple)
end

Hi Jens-Peter,

please show your item definition for LCNEsstisch1.

On the other hand, why don’t you use a virtual output from a SH - Modul?
Then you can control this output as dimmer from your GT12 and in a rule you can catch each change and you can assoziate this virtual output with your hue brightness channel.
Torsten

With 4 keys (A1, A2, A3, A4) of a GT12 I switch 4 virtual relays.
As soon as there are changes to the relay matrix I would like to start actions. The logwarn command is just a simple example.ö

But of course this does not have to be so. There is certainly a better solution. Actually I only want to start actions depending on the 4 buttons.

@Thorsten: I have now noticed that my item configuration cannot work.
How does your suggestion look like? I can’t imagine your idea yet.

All newer lcn modules (SH, upp,…) have two physical outputs and two virtual outputs. You can use the virtual outputs for your hue’s.

Follow this steps:

  1. Config the keys from your GT12 to control one virtual output. You can config all that you want, dimmer, switch,…
  2. Now create an item and bind this item to the virtual output. I would suggest the item as dimmer.
Dimmer HueEsstischLCN "hue esstisch [%s]" {lcn="[lcndemo:OUTPUT_STATUS.0.5.3], [INCREASE:lcndemo:ADD.0.5.3.5%], [DECREASE:lcndemo:SUB.0.5.3.5%], [%i:lcndemo:DIM.0.5.3.%i]"}

In this example output 3 is used.

  1. Create a rule and trigger this rule when HueEsstisch is changed.
    Inside the rulebody you can cover the current state from HueEsstischLCN up to your real hue item:
RealHueItem.sendCommand(HueEsstischLCN.state)

Great! It works… Thx