Author Topic: OpenHAB2 - can't get MIOS binding working with OH2  (Read 830 times)

Offline jamac

  • Jr. Member
  • **
  • Posts: 59
  • Karma: +0/-1
OpenHAB2 - can't get MIOS binding working with OH2
« on: January 27, 2017, 12:09:17 am »
I've set up OpenHAB2 on my Synology NAS but am having trouble getting the MIOS binding to work with my Vera3.

OH2 seems to be running ok on my NAS. I've installed a few bindings including Network, Autelis, Ecobee and Sonos, which are mostly working ok.

I have also attempted to install the MIOS binding. The Add-Ons tab (in PaperUI) claims that it has been installed but it's not showing up in the Configuration/Bindings tab.

I activated 'include legacy 1.x bindings" and re-installed the MIOS binding but nothing changed.

The MAP and RegEx Transformations have been installed. (I didn't do this... either the OH2 package or the MIOS binding installed them.)

Do I have to manually create or edits some configuration files? Are there any Synology settings that i need to adjust? I've searched a few forums for help but most of the posts relate to OH1 or the OH2 Beta and I'm not sure if the advice is reliable.

I'd appreciate some guidance. OH2 looks great... if only I could get it working with my Vera and z-wave devices...

Offline Quinten

  • Sr. Member
  • ****
  • Posts: 271
  • Karma: +2/-0
    • Awooga!!!
Re: OpenHAB2 - can't get MIOS binding working with OH2
« Reply #1 on: January 27, 2017, 03:20:10 am »
Pfew, I thought I was the only one.  Did you use the scripts to create the house.items file?  Not that it matters, as still nothing shows up.

But

If you then go to the Panel, you can actually add buttons, etc for the Mios devices...

Still, a wysiwyg UI would be nicer...
VeraLite - UI7 1.7.730 (was UI5 1.5.622) | 9x Fibaro FGD211 | 1x Fibaro FGS221 | 1x Fibaro FGBS321 | 1x Everspring SP814 | 2x Everspring AN157-3 | 2x Heatmiser PRT-TS WiFi | 1x Logitech Harmony Hub

Offline jamac

  • Jr. Member
  • **
  • Posts: 59
  • Karma: +0/-1
Re: OpenHAB2 - can't get MIOS binding working with OH2
« Reply #2 on: January 27, 2017, 07:53:08 am »
Did you use the scripts to create the house.items file? 

No - i wasn't sure if this was necessary for OH2.

If you then go to the Panel, you can actually add buttons, etc for the Mios devices...

So how do you do this? Which tab? I assume you're using the Paper UI?


Offline Quinten

  • Sr. Member
  • ****
  • Posts: 271
  • Karma: +2/-0
    • Awooga!!!
Re: OpenHAB2 - can't get MIOS binding working with OH2
« Reply #3 on: January 27, 2017, 05:09:49 pm »
Yes, you still need to do the script part to generate the file for the house.items

When you go to http://<youripaddress>:8080/start/index you get the choice to which of the (installed) UI's you want to go.  You configure (but doesnt seem to work) in PaperUI, but the real deal is in the HAB Panel UI.  You can there configure/design your buttons and actions.
VeraLite - UI7 1.7.730 (was UI5 1.5.622) | 9x Fibaro FGD211 | 1x Fibaro FGS221 | 1x Fibaro FGBS321 | 1x Everspring SP814 | 2x Everspring AN157-3 | 2x Heatmiser PRT-TS WiFi | 1x Logitech Harmony Hub

Offline jamac

  • Jr. Member
  • **
  • Posts: 59
  • Karma: +0/-1
Re: OpenHAB2 - can't get MIOS binding working with OH2
« Reply #4 on: January 27, 2017, 08:44:24 pm »
Thanks, but I think I have a bigger problem.

The guide for installing OH2 on a Synology NAS indicates that "The configuration files are located at: /volume1/@appstore/openHAB2/userdata/config". See http://docs.openhab.org/installation/synology.html#installation. However, when I check the directory structure of my NAS I only see a directory called /homes/openhab2. There are only two items in the directory - a 1kb file called .profile. and a sub-directory called .karaf, which contains a 0kb files called karaf.history.

This tells me (I think) that the OH2 installation process hasn't completed properly. I installed Java SE 8 prior to installing the OH2 package as per the instructions.

Was I meant to manually creates any directories or set any Synology user permissions? The instructions don't mention this but something's is not quite right...

I've just found this tread which might contain some answers... https://community.openhab.org/t/synology-diskstation/1446/144

Offline jamac

  • Jr. Member
  • **
  • Posts: 59
  • Karma: +0/-1
Re: OpenHAB2 - can't get MIOS binding working with OH2
« Reply #5 on: January 29, 2017, 03:09:15 pm »
I found the following, which explains why there is no config file: "One thing to be aware of is any configuration done in PaperUI or Habmin gets saved to a non-human readable database." See http://docs.openhab.org/tutorials/migration

But surely I should see more than the couple of empty files referred to above?

Anyway, I thought I might run the 'item file generator' tool and see what it produced.

Can you give me any tips on how to run it on a windows PC? The guide states that the scripts can only be run on Linux, Unix or MacOS X systems. See https://github.com/openhab/openhab1-addons/tree/master/bundles/binding/org.openhab.binding.mios/examples/scripts

Do I need to use Bash?

Offline guessed

  • Moderator
  • Master Member
  • *****
  • Posts: 5294
  • Karma: +90/-22
  • Release compat is not a bolted-on afterthought
Re: OpenHAB2 - can't get MIOS binding working with OH2
« Reply #6 on: January 29, 2017, 06:43:36 pm »
The MiOS Binding is based upon openHAB 1.x.  When you run it under openHAB 2.x, it runs within the compatibility layer.

In the case of the MiOS Binding, it needs the MiOS Item Generator to be run in order to generate an _Items_ file.  You'll also need to tweak the (OH2) mios.cfg file to tell me where your Vera is running.

I went through the setup today, using Ubuntu 16 (xenial) and the Items files from my OH1 configuration.  It all appears to be working, except that the MiOS Binding itself doesn't show on the (OH2) Bindings page.... no idea why it's missing as it is installed)

