This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

what about Obix
#4
(03.03.2016, 10:00)domotiqa Wrote: no it was just a question, because I readed this:
http://www.knx.org/fileadmin/downloads/0...ebsite.pdf

And in this doc, Obix looks more open... It was just in order to have your though

Hi Domotiqa,

Here are 2 functions i use to communicate with our SmartStruxure Lite controller with oBIX. Maybe you can use it.

-- function to get data from mpm
function get_data_from_mpm(mpm_settings,object,item)
  local url = "http://" .. mpm_settings.username .. ":" .. mpm_settings.password .. "@" .. mpm_settings.ip .. "/obix/network/" .. mpm_settings.node .. "/DEV" .. mpm_settings.instance .. "/" .. object .. "/" .. item
  local b, c, h = mpm.request(url)
  local value = b:match([[val="(.-)"]])
  local value = tonumber(value)
  return value
end

-- function to post data to mpm
function post_data_to_mpm(mpm_settings,object,item,value)
  local url = "http://" .. mpm_settings.username .. ":" .. mpm_settings.password .. "@" .. mpm_settings.ip .. "/obix/network/" .. mpm_settings.node .. "/DEV" .. mpm_settings.instance .. "/" .. object .. "/" .. item .. "/"
  local reqBody = [[<intl val="]] .. value .. [["/>]]
  local headers = {["Content-Type"] = "text/xml", ["Content-Length"] = #reqBody}
  local respTable = {}
  local returnList = {client = {}, code = {}, headers = {}, status = {}}
  local source=ltn12.source.string(reqBody)
  local sink=ltn12.sink.table(respTable)
  local result = mpm.request{url=url, method="POST", source=source, sink=sink, headers=headers}
  return result
end

BR,

Erwin van der Zwart
Reply


Messages In This Thread
what about Obix - by domotiqa - 02.03.2016, 08:28
RE: what about Obix - by edgars - 03.03.2016, 08:49
RE: what about Obix - by domotiqa - 03.03.2016, 10:00
RE: what about Obix - by Erwin van der Zwart - 05.03.2016, 13:15
RE: what about Obix - by domotiqa - 05.03.2016, 14:00
RE: what about Obix - by Erwin van der Zwart - 05.03.2016, 14:47
RE: what about Obix - by edgars - 07.03.2016, 07:57
RE: what about Obix - by edgars - 08.03.2016, 12:33

Forum Jump: