I try to use this script to get data out of my (ethernet module of the) SAJ Solar inverter..
Forget to add the version:
Version: 4.11487
Build Hash: ac3d2290d
Compile Date: 2019-11-14 16:41:43
dzVents Version: 2.5.0
Python Version: 3.5.3 (default, Sep 27 2018, 17:25:39) [GCC 6.3.0 20170516]
Code: Select all
commandArray = {}
lineNo = 0
now = 0
temp = 0
today = 0
total = 0
v1 = 0
v2 = 0
i1 = 0
i2 = 0
ip = '192.168.1.18'
i = 1
-- Only run during day
-- if ( uservariables["Het is Donker"] == 0 ) then
function UpdateDevice(device, data)
idx = otherdevices_idx[device]
if (idx == nil) then
print('** Unknown device '..device)
else
commandArray[i] = {['UpdateDevice'] = idx..'|0|'..data}
i = i+1
end
end
--Get the XML data from the inverter
local url = 'curl http://'..ip..'/real_time_data.xml'
local data = assert(io.popen(url))
for line in data:lines() do
if (lineNo == 0 and string.find(line,'Normal') ~= nil) then
lineNo = 1
elseif (lineNo > 0) then
if (lineNo == 4) then now = string.match(line, "%d+")
elseif (lineNo == 5) then temp = string.match(line, "%d+%.%d+")
elseif (lineNo == 6) then today = string.match(line, "%d+%.%d+")
elseif (lineNo == 8) then total = string.match(line, "%d+%.%d+")
end
lineNo = lineNo + 1
end
end
data:close()
if (lineNo >= 14) then
-- Update the Domoticz GUI
ep = v1*i1
wp = v2*i2
UpdateDevice('PV SAJ', now..";".. total*1000)
UpdateDevice('Temperatuur SAJ', temp)
end
return commandArray
I use the EventSystem, and also made a script by hand with script_time_saj.lua, but both seems to do nothing.
Someone know what is wrong?
Ps, i can only test the dummy updating (when its hopefully going to executed once) when it is daylight because the SAJ goes offline when it is dark, and so the ethernet module goes to.. thanks!