[SOLVED] LCN rules and Hue Motion Detection

Hello together,

slowly serveral things start work. Actually I managed it to get all informations out of the hue motion detector inside my sidemap. Now I want to write a rule to switch on the cellar light, if motion was detected … but I’m to stupid to write the correct action (press a key) for the LCN-Device.

Is there anyone how can help me in writing the command ?

Thanks and best regards
Stef

Nobody is too stupid. Coding is not easy if you haven’t done it before.
Have go. Don’t worry if it doesn’t work, show your code here along with your items and we’ll help you sort it out. We can’t just post code on a blank canvas:

This to get you started

rule "hue motion"
when
    Item Hue_Motion changed to ON
then
    LCNDevice.sendCommand(ON)
end

Hello vzorglub,

thanks for the fast answer. What I want to do ist sending a command to trigger key A1 off a special modul. Why ? The motion detector should trigger the staircase light in the same way than the normal LCN-Buttons and … the light will go off automaticly.

For this purpose I create a special item

Switch  LCN_HWR_KEY_A1                      "Treppenhauslicht" {lcn="[lcn_home:KEYS.0.10.A1.HIT]"}  

while my rule looks similar to your one

rule "Bewegungsmelder_Keller"
    when   
        Item hueMotionSensorPresence changed to ON
    then   
        LCN_HWR_KEY_A1.sendCommand(HIT)
end

but the command is wrong …

So there must be something that I made wrong … :thinking:

Thanks for further help
Stef

LCN_HWR_KEY_A1 is defined as a Switch Item, so it only accept ON or OFF as command

see also https://docs.openhab.org/configuration/items.html#type

Hello mueslee,

thanks for this hint. If I change HIT to ON I didn’t get any error, when the motion detection is triggering, but … nothing happen, so there must be at least on further mistake.

So the main question seems to be the question for the correct item definition of one a single key. Any idear ?

Thanks and best regards
Stef

I had a look at the LCN binding at it looks quite involved…
I guess that you are more familiar with it so read it again and make sure that your item config is correct.
But at first sight, your binding configuration is wrong. I maybe wrong but from the docs it doesn’t look like that for key…
I don’t have LCN so I can’t test for you sorry.
Go through these docs again:

https://docs.openhab.org/addons/bindings/lcn1/readme.html

Hello vzorglub,

I got it … the main problem was, that I have defined the item in the wrong way.

Switch  LCN_HWR_KEY_A1                      "Treppenhauslicht" {lcn="[ON:lcn_home:KEYS.0.10.A1.HIT]"}  

Import is, that I define an openHAB-Command “ON”.

… the rules stays the same …

rule "Bewegungsmelder_Keller"
    when   
        Item hueMotionSensorPresence changed to ON
    then   
        LCN_HWR_KEY_A1.sendCommand(ON)
end

The remaining problem is the latency of close to 3s between detection and action …

Thanks and best regards
Stef