The orignial line was:
Code: Select all
JSON = (loadfile '/home/pi/domoticz/scripts/lua/JSON.lua')()
Code: Select all
JSON = (loadfile '/opt/domoticz/scripts/lua/JSON.lua')()
The part of code:
Code: Select all
JSON = assert(loadfile '/opt/domoticz/scripts/lua/JSON.lua')() -- For Linux
if debug then print('JSON ~= nil?') end
if debug then print("JSON: "..tostring(JSON~=nil)) end
commandArray = {}
-- Extract data from Fronius using API v1
-- from https://www.fronius.com/en/photovoltaics/products/all-products/system-monitoring/open-interfaces/fronius-solar-api-json-
froniusURL = 'curl "http://'..IPFronius..'/solar_api/v1/GetPowerFlowRealtimeData.fcgi"'
jsonData = assert(io.popen(froniusURL))
froniusDevice = jsonData:read('*all')
jsonData:close()
froniusData = JSON:decode(froniusDevice)
if debug then print("froniusData: "..tostring(froniusData~=nil)) end
if debug then print("froniusData: "..tostring(froniusData)) end
Code: Select all
2021-06-27 16:46:22.360 Status: LUA: JSON ~= nil?
2021-06-27 16:46:22.360 Status: LUA: JSON: true
2021-06-27 16:46:22.371 Status: LUA: froniusData: false
2021-06-27 16:46:22.371 Status: LUA: froniusData: nil