Anyhow, the MiOS Item generator scripts need to be run on a Linux machine.  Behind the scenes, these scripts are simple wrappers to:
  • reading the XML from your Vera over a HTTP URL AND;
  • XML transform it to make the Items file.

Both these steps can be done (manually) using a Browser (download) an online transformation services (XML + XSL -> output)

To manually get the config of your Vera:
    http://${MIOS_IP}:49451/data_request?id=user_data&output_format=xml

To pickup the MiOS Item generator's XSL, download it from here:
    https://raw.githubusercontent.com/openhab/openhab1-addons/master/bundles/binding/org.openhab.binding.mios/examples/scripts/miosTransform.xslt

I just tried this out using this service, and it correctly generated the Item file from these two components:
    http://www.utilities-online.info/xsltransformation


Once you have it running, you can use HABPanel to add controls (Buttons etc) that use the Items.  I verified that using the latest apt-get build.

PS: Consider moving this discussion to the openHAB community forum.  It's easier for me to respond over there (and to know I need to followup ;) )

Offline stefaanbolle

  • Jr. Member
  • **
  • Posts: 51
  • Karma: +4/-1
Re: OpenHAB2 - can't get MIOS binding working with OH2
« Reply #7 on: January 30, 2017, 02:42:47 am »
@Guessed is right
The Mios binding works perfectly with Openhab2.
To easen life you indeed better use the items generator script (and then manually check the output because some FIXME strings might be present).
The documentation on the OH1 wiki for the binding is still valid.

Offline jamac

  • Jr. Member
  • **
  • Posts: 59
  • Karma: +0/-1
Re: OpenHAB2 - can't get MIOS binding working with OH2
« Reply #8 on: February 02, 2017, 06:49:28 am »
Thanks! This is the information I needed. I should be able to manage it from here.

Offline Cappinator

  • Newbie
  • *
  • Posts: 2
  • Karma: +1/-0
Re: OpenHAB2 - can't get MIOS binding working with OH2
« Reply #9 on: March 18, 2017, 05:47:04 am »
This is so typical.  You spend days trying to get something to work that others do in 5 minutes, and as soon as you decide to reach out and ask for help... you somehow make it work.  I managed to install ipkg on my synology, then libxslt so I could use xsltproc and now I have my house.items file :)

So, here are the steps I took, for any future linux newbie (like me) who is looking for step-by-step instructions.  Someone may want to chip in and provide a more optimal way of doing certain things.  I'm sure some of the steps I took were detours.
- Use SSH (or Putty) to connect to your Synology box
In SSH:
- type "cd /volume1/@appstore"
- type "mkdir openHAB2Scripts" to create a folder to host the ItemGenerator scripts
- type "cd openHAB2Scripts"
On your PC:
- In a browser, surf to http://www.synology-wiki.de/index.php/Welchen_Prozessortyp_besitzt_mein_System%3F (it's in German, if you don't speak it, google translate does a reasonable job on this page ;))
- Find your Synology model and copy the URL to the relevant IPKG package to your clipboard (or store it in a text file somewhere on your PC)
In SSH:
- type "mkdir tmp" and "cd tmp"
- type "wget <url_you_copied>" (it should now copy the xsh file into the tmp folder)
- type "chmod +x <package_file_name>" (so you can execute the script file)
- type "sudo sh <package_file_name>" (you will be asked for your password)
- type "cd .." and then "rm -rf tmp" (this will remove the tmp dir, since you don't need it anymore)
(if you want to check out what ipkg can do, type "ipkg --help", or just continue below if you don't want to bother)
- type "ipkg update" (this updates ipkg's list of packages it can get and install)
- type "ipkg list" (this should give you a big list of packages you can install)
- type "ipkg install libxslt" (this should install the package, giving you access to xsltproc"
- type "xsltproc -version" (if you don't get an error here, the package installed successfully)
On your PC:
- In a brower, surf to https://github.com/openhab/openhab1-addons/tree/master/bundles/binding/org.openhab.binding.mios/examples/scripts
- Download the files in the repository (README.md, miosLoad.sh, miosTransform.sh, miosTransform.xslt) to your PC
- Download WinSCP (google it, there's a portable version you can just unzip and use) and run it
- Connect to your Synology box and upload the files to the /volume1/@appstore/openHAB2Scripts folder
In SSH: (you should still be in the /volume1/@appstore/openHAB2Scripts folder)
- type "bash ./miosLoad.sh <ip_of_your_vera_controller>" (you should get a message saying "Metadata Loaded into user_data.xml!")
- type "bash ./miosTransform.sh house" (you should get a message saying "Metadata Transformed into openHAB Item file house.items!")
(I didn't get it, but you could get a list of duplicate items you need to fix first, don't know how to do this though, probably using WinSCP edit the house.items file)
- type "cp ./house.items /volume1/@appstore/openHAB2/conf/items/house.items"

And you're done!

I'm sure someone can comment and provide a faster/better way of doing this, but this is how I ended up figuring it out.




« Last Edit: March 18, 2017, 08:05:49 am by Cappinator »