HTTPResponse callback issues  [Solved]

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
Gingerpale
Posts: 40
Joined: Wednesday 13 January 2016 16:11
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Contact:

HTTPResponse callback issues

Post by Gingerpale »

Hi,
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&param=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
Rpi4B,RFX433e,PiFace2, LCD, Hue bridge, Alexa (+TTS), HA-Bridge, Sonoff NSPanel, Sonoff RF (+IR) bridge, Nefit CV, Tasmota/MQTT, Enphase Solar, Smartmeter, Alarm I/F, H13726B Weather Station, CM180 Energy meter, Sonoff, KaKu, Tuya, Gledopto, AriLux,...
User avatar
gizmocuz
Posts: 2706
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: HTTPResponse callback issues

Post by gizmocuz »

Sorry about this.

I moved two variables (I thought) in the right scope

void CEventSystem::EventQueueThread()

Seems the vector is used differently perhaps.

Version 17056 should solve the issue, could you check this?
Quality outlives Quantity!
Gingerpale
Posts: 40
Joined: Wednesday 13 January 2016 16:11
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Contact:

Re: HTTPResponse callback issues

Post by Gingerpale »

No worries,
better that I ask before I spend few days (more) on trying to debug the issue.
As soon as 17056 is pushed I will test it again.
Many thanks!
Rpi4B,RFX433e,PiFace2, LCD, Hue bridge, Alexa (+TTS), HA-Bridge, Sonoff NSPanel, Sonoff RF (+IR) bridge, Nefit CV, Tasmota/MQTT, Enphase Solar, Smartmeter, Alarm I/F, H13726B Weather Station, CM180 Energy meter, Sonoff, KaKu, Tuya, Gledopto, AriLux,...
Gingerpale
Posts: 40
Joined: Wednesday 13 January 2016 16:11
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Contact:

Re: HTTPResponse callback issues  [Solved]

Post by Gingerpale »

I can confirm that with Version 17056 everything works as expected again.
Many thanks for all the hard work!
Rpi4B,RFX433e,PiFace2, LCD, Hue bridge, Alexa (+TTS), HA-Bridge, Sonoff NSPanel, Sonoff RF (+IR) bridge, Nefit CV, Tasmota/MQTT, Enphase Solar, Smartmeter, Alarm I/F, H13726B Weather Station, CM180 Energy meter, Sonoff, KaKu, Tuya, Gledopto, AriLux,...
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest