Author Topic: OWL Intuition-e (Network Owl + CM180 transmitter) integration with Vera Plus  (Read 245 times)

Offline gemini1971

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
Hello,
I have a Vera Plus at home and also an OWL Intuition-e (Network Owl + CM180 transmitter). I never had them connected, but would wish to!

As i have some Z-wave power plugs with energy reading and am using data mine 2 to collect that information, i would also be interested on having the available data from the total energy read by my OWL intuition into my Vera Plus.

I failed to find a solution here for this, and as i am a newbie on this subject, I'm trying to get help from the experts.

I Know that Network OWL Multicasts information to the network (as seen in https://theowl.zendesk.com/hc/en-gb/articles/201284603-Multicast-UDP-API-Information   

Is there anyone that can help me with some plugin or luua code that can be used to integrate OWL Intuition on my Vera Plus UI7 ?

Thanks in advance.


Offline NikV

  • Full Member
  • ***
  • Posts: 133
  • Karma: +2/-1
I do this, but I am running openLuup on a RPI 3 so not sure if what I have will be much help, I have this could running a as a service on the RPI

Code: [Select]
#!/usr/bin/lua5.1
newsol = 0
usage = 0
newuse =0
local socket = require"socket"
local http=require'socket.http'
local group = "224.192.32.19"
local port = 22600
local devusagetemplate = "http://ipofopenLuupRPI/data_request?id=variableset&DeviceNum=45&serviceId=urn:micasaverde-com:serviceId:EnergyMetering1&Variable=%s&Value=%s"

--urn:micasaverde-com:serviceId:EnergyMetering1
local c = assert(socket.udp())


print(assert(c:setoption("reuseport", true)))
print(assert(c:setsockname("*", port)))

function valfromchan(src,ch)
search=string.format("<chan id='%d'>",ch)
startpos = string.find(src,search)+29
search=string.sub(dgram,startpos,startpos+12)
endpos=string.find(search,'<')
search= string.sub(search,1,endpos-1)
-- print(tonumber(search))
return (search)
end



print(assert(c:setoption("ip-add-membership", {multiaddr = group, interface = "*"})))


while 1 do
    dgram = c:receivefrom()
fline=os.date()..'--> '..(string.sub(dgram,1,30))
if string.sub(dgram,2,9) == "electric" then
-- extract using units
newuse = valfromchan(dgram,'0')
url=string.format(devusagetemplate,'Usage',newuse)
retcode = http.request(url)
if retcode == nil then retcode = 'NotOk' end
fline=fline..' > Usage '.. tostring(newuse)..'  '..retcode
else
-- extract generating units
if string.sub(dgram,2,6) == "solar" then
startpos=string.find(dgram,'generating units=')+21
generate=string.sub(dgram,startpos,startpos+20)
endpos=string.find(generate,'<')-1
newsol=string.sub(generate,1,endpos)
url=string.format(devusagetemplate,'Solar',newsol)
retcode = http.request(url)
if retcode == nil then retcode = 'NotOk' end
fline=fline..' > Solar '..tostring(newsol)..'  '..retcode
-- extract exporting units
startpos=string.find(dgram,'exporting units=')+20
export=string.sub(dgram,startpos,startpos+20)
endpos=string.find(export,'<')-1
newexp=string.sub(export,1,endpos)
url=string.format(devusagetemplate,'Export',newexp)
retcode = http.request(url)
if retcode == nil then retcode = 'NotOk' end
fline=fline..' > Export '..tostring(newexp)..'  '..retcode
--calculate import
newsol=tonumber(newsol)
newuse=tonumber(newuse)
import = newuse - newsol

if import<0 then import=0 end
url=string.format(devusagetemplate,'Import',import)
retcode = http.request(url)
if retcode == nil then retcode = 'NotOk' end
fline=fline..' > Import '..tostring(import)..'  '..retcode
end
end
print(fline)
end

It catches the multicast, parses and inserts the data into a dummy device (based on energy calculator) with 4 created variables which are stored in datayours and displayed using Grafana

 

Offline gemini1971

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
Dear  NikV,

Thanks for showing this approach ...i will look into it although i was hoping for something easier (beeing a newbie without programming skills), will have to burn some eyebrows to find out how to use it.

Thanks anyway for your help pointing out the right direction.


Offline b_weijenberg

  • Full Member
  • ***
  • Posts: 115
  • Karma: +1/-1