after installing 2nd last and last beta version v2025.2 (build 17053), the callback function of openURL doesn't fire every time I call it anymore.
Did anything change in this respect?
My (energy) dzvents scripts worked for 3 years up to now without any problem.
It's quite a large JSON response but when pasting the url in a web browser it works every time.
Any idea's? Or is there a better way to debug?
Part of the code is listed below, and the HTTPresponse routine is not reached consistently by the lack of the callback.
Code: Select all
return {
on = {
timer = {'every minute'},
httpResponses = { 'http_response_P1' }
},
logging = { level = domoticz.LOG_DEBUG,
marker = 'Test Callback P1',
},
execute = function(domoticz, item)
local DomoUrl = 'http://192.168.x.xx:yyyy' -- URL of domoticz not shown here.
local P1idx = 28105 -- IDX of P1 meter device
local ContractYear = 2026
local P1_data
local p1resultly = {}
local function getDomData(url, callback)
domoticz.openURL({
url = url,
-- method = 'GET',
callback = callback,
timeout = 10,
})
end
if (item.isTimer) then
local t = DomoUrl .. '/json.htm?type=command¶m=graph&sensor=counter&range=year&idx=' .. tostring(P1idx) .. '&year=' .. ContractYear
local c = 'http_response_P1'
getDomData(t,c)
elseif (item.isHTTPResponse) then
domoticz.log('Script triggered by HTTPResponse', domoticz.LOG_INFO) -- doesn't reach here consistently
if (item.trigger == 'http_response_P1' and item.ok and item.isJSON) then
P1_data = item.json["P1_Tariff"] -- just as example, in full script, more data is fetched from the JSON response
domoticz.log('P1 Tariff : ' .. P1_data, domoticz.LOG_INFO)
...
end
else
...
end
end