Tools: openHAB Item file generator

Thank you @guessed

I removed all scripts files. Recopied them again. Set the executable bit on the files, then run ./miosLoad.sh without bash and it worked.

Thanks again

New version uploaded, this one:

[ul][li]Uses the openHAB MAP file “[tt]en.map[/tt]” for all Contact Items it generates - taking a baby-step closer to i18n[/li]
[li]Uses a new MiOS MAP file “[tt]miosDeviceStatusUI.map[/tt]” to provide more readable strings for use in UI’s[/li][/ul]

NOTE: I’ve introduced a new MAP file, [tt]miosDeviceStatusUI.map[/tt], which will need to be installed into OH/configurations/transform, along with the other [tt]mios*.map[/tt] files, if you use this version of the MiOS Item Generator.

The TARball includes a copy of all MiOS Map files, but you can also get them from the standard location:
openhab1-addons/bundles/binding/org.openhab.binding.mios/examples/transform at main · openhab/openhab1-addons · GitHub

Wow this guy @guessed is a genius ! I am stumbling through openhab and mios. The item generator is pure magic. Thanks for your time and hardwork.

Hi, I wanna start of by thanking you for this work - This is exactly what I am looking for :slight_smile:
I have a Vera Edge running UI7. I have installed openhab on my raspberry pi 2. I have low knowledge of linux :((

I get this problem:

root@RaspberryVERA:/opt/OH/tools# ./miosTransform.sh house 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.

What is wrong? :frowning: Appreciate any help!

Edit: After doublechecking everything I realised that I forgot to copy miosTransform.xslt to my raspberry…

Worked now I think. Will continue tomorrow :slight_smile:

@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 “[tt]:serviceId:[/tt]” 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.

[quote=“guessed, post:45, topic:185623”]@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 “[tt]:serviceId:[/tt]” 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.[/quote]

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

[quote=“msebbe, post:46, topic:185623”][quote=“guessed, post:45, topic:185623”]@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 “[tt]:serviceId:[/tt]” 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.[/quote]

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

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

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)

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)

[quote=“guessed, post:48, topic:185623”]

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)

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)[/quote]

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

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 :slight_smile: I also sent you the user_data in pm.

[quote=“msebbe, post:49, topic:185623”]Maybe this is the wrong topic but… Iam debugging right now and got this problem only:

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 :slight_smile: I also sent you the user_data in pm.[/quote]

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.

Okey, that explains it… However, I am unable to figure out what ip is wrong and where I change it?

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:

mios:house.host=192.168.1.18

Change that IP to be the one for your Vera

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 :smiley:

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. :slight_smile:

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!

Great stuff, glad you got it working! Thanks for the [tt]user_data.xml[/tt], 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:
Dashboard UI suitable for tablets - Items & Sitemaps - openHAB Community

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)

[quote=“guessed, post:54, topic:185623”]Great stuff, glad you got it working! Thanks for the [tt]user_data.xml[/tt], 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:
Dashboard UI suitable for tablets - Items & Sitemaps - openHAB Community

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)[/quote]

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

Ok, submitted this PR to openHAB for tweaks to the MiOS Item Generator:
MiOS Binding: Further tuning of the MiOS Item Generator by mrguessed · Pull Request #3399 · openhab/openhab1-addons · GitHub

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.

[quote=“guessed, post:56, topic:185623”]Ok, submitted this PR to openHAB for tweaks to the MiOS Item Generator:
MiOS Binding: Further tuning of the MiOS Item Generator by mrguessed · Pull Request #3399 · openhab/openhab1-addons · GitHub

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.[/quote]

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?

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)

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.

When you run the second script it looks for the transformation/mapping file ([tt]miosTransform.xslt[/tt]).

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 [tt]miosTransform.sh[/tt], which is the script you’re using to launch the process.

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