I spent a little time today building an Item file generator, since it seems like a common stumbling block for folks getting started. It was inspired by @Ap15e’s work but does the conversion in a very different manner (no burden on Vera, and a complete list of StateVariables is converted to their Item counterparts)
Anyhow, it’s a two-step process:
a) the first step (“miosLoad.sh”) retrieves an XML version of the MiOS Device MetaData from your Vera Unit.
In some cases, Vera spits out “invalid” XML, so this content may have to be hand-edited prior to feeding it into the next step. The output of this phase is a file called “user_data.xml”
b) the second step (“miosTransform.sh”) converts the XML into a Textual openHAB Items file.
If this completes successfully, then you’ll end up with an output file like “house.items”
This is an example of what it’s like to run these command line scripts:
me$ ./miosLoad.sh 192.168.1.100
Loading MiOS Unit Metadata from 192.168.1.100...
Metadata Loaded into user_data.xml!
me$ ./miosTransform.sh house
Transforming MiOS Unit Metadata from user_data.xml...
Metadata Transformed into house.items!
Duplicate Item names requiring manual fixes:
String DownstairsDeviceStatus "Downstairs Device Status [%s]" (GDevices) {mios="unit:house,device:385/status"}
Number DownstairsId "ID [%d]" (GDevices) {mios="unit:house,device:385/id"}
String LivingRoomSonosPIcon "Living Room Sonos (P) Icon [%s]" (GDevices,GRoom2) {mios="unit:house,device:295/service/DeviceProperties/Icon"}
String MasterBedroomSonosIcon "Master Bedroom Sonos Icon [%s]" (GDevices,GRoom7) {mios="unit:house,device:331/service/DeviceProperties/Icon"}
String SceneControllerConfigured "_Scene Controller Configured [%s]" (GDevices) {mios="unit:house,device:394/service/HaDevice1/Configured"}
String SceneControllerDeviceStatus "_Scene Controller Device Status [%s]" (GDevices) {mios="unit:house,device:393/status"}
String SceneControllerDeviceStatus "_Scene Controller Device Status [%s]" (GDevices) {mios="unit:house,device:394/status"}
Number SceneControllerId "ID [%d]" (GDevices) {mios="unit:house,device:394/id"}
Number SceneControllerId "ID [%d]" (GDevices) {mios="unit:house,device:4/id"}
String SceneControllerScenes "_Scene Controller Scenes [%s]" (GDevices) {mios="unit:house,device:393/service/SceneController1/Scenes"}
String SceneControllerScenes "_Scene Controller Scenes [%s]" (GDevices) {mios="unit:house,device:394/service/SceneController1/Scenes"}
String SceneMasterBathroom "Master Bathroom Scene" <sofa> (GScenes) {mios="unit:house,scene:34/status", autoupdate="false"}
String SceneMasterBathroom "Master Bathroom Scene" <sofa> (GScenes) {mios="unit:house,scene:35/status", autoupdate="false"}
String SceneTestArmed "TestArmed Scene" <sofa> (GScenes) {mios="unit:house,scene:73/status", autoupdate="false"}
String SceneTestDisarmed "TestDisarmed Scene" <sofa> (GScenes) {mios="unit:house,scene:76/status", autoupdate="false"}
String UpstairsDeviceStatus "Upstairs Device Status [%s]" (GDevices) {mios="unit:house,device:337/status"}
Number UpstairsId "ID [%d]" (GDevices) {mios="unit:house,device:337/id"}
Contact SceneMasterBathroomActive "Active [%s]" <sofa> (GScenes) {mios="unit:house,scene:34/active"}
Contact SceneMasterBathroomActive "Active [%s]" <sofa> (GScenes) {mios="unit:house,scene:35/active"}
Contact SceneTestArmedActive "Active [%s]" <sofa> (GScenes) {mios="unit:house,scene:79/active"}
Contact SceneTestDisarmedActive "Active [%s]" <sofa> (GScenes) {mios="unit:house,scene:80/active"}
At this point, you’ll have a fairly complete house.items file for use in openHAB. I’ve included almost all of the “by-hand” rules for conversion that I’ve used in the past, so SwitchPower1/Status become Switch, etc, but I’m sure there’s a lot more to add as people try out devices (etc) that I don’t have.
The conversion script relies upon the command-line utility called [tt]xsltproc[/tt], which seems to come with Linux and Mac OSX.
Not everything is neatly parceled, but it will get you a very close starting point. You will want to manually check the output Items file, since I don’t perform any name-collision checks what-so-ever, and Item-names might have gotten duplicated (actually, I know they do in some cases)
Downloads…
[ul][li]Tested 1.8.x version - TAR ball from Box.net
[/li]
[li]Nightly version - MiOS Binding conversion Scripts and MAP files
[/li][/ul]
Note: You can also use this trick to retrieve the MAP files.