running below dzVents Lua test snippet (openURL) gives error "Error parsing json to LUA table" after finishing.
The openURL works, but the HTTP result isJSON=False!
Looked up the source of ~domoticz\dzVents\runtime\Utils.lua what the cause could be = seemed function fromJSON
Implemented a workaround = adding check on string empty, no error anymore.
Any hints appreciated what the cause could be and how to resolve --- without below workaround.
Code: Select all
function self.fromJSON(json, fallback)
-- ADDED: Check if a string is empty
if _.str(json) == nil or _.str(json) == '' then
return fallback
end
...
Code: Select all
2021-03-05 18:51:23.045 Status: dzVents: Debug: CCUJACK: OpenURL: url = http://192.168.1.70:2121/device/000A18A9A64DAC/1/SET_POINT_TEMPERATURE/~pv
2021-03-05 18:51:23.045 Status: dzVents: Debug: CCUJACK: OpenURL: method = PUT
2021-03-05 18:51:23.045 Status: dzVents: Debug: CCUJACK: OpenURL: post data = {"v":7}
2021-03-05 18:51:23.045 Status: dzVents: Debug: CCUJACK: OpenURL: headers = nil
2021-03-05 18:51:23.045 Status: dzVents: Debug: CCUJACK: OpenURL: callback = CCUJACK
2021-03-05 18:51:23.045 Status: dzVents: Info: CCUJACK: ------ Finished ccu_jack
2021-03-05 18:51:23.045 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2021-03-05 18:51:25.371 Status: dzVents: Info: Handling httpResponse-events for: "CCUJACK"
2021-03-05 18:51:25.371 Status: dzVents: Info: CCUJACK: ------ Start internal script: ccu_jack: HTTPResponse: "CCUJACK"
2021-03-05 18:51:25.371 Status: dzVents: Info: CCUJACK: ------ Finished ccu_jack
2021-03-05 18:51:25.371 Error: dzVents: Error: (3.1.5) CCUJACK: Error parsing json to LUA table: (invalid json string)
Code: Select all
local IDX_SWITCH = 83
local newData = {v=7}
return {
on = { devices = { IDX_SWITCH }, httpResponses = { 'CCUJACK' }, },
logging = { level = domoticz.LOG_DEBUG, marker = "CCUJACK" },
execute = function(domoticz, item)
domoticz.utils.dumpTable(item)
if (item.isDevice) then
domoticz.openURL({
url = 'http://CCU-IP:2121/device/000A18A9A64DAC/1/SET_POINT_TEMPERATURE/~pv',
method = 'PUT',
callback = 'CCUJACK',
postData = newData
})
end
end
}
Code: Select all
2021-03-05 18:56:42.140 Status: dzVents: > isSystem: false
2021-03-05 18:56:42.141 Status: dzVents: > isXML: false
2021-03-05 18:56:42.141 Status: dzVents: > isJSON: false
2021-03-05 18:56:42.141 Status: dzVents: > isTimer: false
2021-03-05 18:56:42.141 Status: dzVents: > isDevice: false
2021-03-05 18:56:42.141 Status: dzVents: > _contentType: application/json
2021-03-05 18:56:42.141 Status: dzVents: > isHardware: false
2021-03-05 18:56:42.141 Status: dzVents: > headers:
2021-03-05 18:56:42.141 Status: dzVents: > Content-Length: 0
2021-03-05 18:56:42.141 Status: dzVents: > Content-Type: application/json
2021-03-05 18:56:42.141 Status: dzVents: > Date: Fri, 05 Mar 2021 17:56:42 GMT
2021-03-05 18:56:42.141 Status: dzVents: > data:
2021-03-05 18:56:42.141 Status: dzVents: > isScene: false
2021-03-05 18:56:42.141 Status: dzVents: > protocol: HTTP/1.1
2021-03-05 18:56:42.141 Status: dzVents: > ok: true
2021-03-05 18:56:42.141 Status: dzVents: > isCustomEvent: false
2021-03-05 18:56:42.141 Status: dzVents: > callback: CCUJACK
2021-03-05 18:56:42.141 Status: dzVents: > statusCode: 200
2021-03-05 18:56:42.141 Status: dzVents: > isGroup: false
2021-03-05 18:56:42.141 Status: dzVents: > isHTTPResponse: true
2021-03-05 18:56:42.141 Status: dzVents: > dump()
2021-03-05 18:56:42.141 Status: dzVents: > baseType: httpResponse
2021-03-05 18:56:42.141 Status: dzVents: > isSecurity: false
2021-03-05 18:56:42.141 Status: dzVents: > statusText: OK
2021-03-05 18:56:42.141 Status: dzVents: > isShellCommandResponse: false
2021-03-05 18:56:42.141 Status: dzVents: > isVariable: false
2021-03-05 18:56:42.141 Status: dzVents: > trigger: CCUJACK