Xiaomi Motion Sensor turn on light (Lightwave)

Hi all,
I had had OpenHab for 6 months now, but if I’m honest, other than a Boiler Turn on rule, I’m not really using it as a smart home, it’s just a GUI to be lazy… so, I’ve decided to get my arse in gear and get some proper rules programmed.

To start with I have upgrade from 2.0 to 2.1 and moved from Windows to a dedicated Ubuntu Server to run it.

I moved things across, fairly happy with how its running, however there are still some issues, and I think I’ll be begging for help an annoying number of times… sorry.

I have made a rule, but I’m not quite sure why it isn’t working…

rule "Motion Sensor - Lights On"
    Item UBRMotSensor changed from OFF to ON
    if(UBRMainLight.state == OFF){
        var UBRLightturnOn = true
        if(UBRLightturnOn) UBRMainLight.sendCommand(ON)

Hey @swieprecht,
by the first looks of it your rule looks good - besides the fact that UBRLightturnOn isn’t meaningful, I suppose this is just a first test.
There might still be a syntax error or some other problem with your setup. These kinds of threads are always complicated to answer on. This is your setup and nobody can debug the problem better than yourself. It is therefore important, that you know how to do that. Let me give you a few tips:

  1. Look at the logs - this is extremely important. The logs will tell you about occurring events and logging messages. See: http://docs.openhab.org/administration/logging.html
    Check the log to follow along the execution of a rule. You’ll see which command is executed, which decision path is selected and so on. You’ll also be informed about syntax errors in your file. Incredibly helpful during all of this are:

  2. Log Messages - Add log lines to your rule! They will illustrate the execution of your rule and can print the value of a variable/Item. See: http://docs.openhab.org/configuration/rules-dsl.html

  3. Use a good editor - See: http://docs.openhab.org/configuration/editors.html

  4. Read the documentation and learn from “Tutorials & Examples” posted in this forum. See: https://community.openhab.org/c/tutorials-examples

Good luck!

Closing curly bracket is missing :slight_smile: