Having beginner question for OpenHAB2, Zwave and rules

I’ve go OpenHAB2 running on my PI which has an Razberry Z-Wave controller attached, after lots of tries I got the combination working. Now I have one Window/Door Sensor connected which operates on a battery. As I am not really a big fan of battery power devices I wanted as first thing a message when battery power is low. I found a blog post about it on github (it has openhab1 in the url) but I cannot get it to work.

I have the following question:

  1. The discovered zwave Window/Door sensor show up in the interfaces as Alarm/Battery Level/Binary Sensor items but are not visible in the items directory, is this as designed?
  2. I created a group, gBattery, in a file called grous.items in the items directory and assigned this group to the Battery Level using PaperUI, is this the correct way to do this?
  3. I try to get the members of this group in a rule, something like gBattery.members… but it seems to be empty. Am i missing something?
  4. Should I be using the DSL or is it better to use JSR223?

If you haven’t already I recommend reviewing the Beginner’s Guide and the Concepts section of the User’s guide to get a good foundation of the parts of OH, how they work together, and the proper vocabulary for the various parts.

It is very difficult to understand what you have done and what you are referring to so I’ll do my best to answer.

  1. I interpret this to mean that you have the zwave binding installed and working. The binding discovered a number of zwave devices and put them into the inbox. You have accepted these Items from the Inbox and therefore Things were created to represent these devices. Now I’m interpreting your use of the term “interfaces” to be in reference to the Thing’s Channels.

The next step for you will be to create Items (either through PaperUI or by manually writing .items files) linked to the Battery Channel of the sensor Thing.

All of this is explained in the already provided links and further information on Items is documtented here.

  1. How did you assign the gBattery to the Battery Level in PaperUI? Is your
    "Battery Level" an Item? What is your gBattery definition? Depending on what you want to do with gBattery you might need to change this.

  2. If gBattery.members is empty then you made a mistake at step 2.

  3. If you are a coder already and like Python, JavaScript, or Groovy better than learning a new language then I would say JSR233 is a good choice. However, if you are not a good coder already you should probably stick to the DSL as there will be far more people on this forum who will be able to help you. If you are really adventurous you can give the Experimental Rules Engine a try, though I don’t think that is feature complete yet.

No matter what rules engine you choose, your problems in 1, 2 and 3 will not go away. They all have to deal Items and Things.

Hi, Thanks for the reply (sorry for my late reply). I’ve gone through the Beginner’s Guide and the Concepts (but it may not all have landed yet) so I will visit those pages again.

  1. You are right, I’ve got the z-wave binding installed and discovered one zwave device which came in the inbox and I accepted (as I only have one active). So the things are there and I created items of them (or better they where created automatically)
  • Alarm (general)
  • Battery Level (has as parent group gBattery)
  • Binary Sensor

According to PaperUI the Door/Window sensor has three channels which are linked to the items from the list above

  1. The group gBattery is created using a file groups.items in the items directory and contains:

Group gBattery

  1. Yeah I probably did, but I am not sure what I missed so basically that’s my question

  2. I’am a programmer so to be honest I prefer the JSR233 but for now I first want to get to know OpenHAB so I will stick to DSL for now.

But after all it seems to be a typo in the script file as it is now working…

I highly recommend using Designer, at least when debugging rules and configurations. It is far from perfect but it excels at finding typos and syntax errors.