[noob question] Rule creation and execution in openHAB 2


I’ve created simple rule to turn on light during the night if movement will be detected. I’ve used Habmin creator (I need to admit that Usability of new Habmin is extremely improved from previous version) .

Unfortunately after restarting openHAB I got in log that z-wave items cannot be initiated.

Code generated by Habmin

I’ve took devices name from OpenHab screen. What I’m doing wrong?


First of all, if you post/paste your code directly to the forum, instead of as an image, we can read and contribute to it more easily. If you prepend and append the code with 3 back ticks (```) it will look like this:

rule "rule"
    System started
    // do something

Then, to answer your question. I think you cancel the timer before executing any command.
It should look like:

_timer_001_A = createTimer(now.plusMinutes(5)) [|
    sendCommand(zwave_device_18271b25_node9_switch_binary1, ON)

Which version of HABmin2 are you using?

I think the issue is that HABmin isn’t finding the items - this causes two problems when the script is generated. Firstly, there is no ‘when’ clause in your rule, so it probably never runs, and secondly, the items aren’t used correctly as they have no .state on the end.

This is a bug that should be fixed, but it was quite recent and I think is not be in the released version. So, I would recommend using the current snapshot.

If you are already using this snapshot, then please comment on the following issue.