OpenHAB controlled by Vera?

I was able to get OpenHAB running on my Pi3 and able to control all my GE Link Lights (which currently don’t work in Vera). I have a z-wave stick and would like to be able to migrate all my z-wave devices over to the Pi, but have everything automated using the Vera.

My reason is that I currently use PLEG and iPhone presence detector in Vera for most of my scenes and I wasn’t able to find similar bindings in OpenHAB. I’m also using Crush’s Echo bridge which works awesome.

Has anyone done this with OpenHAB, or do I just need to abandon Vera and only use OpenHAB?

I assume you are aware of the Vera OpenHab bindings , this allow you to retain you extant Vera configuration, but it is reverse to the way you describe what you want to achieve

Yes, I was aware that it is the opposite of what I am looking for. :wink:

Thanks though! If I could get Vera Plus (UI7) to recognize my GE Link lights, I would be happy to have it run my HA system. Unfortunately, it has been broken for a long time with no ETA on when it will be fixed.

Speaking for myself, it doesn’t take long to pick up making rules. Just search for examples that match what you want to do. I know just about nothing about programming and yes a rule may not work for a day or two while I figure it out but I’m certainly getting better. Habmin also has a rule generator. It puts it in a text file in your rules folder that you can either convert to a .rules file or copy and paste it into your normal rules file(s).

PLEG (which I use on Vera) really just graphically makes rules for you. There isn’t anything you can’t do in OpenHab that PLEG will do (not that I know of at least).

There are ways to do presence also. I don’t know exactly as I haven’t set it up but there are many posts on the OpenHab forums about people doing it.

I’m moving everything over to my Aeon Labs ZStick with the exception of probably my locks since the ZWave binding isn’t officially supporting secure class yet.

Thanks RHINESEL!

Is it a Binding to create rules? I’ve tried to search OpenHAB and Google for creating rules, but I can’t find a good tutorial/walkthrough. Do you have any suggestions?

Thanks in advance!

[quote=“Kmitchel, post:5, topic:193513”]Thanks RHINESEL!

Is it a Binding to create rules? I’ve tried to search OpenHAB and Google for creating rules, but I can’t find a good tutorial/walkthrough. Do you have any suggestions?

Thanks in advance![/quote]

Sorry for the late reply, I’m spending less time here now that I’m moving most of my stuff off Vera (leaving only Locks and thermostats until security class and a solid radio thermostat binding is created).

Bindings have nothing to do with rules.

How OpenHab is envisioned is that a OH system is a stand alone system. It is simply a brain. People “attach” other items to the OH system. Say for example, you want to use an LG TV. A person (remember, opensource… no manufacturer) created the LG TV binding to allow OH to connect to the television. Vera has it’s own binding. A binding is a way for OH to communicate with the device of your choice. Think of them as “plug-ins” for Vera.

