My first steps with OpenHab

The Weather Company (formerly Wunderground) is fully supported in openHAB using the Weather Company binding, if you have an API key…

Do you mean the API for people with personal weather stations? It’s different from the old one.

I’m not sure what you are asking. The Weather Company binding requires an API key, which you cannot get unless you have a personal station and are providing data to TWC. This will not work with the old Wunderground API key.

There are two different APIs. There’s the old one, which included data like temperature and wind speed, and then new one (accessible only if you have personal weather station), which excludes this information. Yes, the API keys are different. When I looked at the Wunderground binding, it appeared to be the old API (and my PWS API key didn’t work). But that was before I upgraded OH. I’ll take a look at it again.

Looks to be the same as before. Using my API key (which I use with https://api.weather.com/v3/wx/forecast/daily/5day?format=json&units=m&apiKey=), I get “unknown” on the bridge thing.

Continuing the account of my first steps… as discussed on this thread:

I managed to get my Aeotec Gen5 Z-Stick set up as a secondary controller, by following this sequence:

  1. Plug Z-Stick Gen5 into any USB port
  2. Open Silicon Labs Z-Wave PC Controller v5.39 (getting hold of this can be a bit tricky. It’s discussed elsewhere on this forum. I can try to elaborate if anyone needs to know - if I can remember! Suffice to say that you need to register on their site.)
  3. Click the gear button (settings). Click the row showing the COM port, then detect, then OK
  4. Click network management
  5. Click Select learn mode and NWI (Classic may also work if the Zipabox is close)
  6. Go to the Zipabox and add device, Z-Wave. Zipabox says “starting exclusion…”. Don’t press anything on the Z-Stick. It will automatically be excluded.
  7. When Zipabox says “starting inclusion”, go back to Z-Wave PC Controller and go into learning mode again. Now the Zipabox will find the Z-Stick. At this point I got: “Device inclusion completed. Secure inclusion failed”. I didn’t worry about this because I don’t have any security-related devices. Perhaps I should worry more, but for the moment I’m happy to get this far.
  8. When I tried to connect the Z-Stick to the RPi, initially I got nothing because the extension cable I was using didn’t play well with the Z-Stick. When I connected it to another extension cable, the one I was using for the Enocean transceiver (both are too wide to be plugged directly into the USB sockets), I could see the device with the command: ls /dev/serial/by-id
  9. As described above, I think, I created a symlink so that would always get a clearly understandable symbolic name for whatever device is connected to the port in question. In my case, the vendor and device IDs are:
    idProduct=“0200”
    idVendor=“0658”
    These can differ according to the version of the Z-Stick, I think.
  10. That done, I added the Z-Stick manually in PaperUI. All I had to do was select the USB port (symbolic link name in this case). And 28 Z-Wave devices popped up.

Next problem: all my Fibaro FGWPE/F-102 wall plugs appear as unrecognised.

Also the Fibaro flood sensors.

The Aeotec sensors,TKB wall sockets and the SIR timer are working.

I decided to try making a binding for the Awair air quality sensor. I downloaded the addons package and found the Foobot binding, which is really similar to the Awair in every respect. I modified it for the Awair and now I need to test it. I’ve spent hours fiddling around with Eclipse and setting up the dependencies, but to no avail so far. I tried following a couple of how-tos on the OpenHab site, but also without success. I’ll carry on next week.

I eventually worked out how to set up the Eclipse environment and eliminated all the reported errors. After more than a month I’ve come back to it with the objective of generating a .jar for testing. After a couple of attempts I managed to get the jar generated by executing this command:

mvn clean install -DskipChecks

on the addon directory (org.openhab.binding.awair). Before doing that you need to clean up the code formatting with:

mvn spotless:apply

Now I have some errors to deal with from the automatic tests.

Fixed the test errors. Now I’m ready to test the addon on my system.

1 Like

Ahh, not quite. I got the 3.00 addon fixed, but not the 2.5x addon, and it’s still giving me problems with dependencies. I’ve just noticed that it’s asking for JRE 1.8, which I don’t have.

I got the 2.5.x version built. First, you don’t need the core from github (for which only the 3.0.0 branch is needed). But that wasn’t my problem. As explained here:

https://community.openhab.org/t/eclipse-setup-for-developing-2-5-x-addon

the imports change in 3.0.0. I had the imports right for 3.0.0, not for 2.5.x. I changed:

org.openhab.core

to

org.eclipse.smarthome.core

and also had to change the unit test imports and add a few more imports that seem to be needed in 2.5.x (I copied what I found in the 2.5.x version of the foobot binding).

Also, at the end of the Maven build I got a ton of errors starting with this:

 Feature resolution failed for [openhab-binding-awair/2.5.11.SNAPSHOT]
[ERROR] Message: Unable to resolve root: missing requirement [root] osgi.identity; 

Hunting around on the forum, I found this post:

And changed the following in feature.xml in my binding:

<bundle start-level="80">

to

<bundle dependency="true">

I have absolutely no idea what it does, but it got rid of the errors.

I can now test the binding on my OH system.

1 Like

I tested the Awair binding and got to the point where it appears in Bindings in Paper UI… and that’s it. Oh well, it’s a start. No entries appear in the main logs, although I tried to set up logging for the binding as described here on the forums. To be investigated.

I decided to press ahead with creating the building blocks of my rules. I said I was going to go down the Jython route, but the flesh is weak, so I’m going to use Javascript.

I read here that you couldn’t put non-rule utility function .js files in the rules folder, but I found the opposite to be the case. If I put them in another parallel folder, they are found by the rules engine, but attempts to call the functions seem to fail. If I put them in the “personal” folder, they work. I include them in the same way as the rules.js file:

load(Java.type("java.lang.System").getenv("OPENHAB_CONF")+'/automation/jsr223/javascript/personal/WeekdaysAndHolidays.js');

One thing I’ve noticed is that changes are only applied on restart.

Lots of progress today. First, I realised I needed to add the Awair bridge manually (duh). As soon as I did that, I was able to (try) to add a device and saw entries in the log. The device didn’t add because of a stupid typo in the binding. I’ll try the corrected version now.

I also saw a post that cleared up the confusion about the WeatherUnderground Personal Weather Station binding. If you have a PWS, the WeatherUnderground binding does not work, you need the Weather Forecast Company one.

A bit more progress. The Awair binding shows the right things and items, and it connects to the account, but discovery doesn’t work, and something goes wrong with reading the values when a device is added manually.

Awair binding now fully working. I need to get the 3.0 version compiling and work out how to get it included in future builds.

I spoke a bit too soon. I can’t get the item units to appear in PaperUI.

I’ve migrated quite a few rules from the Zipabox.

Trying to work out how to access the last position that Somfy RTS blinds and awnings were set to.