We have moved at community.getvera.com

Author Topic: VeraLite to Openhab conversion (using raspberry pi and razberry board)  (Read 156701 times)

Offline lolodomo

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: VeraLite to Openhab conversion (using raspberry pi and razberry board)
« Reply #105 on: September 26, 2014, 05:15:54 pm »
Hi @guessed
What reason for Sonos to use your Vera binding rather than the Sonos binding ?
« Last Edit: September 26, 2014, 07:25:39 pm by lolodomo »

Offline guessed

  • Moderator
  • Master Member
  • *****
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: VeraLite to Openhab conversion (using raspberry pi and razberry board)
« Reply #106 on: September 26, 2014, 06:47:36 pm »
Ni @guessed
What reason for Sonos to use your Vera binding rather than the Sonos binding ?

I needed a way to migrate to the bigger platform, and not to have to do it all at once.

The first step in that process is the MiOS [Bridge] Binding, since it brings across "everything" I have running in Vera, but still lets me interact with those bits on Vera from within OH, and I can configure it to handle more stuff that might come along in Vera (if I'm in the middle of migrating)

The second step is to slowly convert over the components of my system to run natively under openHAB.  The next piece to be converted is my Alarm System, and then I'll look more closely at the OH Sonos Binding to see how much "gap" their is.... probably not much, since I'm running a fairly old version of the MiOS Sonos codebase (shortly after we added the TT pieces), and my [current] usage is fairly simple.



Anyhow, in order to interact with parts on Vera, the MiOS Bridge Binding has a bunch of small mapping files.  If you want something to appear in the OH UI that's not simply "text", then the data from Vera needs to be mapped to it's equivalent in OH (mostly for the interactions).

In the case of the Sonos stuff, I mapped the OH Volume & Mute "Commands" into the counterpart MiOS UPnP calls, and this mapping is in one of the Text files I provide.  I didn't map all of the MiOS Sonos stuff, so things like TTS aren't mapped (although that would be easy) instead I'm using the native OH Say (via my Mac, to a Sonos Line-in)

Offline lolodomo

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: VeraLite to Openhab conversion (using raspberry pi and razberry board)
« Reply #107 on: September 27, 2014, 07:37:37 am »
@guessed: what is the install procedure if we want to test ?
I imagine we have to first do a regular OpenHAB install/setup (1.5.1) but then where to find your binding ?

Offline guessed

  • Moderator
  • Master Member
  • *****
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: VeraLite to Openhab conversion (using raspberry pi and razberry board)
« Reply #108 on: September 27, 2014, 01:05:21 pm »
@guessed: what is the install procedure if we want to test ?
I imagine we have to first do a regular OpenHAB install/setup (1.5.1) but then where to find your binding ?

The clone has all of openHAB, so you'd do all the normal stuff to get an openHAB build environment (mvn, Oracle's Java 7, etc, etc) and then use the clone as the root to build a new openHAB (using their standard instructions).

From there, once you've done the usual:
Code: [Select]
    mvn clean install
