We have moved at community.getvera.com

Author Topic: OpenHAB controlled by Vera?  (Read 3700 times)

Offline jswim788

  • Hero Member
  • *****
  • Posts: 809
  • Karma: +58/-2
Re: OpenHAB controlled by Vera?
« Reply #15 on: February 27, 2018, 12:23:22 am »
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.

Offline Drex

  • Sr. Newbie
  • *
  • Posts: 41
  • Karma: +0/-0
Re: OpenHAB controlled by Vera?
« Reply #16 on: March 02, 2018, 10:49:41 am »
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

Offline Drex

  • Sr. Newbie
  • *
  • Posts: 41
  • Karma: +0/-0
Re: OpenHAB controlled by Vera?
« Reply #17 on: March 02, 2018, 11:39:24 am »
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

Offline jswim788

  • Hero Member
  • *****
  • Posts: 809
  • Karma: +58/-2
Re: OpenHAB controlled by Vera?
« Reply #18 on: March 04, 2018, 12:20:30 am »
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: [Select]
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

A more general version of the above in case you want to control something else in OH from Vera:
Code: [Select]
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