How to get my first rule running

@thowa Can you post a screenshot of the configuration page of the thing? Maybe the association to the zwave controller is missing

I’m not quite sure what exacly you mean by configuration page.
Here are 2 screenshots that might be what you are looking for.

on cd-jackson.com I saw that only firmware version up to 2.8 ist supported.
cd-jackson

I assume the firmware version of my sensor is 3.2.

Also type ID is not listed on cd-jackson either.

Perhaphs that is the reason

The database shows both of them:

So I do not think that is the issue. The result of my fibaro door sensor (FGK101) also shows the same result in the database.

Just to make sure that the items file doesn’t have an issue:
Can you also create an item via PaperUI and check if PaperUI is displaying something when the sensor triggers?

I‘ve already created the item via Papier Ui

Does that mean that you have your item created in PaperUI and in addition in your default.items file at the same time?
Especially if they have the same names (Bad_Bewegung) in PaperUI and items file that “could” be a problem.

Does PaperUI show two items being linked to the channel Motion Alarm?

If not (and you still have your item defined in PaperUI and default.items), make sure that you define your item only at one place
If yes, try to delete the item that PaperUI created and only use or default.items (or the other way round).

Once you cleared your items, make sure to delete the cache of OpenHab:
There is a nice description here: Clear the Cache

Sorry for the late reply, I was offline for a couple off days.

As often, it seems, that the error was sitting in front of the machine :wink:
Obviously I have not properly paired the Fibaro Motion Sensor.
Reading the manual, I was aware that I have had to push the button on the sensor 3 times.

Special thanks to @Sascha_Billian, @rlkoshak and @jkarsten

I am running into same issues. Can´t find the missing thing. I use a Fibaro Motion Sensor and a Switch and the Sensor does not trigger any motion. I have tried everything to get it work, but still not. Please can somebody take a look? The Things i have imported via Paper UI (NO Simple Mode).

Thanks!

**My items:**
// Bewegungsmelder

Group gEG_Garderobe "Garderobe Bewegunsgmelder"

Switch Ga_Bewegung "Garderobe Bewegung" <motion> (gEG_Garderobe) {channel="zwave:device:ffac095e:node2:alarm_motion"}

// Lichter

Group gEG_Wohnzimmer "Garderobe Bewegunsgmelder"

Switch Wz_kl_Licht "Wohnzimmer Licht" <light> (gEG_Wohnzimmer) [ "Lighting" ] {channel="zwave:device:ffac095e:node4:switch_binary"}

**sitemap:**

sitemap meinHeim label="Casa Boro" {

Frame label="Wohnzimmer" {

Group item=gEG_Wohnzimmer label="Erdgeschoss" icon="groundfloor"

Switch item=Wz_kl_Licht

}

Frame label="Garderobe" {

Group item=gEG_Garderobe label="Erdgeschoss" icon="groundfloor"

Switch item=Ga_Bewegung

}

}

**rules:**

// Bewegungsmelder Garderobe
rule "Kueche Bewegung AN"
when
Item Ga_Bewegung changed from OFF to ON 
then
sendCommand(Wz_kl_Licht, ON)
end

Look at events.log to see if Ga_Bewegung is changing. Add logging to your Rule to see if the Rule is running.

Note that the Rule will only trigger if the Item changes from OFF to ON. Not all motion sensors do that. Some just get an ON for every motion detection and never return to OFF.

Thanks for reply! Do i log with "“logDebug” or “logInfo”?

First, look on events.log for your Item changing in the way you expect.
No change, no rule trigger, no point fiddling with rule that never runs.

1 Like

Follow rossko57’s advice. Then use logInfo for now. When you are done, you can convert them to logDebug which will keep the statements but they won’t show up in your openhab.log unless you lower the logging level of your Rules to debug.

1 Like

Thanks! In openhab.log i get following error:

2019-11-14 19:13:24.389 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Licht an bei Bewegungsmelder’: ‘createTimer’ is not a member of ‘java.lang.Class<org.eclipse.smarthome.model.script.actions.Timer>’; line 6, column 9, length 92

**My rule:**

rule "Licht an bei Bewegungsmelder"

when

Item Motion_Garderobe changed to ON

then

sendCommand(Licht_Wohnzimmer, ON)

timer = Timer.createTimer(now.plusSeconds(180) [|

sendCommand(Licht_Wohnzimmer, OFF)

timer = null

])

end

OK, the error is pretty clear. I points to the line

timer = Timer.createTimer(now.plusSeconds(180) [|

The error says “createTimer is not a member of …”

So there is something wrong with the call to createTimer. Let’s look at the docs for createTimer…

For example:

var Timer myTimer = createTimer(now.plusMinutes(5), [ |
   logInfo("rules", "Timer activated")
])

Notice, there is no Timer. before the call to createTimer.

NOTE: I’m not trying to be pedantic. I want to demonstrate the sort of thought process that should go through your mind and the actions you should take when you encounter an error.

NOTE2: If you were using VSCode with the openHAB extension that line would have been highlighted as an error.

1 Like

I am sorry for beeing exhausting, but i am very new to this all. Now i have recreated the rule and it seems to work, but not 100%, any issues are still there.

    • After detecting movement the light turns on = OK
    • After a few seconds it seems the light turns again on = NOT OK
    • After 2 minutes the light turns off = OK

openhab.log

2019-11-15 09:51:39.176 [INFO ] [.eclipse.smarthome.model.script.FILE] - Setting to ON and creating timer

2019-11-15 09:52:09.801 [INFO ] [.eclipse.smarthome.model.script.FILE] - Setting to ON and creating timer

2019-11-15 09:53:39.187 [INFO ] [.eclipse.smarthome.model.script.FILE] - Timer expired and setting to OFF

2019-11-15 09:54:09.817 [INFO ] [.eclipse.smarthome.model.script.FILE] - Timer expired and setting to OFF

rule

var Timer timer = null
rule "Beleuchtung Wohnzimmer an, für 2 Minuten"
when
Item Motion_Garderobe changed
then
    logInfo("FILE", "Setting to ON and creating timer")
    Licht_Wohnzimmer.sendCommand(ON)
    timer = createTimer(now.plusMinutes(2), [|
        logInfo("FILE", "Timer expired and setting to OFF")
        Motion_Garderobe.postUpdate(OFF)
        Licht_Wohnzimmer.sendCommand(OFF)
        //timer = null // DO I NEED THIS??
    ])
end

Thanks for helping!

You changed that line. Look back at post 25 for what it used to be

Not unless you are testing to see if the timer is null anywhere i.e. looking to see if it is already running.
In the rule you show us, you don’t do that - but you probably should. What happens if you get a second motion trigger after one minute - what should your timer do?

1 Like

Thanks! That means i have to change it to: Item Motion_Garderobe changed to ON?

Well, when would like your timer to begin? When motion starts, or when it stops? What changes does your Item make? (see events.log)

Personally, I’m a fan of a two-rule solution that other people seem to avoid.
When motion begins, turn on the light - and cancel any off-timer.
When motion stops, begin the light off-timer.

1 Like

I´d like to start the timer if first movement is detected and on a second movement the timer should extend. What do you think about it? Thanks!

events.log

2019-11-15 13:10:53.793 [vent.ItemStateChangedEvent] - Motion_Garderobe changed from OFF to ON

2019-11-15 13:10:54.036 [ome.event.ItemCommandEvent] - Item 'Licht_Garderobe' received command ON

2019-11-15 13:10:54.047 [nt.ItemStatePredictedEvent] - Licht_Garderobe predicted to become ON

2019-11-15 13:10:54.049 [vent.ItemStateChangedEvent] - Licht_Garderobe changed from OFF to ON

2019-11-15 13:11:24.346 [vent.ItemStateChangedEvent] - Motion_Garderobe changed from ON to OFF

2019-11-15 13:11:24.351 [ome.event.ItemCommandEvent] - Item 'Licht_Garderobe' received command ON

2019-11-15 13:11:24.361 [nt.ItemStatePredictedEvent] - Licht_Garderobe predicted to become ON

2019-11-15 13:12:54.050 [ome.event.ItemCommandEvent] - Item 'Licht_Garderobe' received command OFF

2019-11-15 13:12:54.074 [nt.ItemStatePredictedEvent] - Licht_Garderobe predicted to become OFF

2019-11-15 13:12:54.076 [vent.ItemStateChangedEvent] - Licht_Garderobe changed from ON to OFF

Have a go at that, then.

1 Like