openHAB IHC Light not turning off

Dear All,

I have an issue with my rule, where I have some LED Spots in my Bathroom that needs to turn on when motion is detected and then it turns off when the Motion state changes to Off.

Currently it only Turns on the light, but it doesn’t switch off the light when the Motion state changes to OFF. Can someone see what the heck is wrong?

//Bathroom Entré

rule "Bathroom Entre Xiaomi Motion LUX Sensor"
when
    Item BathroomEntre_MotionSensorLux_MotionStatus changed to ON
then
    if (BathroomEntre_MotionSensorLux_Illumination.state < 70 ) {
        BathroomEntre_tleft_IHC_PUSH.sendCommand(ON)
    } else {
        BathroomEntre_tleft_IHC_PUSH.sendCommand(OFF)
    }
end

rule "Bathroom Entre Xiaomi Motion LUX Sensor"
when
    Item BathroomEntre_MotionSensorLux_MotionStatus changed to OFF
then
    if (BathroomEntre_MotionSensorLux_MotionStatus.state == OFF ) {
        BathroomEntre_tleft_IHC_PUSH.sendCommand(OFF)
    } else {
        BathroomEntre_tleft_IHC_PUSH.sendCommand(ON)
    }
end

So, when the Motion is detected and the LUX is less than 70, it needs to turn on the light.
Then when the Motion Sensor is switches back to OFF due to its internal timer (I think that’s 1 minute) it should turn off… but it doesn’t :(.

I use the Xiaomi Aqara Motion Sensors with LUX.

Heeelp :).

Why are you sending commands to the push button? Use the output!!!

@jmv_driver

Because that button is linked to my IHC Output?

read this thread: IHC / ELKO Binding, OH2, Amazon Echo skill

You don’t need to map any input! Inputs are only mapped to access values from sensors. Otherwise you should map all the outputs of the lights

@jmv_driver

Yes good post. Unfortunately I don’t see how I should change my rule though. I’m still using my Sensors to trigger the ON or OFF, but I don’t see how I can change the sendCommand to the IHC button. The BathroomEntre_tleft_IHC_PUSH is the switch that is linked to my IHC Output on my LED Spots.

How would you change my rule in order to get it work?

Are you sure that the Xiaomi sensor will send a off command?

Have you seen that in Openhab logs?

I read somewhere in another post that it does not sen offf command and that you will have to set the status to off using timer in Openhab or expire binding.

I am going to set up my IHC in OpenHab and just got my Xiaomi stuff - so hopefully in some time I will want to do the exact same thing - so very interested to see if you get your rule to work

@JanSjo

Hey I’m pretty sure, because in another rule it turns off my IKEA Traadfri light when Motion Status changes to OFF.

1 Like

@JanSjo

Here is a output of my event log.

2017-10-22 14:07:16.969 [vent.ItemStateChangedEvent] - Hobbyroom_MotionSensorLux_MotionStatus changed from OFF to ON
2017-10-22 14:09:16.972 [vent.ItemStateChangedEvent] - Hobbyroom_MotionSensorLux_MotionStatus changed from ON to OFF

So I’m pretty sure it updates the status.

1 Like

The problem you are mapping the INPUT to change from OFF to ON and then changing the INPUT from ON to OFF!!!
What is happening to you, in the first movement the light turns ON, and in the next movement you will turn the light OFF!!
you should thing that you are changing the input value variable of the input programatically, and will cause one desynchronized value from what you are getting in the module…

That why I told you to map the OUTPUTS, otherwise you are simulating the push button press and will lead to different behaviours you are expecting…

@jmv_driver

Hey Jaime,

Sorry for not understanding it right away, because I thought I was using the OUTPUT. At least it is called an Output when I look in my IHC Controller.
What OUTPUT is it that you are referring to then? The Output you are referring to is the one highlighted in the picture.

Switch BathroomEntre_tleft_IHC_PUSH "Spot Loft" (Light) { ihc="0x3DA12" }

That’s the item I’m pointing towards the Output from my IHC.

the resource id 0x3DA12 is one output port from one output module? You named the switch as “left_IHC_PUSH” for me this maps one input port not one output port.

@jmv_driver

Well, my IHC Push is of course an input since when I press the button it needs to trigger the output module where my cable goes from towards the LED spots. My IHC buttons are all wireless.

I could also change my naming of the switch, but that doesn’t change the fact that the button in Openhab does what also happens if I press the key manually and my light in the bathroom turns on. If I then press again it turns off. It’s only when running it in my rule that it turns on the light, but it never turns it off again.

Hey…

I think I know why it doesn’t work like I want it. I completely forgot that after my OUTPUT module there are Universal Dimmers. Those doesn’t work that well with Openhab. I’m currently looking into changing all these Universal dimmers, so all my Spots get connected directly to an Output. Then I will just change the bulbs to Ikea Traadfri or something else.

Sorry about that guys, but thanks for your patience!

You are doing the binding wrong…

this should be the value you should bind!

if you want to simulate one toggle you should send one ON command, and then one OFF command…
Everything works, you just need to understand how the system works.
If this is not the IHC thing you use, send me the reference and I can help you. But forget about to trigger inputs!!!

Hi Jaime,

I am trying to bind it just like you are stating above, but I have serious trouble finding the resource ID. When I do a “mouse over” like you are doing in the screenshot, I don’t get that ID shown. Mine just says “LK IHC wireless product”…So I am searching through the .VIS file trying to locate the ID…
Any ideas?

Thank you very much for any reply - I am stuck:slight_smile:

Try to hold the ctrl button on the keyboard, when you make the mouse over. :slight_smile:

Ah you gotta be kidding:-)

It works - how nice is that! If have been searching through the files in notepad….

Thanks a lot!

Den 12. marts 2018 kl. 16.07.47, Jaime Vaz (bot@community.openhab.org) skrev:

Hey Peter,

Can you perhaps throw your rule in here with one of your lamps?

Hey,

Of course.

Items:

Switch   Lys_lampe      "Lille lampe"                  {ihc="0x6665e"}
Switch   Lys_Varelse    "Pendler"                      {ihc="0x64b5e"}
Switch   Lys_TerrasseS  "Stor Terrasse"                {ihc="0x9f95e"}
Switch   Lys_TerrasseL  "Lille Terrasse"               {ihc="0xa015e"}

rule:

rule "hus status"
when 
  Item HouseDummy received command

then 
  if (receivedCommand==0) {
      sendCommand(Samsung_TV, OFF)
      sendCommand(Sonos_Kitchen_Onoff, OFF)
      sendCommand(Sonos_Bathroom_Onoff, OFF)
      sendMiosScene(SceneLeavinghomeActive, 1)
      sendCommand(LgTvPower, ON)
      Lys_skab.sendCommand(OFF)
      Lys_PH.sendCommand(ON)
      Lys_Sofa.sendCommand(OFF)
      Spots_Stue.sendCommand(OFF)
      Spots_Kitchen.sendCommand(OFF)
      Lys_Spisebord.sendCommand(OFF)
      Lys_lampe.sendCommand(OFF)
      Lys_Varelse.sendCommand(OFF)
      Lys_TerrasseL.sendCommand(OFF)
      Lys_TerrasseS.sendCommand(ON)

Great! :slight_smile: