Hi,
i tryed a LUA, but i have a error in xml parsing.
Create a new sensor:
http://[DOMOTICZ-IP]:8080/json.htm?type=createvirtualsensor&idx=4&sensorname=Hoymiles&sensortype=248
Put in the DeviceIDx (here: 141) in the Lua code:
Code: Select all
JSON = (loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")()
commandArray = {}
jsondata = assert(io.popen('curl "http://[AHOY-DTU-IP]/api/live"'))
device = jsondata:read('*all')
jsondata:close()
data = JSON:decode(device)
if (data ~= nil) then
commandArray[1] = {['UpdateDevice'] = 141 .. "|0|" ..tonumber(data['inverter'][0]['ch'][0][2])}
else
commandArray[1] = {['UpdateDevice'] = 141 .. "|0|" .. 0 }
end
return commandArray
The script has still an error in data['inverter'][0]['ch'][0][2] ... but i cant fix it....
Gerhard
niekniek89 wrote: ↑Tuesday 21 February 2023 16:41
Hello @mgerhard74
did you manage to read the ahoydtu with domoticz yet?
I also have an ahoydtu since 2 weeks, but would like to have the logging in domoticz.
Domoticz improves my photovoltaik ownconsumption (Rpi3, wifi plugs) - PV 6,5kWp (Fronius Symo inverter) - 10kWh PV batterie - Nissan Leaf2 (40kWh) and Kia eNiro (64kWh)