Need Help: Open-Wave on Raspbian / PI3 with ZStick and Smart Plug

Hi,

So I’m doing research for my employer, a rather large and famous router manufacturer, and we are doing a PoC on IoT devices.

I am interested in being able to retrieve metrics from a smart plug.

I have purchased a zstick and smart plug that function on the zwave protocol and have installed open-zwave and openhab into my /home/pi directory.

I can run the MinOZW example code in the open-zwave project.
I can run openhab with the start.sh script and see that 1 node has been detected by the ZController.
But then I am stuck starring at an osgi> prompt and I have no clue what to do next.

I can’t get the designer to run on my ubuntu and mac because Java 6 is outdated and insecure.
What kind of UI should I have for pulling metrics from a smart plug?
I was so suprised with the sitemap.default error.
Like I good lazy programmer I skips some steps and got to witness this.
Why isn’t there a default page that just lists everything?
This is rather daunting task to sound out ‘create a UI’, for what seems like a basic, yet flexible, CRUD for varoius devices. Especially when the tools provided don’t function with modern Java.

Can someone help me pull metrics from this wall plug, please?
What about using this command prompt, how would I enumerate through the nodes and see their features?

It seems like you have an incomplete setup.

Presumably you made sure that the zstick is compatible with openHAB (i.e. is one listed on the wiki page) and the smart plug is in the zwave database).

Presumably you are using openHAB 1.8 or are you using openHAB 2Beta3? The fact that you are looking at an osgi console makes me think you are using OH 2B3 but I can’t be sure.

On a Pi, the preferred approach is to install OH 1 using apt-get as documented here. This will set openHAB to run as a service, create a limited privileged openhab user under which the service will run, and place files in a more standard Debian way (i.e. binaries in /usr/share/openhab, configs in /etc/openhab, etc). For OH 2 the old wiki documentation is being replaced and can be found here which has both manual installation instructions as well as apt-get instructions.

Some people have been successful using openZwave to administer their zwave network but most people on this forum use @chris’s excellent habmin (note, you must use habmin with OH 1.8 and habmin2 with OH 2b3). But for the most part, you shouldn’t need to use either except when debugging problems or for those rare devices that require additional config (e.g. Minimotes).

That raises an alarm as the controller is itself a node. So if you see only one node you are only seeing the controller. Have you paired the smart plug with the controller? The manuals for both devices should tell you how to do this. Usually you press a button on the controller and press a button on the smart plug and wait for some light flashes, or something like that.

I recommend reading through the OH 1 wiki, the OH 2 documents and looking at the Demo. OH is made up of several distinct modules (probably the wrong word but close enough) that each work together to implement home automation. But in general you have:

  • bindings which implement the communication between a specific technology and OH
  • Things (OH 2 only) which represent a physical device
  • Items which in OH 2 represent a Thing and in OH 1 serves both as a Thing and an Item and which represents the device abstractly so the rest of OH doesn’t need to know or care that, for example, your smart plug talks zwave verses knx
  • Rules are where you implement event based behaviors (e.g. when the motion sensor triggers turn on the lights)
  • Sitemap is the User Interface to your home automation
  • Persistence stores Item states so you can analyze them later, recover from a restart, or modify rules behaviors based on past states.

??? I am currently running Designer on Oracle 1.8 on my Ubuntu mahcine as I type this. I have no idea where Java 6 is coming from. There is no requirement to run such an “outdated and insecure” java to run Designer.

And while I do strongly encourage you to use Designer for editing your openHAB configs it is not required.

You should (OH 1 instructions, I don’t have much OH 2 experience yet):

  1. pair the smart plug with your controller
  2. create an Item/Items bound to the smart plug node (probably Node 2). You can see which device is which node by watching the log or looking at the device list in open-zwave or habmin.
  3. Create a sitemap to display your Items
  4. Add in persistence if you want to include charting

I don’t know this error but we can’t be held responsible if you just skip steps. It isn’t like the steps are there to waste your time.

OH is not just a “CRUD for varoius [sic] devices”. It is more akin to an Enterprise Service Bus with Work Flow. It is a platform for creating a Home Automation platform, not just something that exposes some data. To continue the simile, the bindings are like adapters to get some legacy application to talk on the ESB and translate the messages into a common format and the Rules Engine is the workflow.

OH is a platform upon which you build Home Automation applications.

If your impression of IoT and Home Automation is this simplistic I’m afraid you will be disappointed. In this fragmented and complicate environment something that seems simple like a premade/default page that “just lists everything” is simply not feasible. However, the developers of Eclipse SmartHome and OH 2 have made great strides in this direction with the PaperUI and other changes.

But ultimately you will have to set up your own Items to capture the data you want and your own UI (i.e. sitemap) to display those Items. This will be your home automation application built upon the OH platform.

As I previously said, nothing is requiring you to use such an old Java. Everything runs just fine in Oracle Java 8. However, it is not recommended to use OpenJDK. There are known issues.

This is best done using the UI of open-zwave or habmin. Of course, you need to include your smart plug to your controller before anything will show up.

Yes, the ZW096 smart plug is compatible.
I see two nodes now in the 1.8.3 command line.
I have tried both openHAB2 beta and 1.8.3.

The Designer throws a Java Exception on Ubuntu, and generates an error log.
I haven’t checked it too deeply. I just went ahead and tried the OSX version.
Mac OSX explicitly states that Java 6 SE Runtime is required, but I can’t install that there, since I already have Java 8.
Can attach screen shot and error logs if you like.

