We have moved at community.getvera.com

Author Topic: Tools: openHAB Item file generator  (Read 32910 times)

Offline msebbe

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: Tools: openHAB Item file generator
« Reply #45 on: November 07, 2015, 06:27:28 pm »
@msebbe,
Let me know if you run into issues.  I've done the conversion for a few folks, in order to get sample data, and the biggest one I normally hit is that MiOS emits non-conforming XML.

This most often happens when you have Lua rules, since MiOS/Vera is not escaping "<" "&" etc when exporting the XML content (I've considered exporting is as JSON, and then converting it externally to XML, just to get around their buggy code.

There's a pending review for a revised version of the XSLT file that'll handle a broader array of MiOS Plugins (mostly @lolodomo's RFXTRX Plugin, but others also). 

That'll bubble up in r1.8.




If you find ":serviceId:" strings in your openHAB Items file, after transformation, let me know as I'm looking to handle default mappings for _every_ common plugin out there.

I found :serviceId strings in caused by some plugins yes. do you want my house.items file?

Offline msebbe

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: Tools: openHAB Item file generator
« Reply #46 on: November 07, 2015, 06:45:23 pm »
@msebbe,
Let me know if you run into issues.  I've done the conversion for a few folks, in order to get sample data, and the biggest one I normally hit is that MiOS emits non-conforming XML.

This most often happens when you have Lua rules, since MiOS/Vera is not escaping "<" "&" etc when exporting the XML content (I've considered exporting is as JSON, and then converting it externally to XML, just to get around their buggy code.

There's a pending review for a revised version of the XSLT file that'll handle a broader array of MiOS Plugins (mostly @lolodomo's RFXTRX Plugin, but others also). 

That'll bubble up in r1.8.




If you find ":serviceId:" strings in your openHAB Items file, after transformation, let me know as I'm looking to handle default mappings for _every_ common plugin out there.

I found :serviceId strings in caused by some plugins yes. do you want my house.items file?

Edit: Im tired now :D Will continue.. How do I make my house.items show up in the demo.sitemap?

Offline guessed

  • Moderator
  • Master Member
  • *****
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: Tools: openHAB Item file generator
« Reply #47 on: November 07, 2015, 08:33:51 pm »
Quote
I found :serviceId strings in caused by some plugins yes. do you want my house.items file?

I can do it using either the Items file, or the source user_data.xml.  The user_data.xml is better for me, because I can re-test your file and ensure correct output (that's what I did for a user on the openHAB forum recently)

The Items file is safer to post, since all the PII is stripped out (IIRC), but the user_data.xml might have sensitive data in it (so a PM to a link would be better)


Quote
I'm tired now :D Will continue.. How do I make my house.items show up in the demo.sitemap?

I built my Sitemap files  by hand.  It's possible there's a better way, but it was good enough for what I needed (I don't use the UI often, since most things are automated, or via a physical remote)

Offline msebbe

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: Tools: openHAB Item file generator
« Reply #48 on: November 08, 2015, 10:02:07 am »
Quote
I found :serviceId strings in caused by some plugins yes. do you want my house.items file?

I can do it using either the Items file, or the source user_data.xml.  The user_data.xml is better for me, because I can re-test your file and ensure correct output (that's what I did for a user on the openHAB forum recently)

The Items file is safer to post, since all the PII is stripped out (IIRC), but the user_data.xml might have sensitive data in it (so a PM to a link would be better)


Quote
I'm tired now :D Will continue.. How do I make my house.items show up in the demo.sitemap?

I built my Sitemap files  by hand.  It's possible there's a better way, but it was good enough for what I needed (I don't use the UI often, since most things are automated, or via a physical remote)

Maybe this is the wrong topic but.. Iam debugging right now and got this problem only:

Code: [Select]
15:58:05.780 DEBUG o.o.b.m.i.MiosUnitConnector[:742] - run: URI Built was 'http://192.168.1.18:3480/data_request?id=status2' loop '0'
15:58:05.785 DEBUG o.o.b.m.i.MiosUnitConnector[:768] - run: Exception Error occurred fetching/processing content: java.net.ConnectException: Connection refused,java.util.concurrent.ExecutionException: java.net.ConnectException: Connection refused.  Total failures (2)

Now it hits me: Do I have to install anything in my Vera Edge to make this work? Also, I havent given my raspberry with Openhab my username or password to my Vera Edge? Should that not be needed somewhere? // Thank you for helping a noob :) I also sent you the user_data in pm.

Offline guessed

  • Moderator
  • Master Member
  • *****
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: Tools: openHAB Item file generator
« Reply #49 on: November 08, 2015, 10:59:42 am »
Maybe this is the wrong topic but.. Iam debugging right now and got this problem only:

Code: [Select]
15:58:05.780 DEBUG o.o.b.m.i.MiosUnitConnector[:742] - run: URI Built was 'http://192.168.1.18:3480/data_request?id=status2' loop '0'
15:58:05.785 DEBUG o.o.b.m.i.MiosUnitConnector[:768] - run: Exception Error occurred fetching/processing content: java.net.ConnectException: Connection refused,java.util.concurrent.ExecutionException: java.net.ConnectException: Connection refused.  Total failures (2)

Now it hits me: Do I have to install anything in my Vera Edge to make this work? Also, I havent given my raspberry with Openhab my username or password to my Vera Edge? Should that not be needed somewhere? // Thank you for helping a noob :) I also sent you the user_data in pm.

The Binding uses a direct, local network, TCP connection to your Vera. It uses the same URL style used in the miosLoad.sh script.  It's not expecting any auth on this connection.

Double check the IP you've configured, as you're seeing Connection refused... Which is raw TCP, not an app auth issue.

Nothing needs to be installed on the MiOS/Vera end.

Offline msebbe

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: Tools: openHAB Item file generator
« Reply #50 on: November 08, 2015, 11:55:20 am »
Okey, that explains it.. However, I am unable to figure out what ip is wrong and where I change it?

Offline guessed

  • Moderator
  • Master Member
  • *****
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: Tools: openHAB Item file generator
« Reply #51 on: November 08, 2015, 12:41:36 pm »
The IP address needs to match that of your Vera unit.  You have it specified in the configurations/openhab.cfg file, in an entry like:

Code: [Select]
mios:house.host=192.168.1.18

Change that IP to be the one for your Vera

Offline msebbe

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: Tools: openHAB Item file generator
« Reply #52 on: November 08, 2015, 12:55:27 pm »
Wow, thank you! You are really on point! I've been stareing myself blind.. Funny that my Vera IP is xxx.xxx.x.187 an pi is xxx.xxx.x.18           :D

Holy.. This is so amazing I must really really thank you for your work. I was really dreaming about something like this, and now I got it working! And it was easy even for me - a non-linux person although I'm a total tech-guy and I dont give up easy. It was pure luck that I stumpled upon the MiOS binding and Im so glad that I did!

My coming goals will be to: Setup a good Sitemap ----> Create a dashboard by using dashing.io for a wallmounted tablet that will have motion detection to wake its screen. :)

Even though Openhab is not the original system and just runs on a raspberry pi 2,  Openhab is so much faster and responsive than the Vera UI or the Domoticz app!
« Last Edit: November 08, 2015, 01:21:38 pm by msebbe »

Offline guessed

  • Moderator
  • Master Member
  • *****
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: Tools: openHAB Item file generator
« Reply #53 on: November 08, 2015, 03:37:07 pm »
Great stuff, glad you got it working!  Thanks for the user_data.xml, much appreciated.  I'm using it to tune up the XSLT to make for a better mapping for the next round of users.

If you want UI's, this openHAB Thread might interest you:
    https://community.openhab.org/t/dashboard-ui-suitable-for-tablets/2329

It's a little technical, but it'll let you composite a very rich UI from off the help components.  When I get some cycles, it's what I'll use to replace the standard openHAB iOS App I'm currently using, but I'll integrate TV/AV Control into it (for Media control)

Offline msebbe

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: Tools: openHAB Item file generator
« Reply #54 on: November 08, 2015, 04:15:40 pm »
Great stuff, glad you got it working!  Thanks for the user_data.xml, much appreciated.  I'm using it to tune up the XSLT to make for a better mapping for the next round of users.

If you want UI's, this openHAB Thread might interest you:
    https://community.openhab.org/t/dashboard-ui-suitable-for-tablets/2329

It's a little technical, but it'll let you composite a very rich UI from off the help components.  When I get some cycles, it's what I'll use to replace the standard openHAB iOS App I'm currently using, but I'll integrate TV/AV Control into it (for Media control)

That was the least I could do for all this! :) Yes, that thread is what I saw, will be trying to follow those instructions soon.

Offline guessed

  • Moderator
  • Master Member
  • *****
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: Tools: openHAB Item file generator
« Reply #55 on: November 08, 2015, 04:37:21 pm »
Ok, submitted this PR to openHAB for tweaks to the MiOS Item Generator:
    https://github.com/openhab/openhab/pull/3399

This includes additions based upon @msebbe's user_data.xml file (notably aliases for HouseModes, VeraAlert & Arduino) and some additional strings/datatype stuff to lessen the amount of post-generation tweaking folks have to perform on the Items file.

Offline msebbe

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: Tools: openHAB Item file generator
« Reply #56 on: November 09, 2015, 04:15:45 pm »
Ok, submitted this PR to openHAB for tweaks to the MiOS Item Generator:
    https://github.com/openhab/openhab/pull/3399

This includes additions based upon @msebbe's user_data.xml file (notably aliases for HouseModes, VeraAlert & Arduino) and some additional strings/datatype stuff to lessen the amount of post-generation tweaking folks have to perform on the Items file.

Alright, I dont understand though, do I need to replace :serviceID: with something? And If I add new devices to my Vera, what Is the best way to update to get it into Openhab?

Offline guessed

  • Moderator
  • Master Member
  • *****
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: Tools: openHAB Item file generator
« Reply #57 on: November 09, 2015, 11:10:40 pm »
The full form, with serviceId, always works.  The new generator uses a short-form alias to make it easier to work with.  These aliases are built into the Binding itself so a new generator needs a new rev of the binding (1.8 in this case)

Offline MikeH

  • Sr. Newbie
  • *
  • Posts: 38
  • Karma: +1/-0
Re: Tools: openHAB Item file generator
« Reply #58 on: December 11, 2015, 09:59:58 am »
Hi,
I'm in the process of trying to setup OpenHAB by following all the great information on this forum.  I've got the demo running on my raspberry pi 2.  I'm now trying to use the OpenHAB Item file generator.  I don't have much experience with linux.  I did the first step using miosLoad.sh and it created a file called user_data.xml.  When I do the second step I entered the following command "sudo ./miosTransform.sh user_data.xml"  I get the following message:
Transforming MiOS Unit Metadata from user_data.xml...
warning: failed to load external entity "miosTransform.xslt"
cannot parse miosTransform.xslt
Failed to Transform, Check for bogus XML in user_data.xml.

Can someone let me know what I'm doing wrong.

Offline guessed

  • Moderator
  • Master Member
  • *****
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: Tools: openHAB Item file generator
« Reply #59 on: December 11, 2015, 10:49:58 am »
When you run the second script it looks for the transformation/mapping file (miosTransform.xslt). 

This is usually part of the bundle but the latest parts can all be downloaded from here:

    https://github.com/openhab/openhab/tree/master/bundles/binding/org.openhab.binding.mios/examples/scripts

From the error you're seeing, it sounds like that transformation file isn't present.  It should be in the same directory as miosTransform.sh, which is the script you're using to launch the process.

PS: You shouldn't need "sudo".  It's only needed if you're doing this in a directory that your regular pi/openhab user doesn't have write permissions to.