assuming that "full" build completes successfully, it's just:
Code: [Select]
cd bundles/binding/org.openhab.binding.mios
cp target/org.openhab.binding.mios-1.6.0-SNAPSHOT.jar <yourOHRoot>/addons/
cp examples/transform/* <yourOHRoot>/configuration/transform/
cd <yourOHRoot>/configuration/
vi openhab_default.cfg

and add the lines:
Code: [Select]
mios:house.timeout = 30000
mios:house.host = 192.168.1.53

and then build out an items and sitemap file entry for whatever you want to validate.

eg. <yourOHRoot>/configuration/items/house.items

Code: [Select]
...

Number   PortableSonosId "ID [%d]" {mios="unit:house,device:295/id"}
String   PortableSonosDeviceStatus "Device Status [%s]" (GPortableSonos) {mios="unit:house,device:295/status,in:MAP(miosStatusIn.map)"}
String   PortableSonosTransportState "Portable Sonos State [%s]" (GPortableSonos) {mios="unit:house,device:295/service/AVTransport/TransportState,command:MAP(miosUPnPTransportStatePlayModeCommand.map)"}
String   PortableSonosCurrentStatus "Portable Sonos Playing [%s]" (GPortableSonos) {mios="unit:house,device:295/service/AVTransport/CurrentStatus"}
Switch   PortableSonosMute "Mute" (GPortableSonos) {mios="unit:house,device:295/service/RenderingControl/Mute,command:MAP(miosUPnPRenderingControlMuteCommand.map),in:MAP(miosSwitchIn.map),out:MAP(miosSwitchOut.map)"}
Dimmer   PortableSonosVolume "Volume [%d] %" (GPortableSonos) {mios="unit:house,device:295/service/RenderingControl/Volume,command:MAP(miosUPnPRenderingControlVolumeCommand.map)", autoupdate="false"}
DateTime PortableSonosLastUpdate "Last Update [%1$ta, %1$tm/%1$te %1$tR]" <calendar> (GPortableSonos) {mios="unit:house,device:295/service/HaDevice1/LastUpdate"}
...

eg. <yourOHRoot>/configuration/sitemaps/house.sitemap

Code: [Select]
...
                        Text     item=PortableSonosTransportState {
                                Switch   item=PortableSonosTransportState label="Current State" mappings=[PLAYING="Play", STOPPED="Stop", PAUSED="Pause"]
                                Switch   item=PortableSonosMute
                                Slider   item=PortableSonosVolume
                                Text     item=PortableSonosCurrentStatus
                        }
...

Offline shmixx

  • Full Member
  • ***
  • Posts: 171
  • Karma: +2/-1
Re: VeraLite to Openhab conversion (using raspberry pi and razberry board)
« Reply #109 on: September 30, 2014, 12:07:17 pm »
@Guessed

Thank you indeed for the hard work. I took the build info you supplied earlier and have been slowly moving everything over to control in OpenHAB. I've got pretty much everything crossed over (item wise) and now I'm working on decompiling all my Vera Alerts (RichardT) and PLEG (RichardT) rules over to OpenHAB. It's slow moving as I'm not exactly a java expert and there is a lot of mixed info to cross as you indicate with the Transformations.

I think I successfully got the transformation in for my Alarm (Honeywell Vista 20P using AD2USB in Vera). It is causing me some headaches which @jepete knows about with regard to the Ready/Disarmed states in the DetailedArmMode vs ArmMode. Anyhow, I'd be interested what Alarm system you start working on, and I'm happy to help provide and review as well. It's been amazing getting this going and the response is light years better than Vera. It's also gotten to a point where I think my VeraLite has stopped randomly rebooting!! :)

Offline shmixx

  • Full Member
  • ***
  • Posts: 171
  • Karma: +2/-1
Re: VeraLite to Openhab conversion (using raspberry pi and razberry board)
« Reply #110 on: September 30, 2014, 12:11:49 pm »
One question I do have as I try to consolidate some of the items, I've got multiple Window/Door sensors that have a tripped and armed status. Currently I've got 2 items for each one, and no way to display them in the interface as a single item. Is there a way to combine the 2 items into one? Or at least let me display in the mobile app just the switch and change the image like the contact (for tripped status)?

ex:
Code: [Select]
Switch Door_FF_Hallway_Arm "Front Door" (FF_Hallway,Security) {mios="unit:orion,device:25/service/SecuritySensor1/Armed,command:MAP(miosArmedCommand.map),in:MAP(miosSwitchIn.map)"}
Contact Door_FF_Hallway "Front Door" (FF_Hallway,Security) {mios="unit:orion,device:25/service/SecuritySensor1/Tripped,in:MAP(miosContactIn.map)"}

Offline guessed

  • Moderator
  • Master Member
  • *****
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: VeraLite to Openhab conversion (using raspberry pi and razberry board)
« Reply #111 on: September 30, 2014, 01:31:40 pm »
Anyhow, I'd be interested what Alarm system you start working on, and I'm happy to help provide and review as well.

There's already a user building a DSC Alarm, so I'm going to rebuild the Paradox EVO Panel codebase when I get a few cycles....  I just swapped out the old Panel (DGP-848) for a new board (EVO-192) so I had a spare environment to develop against.

Quote
It's been amazing getting this going and the response is light years better than Vera. It's also gotten to a point where I think my VeraLite has stopped randomly rebooting!! :)

In some cases, I can imagine it going the other way also ;)    I've see times where Vera's "UI Simple" API does some really obscure things, causing my code to cycle tightly on updates that aren't really there (the data is there, but it's not changing).  In other cases (Leviton Scene controllers) MCV seems not to handle the update timestamps correctly, so some of their status is present in every call (benign, but annoying)

Anyhow, glad you're having fun with it.  The code itself is fairly simple, and most shouldn't need to know Java (their scripting environment is something else)

Offline guessed

  • Moderator
  • Master Member
  • *****
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: VeraLite to Openhab conversion (using raspberry pi and razberry board)
« Reply #112 on: September 30, 2014, 01:39:28 pm »
One question I do have as I try to consolidate some of the items, I've got multiple Window/Door sensors that have a tripped and armed status. Currently I've got 2 items for each one, and no way to display them in the interface as a single item. Is there a way to combine the 2 items into one? Or at least let me display in the mobile app just the switch and change the image like the contact (for tripped status)?

ex:
Code: [Select]
Switch Door_FF_Hallway_Arm "Front Door" (FF_Hallway,Security) {mios="unit:orion,device:25/service/SecuritySensor1/Armed,command:MAP(miosArmedCommand.map),in:MAP(miosSwitchIn.map)"}
Contact Door_FF_Hallway "Front Door" (FF_Hallway,Security) {mios="unit:orion,device:25/service/SecuritySensor1/Tripped,in:MAP(miosContactIn.map)"}

openHAB deals in Items, and these are (mostly) single valued items.  It's UI mapping layer (Sitemaps) does a mostly 1-1 job so you tend not to have compound controls of any form (at least not in the current generation of built-in UI's).

For the case you've outlined above you'll either have a sitemap with 2x entries (a Switch and a Text), at the same level of something like this:

Code: [Select]
                ...
                Text     item=DownstairsSmoke4Tripped labelcolor=[DownstairsSmoke4LastTrip<300="ORANGE"] {
                        Switch   item=DownstairsSmoke4Armed
                        Text     item=DownstairsSmoke4BatteryLevel
                        Text     item=DownstairsSmoke4BatteryDate
                        Text     item=DownstairsSmoke4LastTrip
                }
                ...

it. A menu/label that you can drill down on, with an OPEN/CLOSED Label (changeable) and is colored Orange if it's tripped in the last 5 minutes.

You may want to start taking these general openHAB questions to their forum, since there's a wider array of people that can answer them there.

Offline shmixx

  • Full Member
  • ***
  • Posts: 171
  • Karma: +2/-1
Re: VeraLite to Openhab conversion (using raspberry pi and razberry board)
« Reply #113 on: September 30, 2014, 04:05:58 pm »
@Guessed

Thanks that is helpful to know. I didn't think there was a way around the 2 items, unfortunate, but hopefully 2.x releases will improve on that. I wasn't sure if posting in the general GGroups would have covered it as I wasn't sure the command mapping wasn't something different because of the MiOS translations, but it seems those exist for anything where the response isn't something already built in. So I'm starting to get the hang of it where I don't spend 20 minutes re-learning how the mappings work every time I come back to adding in some new rules or items. ;)

I think I'm facing something similar as you mentioned too about the updates that aren't there. I'm trying to narrow down something with the alarm where I'm getting duplicate messages for the Armed status, and then repeat notifications when a door opens (which is connected through the Alarm Panel). Working through the variations, I think I'm almost there though, so I'm happy.

Offline guessed

  • Moderator
  • Master Member
  • *****
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: VeraLite to Openhab conversion (using raspberry pi and razberry board)
« Reply #114 on: September 30, 2014, 04:21:28 pm »
I think I'm facing something similar as you mentioned too about the updates that aren't there. I'm trying to narrow down something with the alarm where I'm getting duplicate messages for the Armed status, and then repeat notifications when a door opens (which is connected through the Alarm Panel). Working through the variations, I think I'm almost there though, so I'm happy.

If you aren't already, you should run with the debug startup script:

   
Code: [Select]
start_debug.sh
It enables additional DEBUG Level logging that'll give you a greater idea of what's going on.  You can also edit the Log levels in
   
Code: [Select]
configurations/logback{_debug}.xml (for start.sh or start_debug.sh, resp)

Most of my interesting stuff is in DEBUG level, but I have some in TRACE Level, and you'd need to edit the above configuration file to enable those.

Offline guessed

  • Moderator
  • Master Member
  • *****
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: VeraLite to Openhab conversion (using raspberry pi and razberry board)
« Reply #115 on: October 09, 2014, 09:41:05 am »
@guessed: what is the install procedure if we want to test ?
I imagine we have to first do a regular OpenHAB install/setup (1.5.1) but then where to find your binding ?

@lolodomo,
If you want to shorten the time to test/try-out stuff, you can also just download the pre-compiled/binary version of openHAB 1.6 from the openHAB Site and then add the MiOS JAR that's under review into the addons directory of openHAB.

This will avoid the need for mvn and other compile-time environment components (although you'll still need the JDK to actually run openHAB), but overall it makes the process a lot simpler.

Offline lolodomo

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: VeraLite to Openhab conversion (using raspberry pi and razberry board)
« Reply #116 on: October 09, 2014, 12:42:25 pm »
@guessed: what is the install procedure if we want to test ?
I imagine we have to first do a regular OpenHAB install/setup (1.5.1) but then where to find your binding ?

@lolodomo,
If you want to shorten the time to test/try-out stuff, you can also just download the pre-compiled/binary version of openHAB 1.6 from the openHAB Site and then add the MiOS JAR that's under review into the addons directory of openHAB.

This will avoid the need for mvn and other compile-time environment components (although you'll still need the JDK to actually run openHAB), but overall it makes the process a lot simpler.

Ok

I don't find the download location for version 1.6.
Last version found is 1.5.1.
Can you provide the link please.

Offline guessed

  • Moderator
  • Master Member
  • *****
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: VeraLite to Openhab conversion (using raspberry pi and razberry board)
« Reply #117 on: October 09, 2014, 01:00:07 pm »
I don't use any 1.6 specific APIs or features so you can layer atop 1.5 also.

The nightly build is on cloudbees, so that's 1.6 based.

It'll be something like:
    https://openhab.ci.cloudbees.com/job/openHAB/

Offline AgileHumor

  • Hero Member
  • *****
  • Posts: 984
  • Karma: +51/-27
  • KISS
Re: VeraLite to Openhab conversion (using raspberry pi and razberry board)
« Reply #118 on: October 25, 2014, 12:50:04 pm »
The JAR file link is 404'ing

https://buildhive.cloudbees.com/job/openhab/job/openhab/1238/org.openhab.binding$org.openhab.binding.mios/artifact/org.openhab.binding/org.openhab.binding.mios/1.6.0-SNAPSHOT/org.openhab.binding.mios-1.6.0-SNAPSHOT.jar
WMC Leviton:18xVPE06,8xVRS15,3xVRP03-W,2xVRR15,4xVRCS4,2xVRCS2,VP00R,8xVRS15 Aeon:5xDSC06106,4xDSC24,4xDSC25,12xDSB29,2xDSC11,4xDSB54,DSB05,3xDSA22,DSA38,2xDSA03202B,DSB09104,HEM Other:3xYale,12xHSM100v3,7xSP103,45604,WDHA-12,SSA2USR,EVLCD1T,6xWWA02A,7xIPC-HFW2100,URTSI,Hue,Russound,OpenSprinker

Offline guessed

  • Moderator
  • Master Member
  • *****
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: VeraLite to Openhab conversion (using raspberry pi and razberry board)
« Reply #119 on: October 25, 2014, 01:19:48 pm »
Here's a version from my Box.net account:
    https://app.box.com/s/t1tr1vp3cj4v9xtje5o5

Looks like the build system purges after a while.  This version includes the latest changes, which mostly revolve around "reasonable defaults" for typical bindings (light switches, dimmers, motion sensors, locks) so that the in:, out:, and command: binding-string parameters aren't needed (at least, not for the common cases)

eg. a Simple Switch binding:

Code: [Select]
Switch   FamilyTheatreLightsStatus "Family Theatre Lights" (GSwitch) {mios="unit:house,device:13/service/SwitchPower1/Status"}

eg. a Dimmer binding:

Code: [Select]
Dimmer   FamilyTheatreLightsLoadLevelStatus "Family Theatre Lights [%d] %" <slider> (GDimmer) {mios="unit:house,device:13/service/Dimming1/LoadLevelStatus", autoupdate="false"}

eg. a Security Sensor

Code: [Select]
Contact  MotionFamilyZoneTripped "Motion Family (Zone 16) [%s]" (GContact,GMotion,GPersist) {mios="unit:house,device:130/service/SecuritySensor1/Tripped"}

eg. a Scene

Code: [Select]
String   SceneFamilyMotion "Family Motion Scene" <sofa> (GScene) {mios="unit:house,scene:91/status", autoupdate="false"}
Contact  SceneFamilyMotionActive "Active [%s]" <sofa> {mios="unit:house,scene:91/active"}

eg. A MiOS Device Status Attribute (used in Sitemaps to colorize controls when the Device is "PENDING", "OK", etc)

Code: [Select]
String   FamilyTheatreLightsDeviceStatus "Device Status [%s]" {mios="unit:house,device:13/status"}




There are a load more of these, but I need to update the doc first....