My main problem is that I have to design a UI, and I don’t know how to do:

First step, is that I just want to a see a list of nodes on the ZWave network, and interact with them, similar to OZWCP. I understand that openHAB is a bus for all things automation. But certainly there must be at least a basic diagnostic page, like all this output on the command line, showing that there are two nodes and one is dead.

How? How do I describe a simple home setup of Aeotec ZStick and Smart Plug without the designer?
Can you maybe send me an example?

In openhab 1.8.3 I had to setup my zwave:port=/dev/ttyACM0, but I haven’t found, in OpenHAB2, a place where I put my ZStick / controller information into. Can you help me with this also?

Are there youtube video’s that show openHAB and ZWave tutorials?

I just reinstalled openHAB2 cleanly.
Set package to standard, binding to zwave as the only addon options.
Created the zwave.cfg with the port and health setting.
Used log:tail on the command line, and saw the binding get installed and UI restarted.

Was able to click on ‘Search for Things’ and see my ZStick as the controller!

I do believe that is a successful test of exactly what I wanted!

Thank You!

Now My only issue is that the wall plug seems to be marked as a Dead Node.
At least in OZWCP and openHAB 1.8.3 that’s what the status got stuck to.

Weird. I’ve no experience with Mac and Designer so can’t comment on that error.

Here is a screen shot of Designer running on Ubuntu 16 under Oracle Java 8. It can be done.

I’d be interested in what error you are seeing. It should work.

But Designer is just an IDE for creating an OH Home Automation Application. It isn’t going to give you the information you are currently seeking.

That is done in habmin or open-zwave. From within openHAB itself you can watch the logs for errors reported by the zwave binding to see the state of the nodes but OH was written to be generic, not to be a zwave or any other technology administration tool. Each binding has its own approach to diagnostics and administration which is most suitable to the technology involved and which is mostly independent from OH.

Things are very different in OH 2 from OH 1 these days and the documentation of OH 2 is incomplete and being written now.

In OH 1 the documentation of zwave is located in the wiki with lots of examples here.

It might be advisable to use 1.8 instead of OH 2 at this time given the incomplete nature of the documentation.

Setup of zwave on OH 1 involves the following (all documented on the wiki):

Make sure you have installed the zwave addon (i.e. there is a .jar file with zwave in the name in openHAB’s addons folder.

Make sure that what ever user openHAB is running as is a member of the dialout group so it has permission to read/write to the USB dongle.

Update openhab.cfg to point the zwave binding to the device in /dev which represents the USB dongle. For me thats:

zwave:port=/dev/ttyUSB0

Review your zwave network in habmin to discover the Node numbers of your devices. Alternatively you can watch openhab.log. The zwave binding will print out all of the discovered nodes and information about them when it starts up. Once the habmin page comes up wait for “Online Status” to go green. Then click Configuration at the top, Bindings at the bottom left, ZWAVE from the list, and finally the Devices tab on the right. You will see a list of all the Nodes configured with your controller and its status. You will also be able to do some administration (e.g. heal the network). The names will probably be “Node X” where X is the number you will care about.

Another important piece of information you can acquire from habmin is what command classes it supports. For example, if I open up my Node 3 I can see that it supports the Binary_Switch Class.

NOTE: Not all command classes are supported by the zwave binding. See the wiki for which ones are supported, what types of data they can send, and what types they can receive.

Now that I know the node number of command class I can create an Item bound to that device to represent it in my OH. Here are some of my zwave Item definitions (simplified somewhat). See the wiki page for Items for details on the syntax. The zwave specific part is in the curly brackets.

Switch  S_L_Front               "Front Room Lamp"           <light> {zwave="3:command=switch_binary,respond_to_basic=true"}
Number N_V_COSmoke_Main_Alarm   "Main Floor Smoke/CO [%d]"  <siren> {zwave="5:command=alarm"}
Number N_V_COSmoke_Main_Battery "Main Floor Smoke/CO Alarm Battery [%d]" <temperature> {zwave="5:command=battery"}
Switch T_C_Minimote_1_Button1_Short {zwave="15:command=SCENE_ACTIVATION,scene=1,state=1"}

Notice the smoke alarm is represented by two Items, one for the alarms and another to tell me its current battery level. The first number after “zwave=” is the Node number we acquired from before. The “command=” part is the command class.

Next we want to see the Item’s values. For this we need to put it on the sitemap. See the sitemap wiki page for details on syntax. Here is a small section of my sitemap showing how that works. NOTE: the sitemap is completely insulated from the fact that the device is zwave. All it knows is it is a switch or a number or whatever.

                        Switch item=T_Update label="Request Sensor Update" mappings=[ON=Update]
                        Text item=N_D_Front_Last_Opened       icon="frontdoor-open"    visibility=[N_D_Front=="OPEN"]
                        Text item=N_D_Front_Last_Opened       icon="frontdoor-closed"  visibility=[N_D_Front!="OPEN"]
                        Text item=N_D_Back_Last_Opened        icon="frontdoor-open"    visibility=[N_D_Back=="OPEN"]
                        Text item=N_D_Back_Last_Opened        icon="frontdoor-closed"  visibility=[N_D_Back!="OPEN"]

You bring up the sitemap in a browser through http://<ip>:8080/openhab.app?sitemap=<name> where <ip> is the address of OH and <name> is the name of the .sitemap file you created.

That is the simplest end-to-end for zwave. If you want to do some additional logic/automation you need to bring in rules and if you want to capture data for charting and analysis you need to bring in persistence.