As for learning rules… there is no easy process (though the basics isn’t that hard. They pretty much follow a “When… Then…” formula. It’s just the formatting of the command you need to learn. There is a sample rules page https://github.com/openhab/openhab/wiki/Samples-Rules but I found most of these are more advanced rules than basic. I found that simply visiting the forum and reading the posts in the rules sections taught me a lot.

What I did is create a “test” rules file. I started very easy. My first rule was when I turn on one outlet, a second would also turn on. Once I figured that out it was easy to expand upon that. Turn on a switch, also turn on an outlet. Make one outlet match the state of another outlet. These are all very similar. Next was adding a time component (took a few minutes to understand CRON). When XXXXXX… turn on XXXXX. This led me to using the Astro binding (a binding to calculate sun and moon positions) so I could integrate sunset/sunrise into my rules.

The tl:dr version is… start small. Do something very basic and then it’s easy to expand upon that. If you ever have questions, the people over at OH forums are great with newbies. My username there is the same as here so feel free to ask anything you need. I’m still a beginner myself, but we can figure it out together.

Last thing… if you’re relatively new to Linux and programming in general… it takes time. While I have some problems with Vera itself as a company, setting up OH has given me more respect for the people who created Vera (and other “commercial” systems). Granted, they can probably do in 10 minutes what it takes hours for me to do.

So I feel I will also give OH2 a try and start moving forward from vera.

Little bit nervous because my Linux skills and programing skills are at litle rusty.

So I understand it is possible to get vera devices visible in OH2 but not an other way round. That will lead to the situation that vera will enetually be handling zwave Network.

[quote=“markoe, post:7, topic:193513”]So I understand it is possible to get vera devices visible in OH2 but not an other way round. That will lead to the situation that vera will enetually be handling zwave Network.[/quote]openHAB has a REST API, so it is perfectly possible to control it from Vera. I do exactly that. But there is no Vera plugin, so this is something you do by writing lua code for anything you want to control specifically. Note that the Z-wave binding in OH2 is under development and is not quite as mature as the on in Vera, but it is catching up.

OH2 works, but I’m not thrilled with it. It seems to add complexity where none is needed. Lua is a simpler language but it gets the job done fairly well. Go look at the forums and see people struggling with the ‘type’ of the item.state in the rules. And the documentation is poor - you’ll have to become a reader of the forums to get the information you need (same is true for Vera). On the other hand, OH2 has a much more active community and there is a lot of development going on, so it may have a better future.

jswim-

can you give some sample code/commands that you control in OH2 with vera? Just to get an idea of the syntax. Thanks

Sample below. Change the IP and port as needed.

[code]
function setOpenHabItem(item, value)
local http = require(“socket.http”)
local ltn12 = require(“ltn12”)
local path = “http://192.168.1.205:8090/rest/items/” … item
local payload = value

luup.log("setOpenHabItem payload is " … payload)

local response_body = { }
local res, code, response_headers, status = http.request
{
url = path,
method = “POST”,
headers =
{
[“Content-Type”] = “text/plain”,
[“Content-Length”] = payload:len()
},
source = ltn12.source.string(payload),
sink = ltn12.sink.table(response_body)
}

end[/code]

awesome. thanks.

wish there was more structured documentation.

last question:

if I wanted to ‘emulate’ or replicate lets say alarm sensor status (door locks, etc), in Vera from a binding (like Omnilink on OH2), as in ‘real time’, would I assume the logic would go as follows:

in OH2, the respective Alarm switch/contact’s state (a 1 or 0) would need to trigger the corresponding virtual switch in Vera through the MIOS binding; every time a door or window is opened, let’s say, it would update the corresponding ‘device’ in Vera.

To arm/disarm the alarm, I would use your syntax above to actually arm or disarm, or change state, etc. Is that correct?

Thanks for your help-- it’s alot easier to understand with ‘live’ demo code.

-drex

You don’t necessarily need the Mios binding in openHab - here’s an example rule I use to shadow an item in a virtual switch on Vera from OH:

[code]import java.net.URLEncoder

rule “Front Door Shadow”
when
Item ZONE1_TRIPPED changed
then
if(ZONE1_TRIPPED.state == ON) sendHttpGetRequest(“http://127.0.0.1:3480/data_request?id=action&output_format=xml&DeviceNum=40&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1”)
else sendHttpGetRequest(“http://127.0.0.1:3480/data_request?id=action&output_format=xml&DeviceNum=40&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0”)
end[/code]

jswim-

i have the omnilink working, and all the alarm things are listed as things. i can’t seem to get them to become items, and thus, can’t go forward.

there is something i am missing, yet i’ve read a lot and understand that items are the virtual layers over the things (physical layer), provided by the binding.

my logs generate the following:

‘omnilink:area:4515ad84:1’
‘omnilink:zone:4515ad84:1’
‘omnilink:zone:4515ad84:2’
‘omnilink:zone:4515ad84:3’
‘omnilink:zone:4515ad84:4’
‘omnilink:zone:4515ad84:5’
‘omnilink:zone:4515ad84:6’
‘omnilink:zone:4515ad84:7’
‘omnilink:zone:4515ad84:8’
‘omnilink:zone:4515ad84:9’
‘omnilink:zone:4515ad84:10’
‘omnilink:zone:4515ad84:11’
‘omnilink:zone:4515ad84:12’
‘omnilink:zone:4515ad84:13’
‘omnilink:zone:4515ad84:14’
‘omnilink:zone:4515ad84:15’
‘omnilink:zone:4515ad84:16’
‘omnilink:button:4515ad84:1’

1-16 is the actual zone, and button is the ‘arm’,‘disarm’ interface. i can’t seem to make the jump from this point forward.

I am trying to activate and deactivate the alarm thru vera, and have vera monitor the individual zones back .

any tips would be appreciated.

thanks!

ok nevermind. got it working.

so silly. why can’t someone just say, in paper ui, or any of them, click on the thing directly not the pencil next to it, and add the channels you need it to support, then it goes active.

Thanks for all the help. I think I can get this to work!!

-d

[quote=“jswim788, post:12, topic:193513”]You don’t necessarily need the Mios binding in openHab - here’s an example rule I use to shadow an item in a virtual switch on Vera from OH:

[code]import java.net.URLEncoder

rule “Front Door Shadow”
when
Item ZONE1_TRIPPED changed
then
if(ZONE1_TRIPPED.state == ON) sendHttpGetRequest(“http://127.0.0.1:3480/data_request?id=action&output_format=xml&DeviceNum=40&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1”)
else sendHttpGetRequest(“http://127.0.0.1:3480/data_request?id=action&output_format=xml&DeviceNum=40&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0”)
end[/code][/quote]

Well, I can see the logs and see the contact change states and conditions, OPEN/CLOSED and 1/0, but I can’t seem to get this to work.

Here is the entire rules file for my one virtual test contact.

Each URL works fine.

I can’t seem to get it to fire correctly in OH2

Any thoughts/advice?

I’m getting the hang of OH2 but its poorly documented. Thanks for any help!

[code]import java.net.URLEncoder
import java.net.URI

rule “Den Door Contact Shadow”

when
Item Zones_Den_Door_Current changed
then
if(Zones_EntryExit_Door_Current.state == OPEN)
sendHttpGetRequest(“http://172.16.1.136:3480/data_request?id=lu_action&output_format=json&DeviceNum=165&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1”)
else
sendHttpGetRequest(“http://172.16.1.136:3480/data_request?id=lu_action&output_format=json&DeviceNum=165&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0”)
end

[/code]

I am not using the latest version of openHab so there may be a difference. What you need to do is to try to figure out from the openHab logs if it is in fact even trying to send anything. Look in your events.log and openhab.log at the moment you try to use this. Anything there? Once you convince yourself that it is indeed trying to send it, then see if anything is showing up in the logs on the Vera (or openLuup) side in the logs. I had some mistakes initially and had to debug a bit. I think I was using openLuup for that debug. The openHab forum is quite good - you’ll likely get some responses there quickly if you can post some information if it looks like the issue is on the openHab side. Perhaps the rule syntax has been updated in a later openHab version.

yes it did.

i have it working.

i will post a full how to shortly. i just need to arm and disarm thru vera; all contact ‘shadowing’ working.

thanks for all your help!!!

incidentally, OH2 now supports pentair directly (if you have the pentair module and not autelis); that’s my next project – to control pentair thru vera via OH2!

-d

-d

Jswim-

could you share the command syntax to activate and deactivate the alarm?? both OH1 and vera?

also, do you use the different modes (day, night, away, etc) with your alarm?

thanks

-drex

From the Vera side, I use this code to arm/disarm. You will need to customize for your particular need. The path needs to be modified appropriately. I don’t do anything special on the OH side since the binding is being used. I can arm/disarm directly from the UI (but I never do that - I either use Vera to control it based on locks or I use the alarm panel directly).

[code]function setAlarmMode(mode)
local http = require(“socket.http”)
local ltn12 = require(“ltn12”)
local path = “http://192.168.1.205:8090/rest/items/PARTITION1_ARM_MODE
local payload = “0” – default is to turn off the alarm

payload = mode

luup.log("setAlarmMode payload is " … payload)

local response_body = { }
local res, code, response_headers, status = http.request
{
url = path,
method = “POST”,
headers =
{
[“Content-Type”] = “text/plain”,
[“Content-Length”] = payload:len()
},
source = ltn12.source.string(payload),
sink = ltn12.sink.table(response_body)
}

end
[/code]

A more general version of the above in case you want to control something else in OH from Vera:

[code]function setOpenHabItem(item, value)
local http = require(“socket.http”)
local ltn12 = require(“ltn12”)
local path = “http://192.168.1.205:8090/rest/items/” … item
local payload = “0” – default is to turn off the alarm

payload = value

luup.log("setOpenHabItem payload is " … payload)

local response_body = { }
local res, code, response_headers, status = http.request
{
url = path,
method = “POST”,
headers =
{
[“Content-Type”] = “text/plain”,
[“Content-Length”] = payload:len()
},
source = ltn12.source.string(payload),
sink = ltn12.sink.table(response_body)
}

end
[/code]

Best Home Automation shopping experience. Shop at getvera!

© 2020 Vera Control Ltd., All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules