Page 1 of 1

bug with openURL after updating Domoticz?

Posted: Tuesday 29 July 2025 8:15
by Filnet
Hello,
During several years, my dzVents work fine but since 20/07/2025, it doesn't work.

Here is my actual code:

Code: Select all

key = 'xxxxxxxxx'
dz.openURL({
    url = URL,
    method = 'GET',
    headers = {
        ['accept'] =  '*/*',
        ['apikey'] = key,
        },
    callback = nom_callback,
    })
Response is not a json.

When i use Terminal with the same parameters:

Code: Select all

curl -X GET 'https://public-api.meteofrance.fr/public/DPVigilance/v1/cartevigilance/encours' -H 'accept: */*' -H 'apikey: xxxxxxxx'
I have a json.

Re: bug with openURL after updating Domoticz?

Posted: Tuesday 29 July 2025 9:03
by waltervl
In the response header you see "application/json"?
If not, you have to convert it into json yourself with for example

Code: Select all

local json = domoticz.utils.fromJSON(item.data)

Re: bug with openURL after updating Domoticz?

Posted: Tuesday 29 July 2025 9:14
by Filnet
Hello Waltervi,
I already test it.

In domoticz:
The response with OpenURL is:

Code: Select all

<html><head><title>Request Rejected</title></head><body>The requested URL was rejected. Please consult with your administrator.
Your support ID is: 16363103684453842932 
In terminal:

Code: Select all

$ curl -X GET 'https://public-api.meteofrance.fr/public/DPVigilance/v1/cartevigilance/encours' -H 'accept: */*' -H 'apikey: xxxx'

{"product": {"warning_type": "vigilance", "type_cdp": "cdp_carte_externe", "version_vigilance": "V6", "version_cdp": "1.0.0", "update_time": "2025-07-29T04:00:18Z", "domain_id": "FRA", "global_max_color_id": "2", "periods": [{"echeance": "J", "begin_validity_time": "2025-07-29T04:00:00Z", "end_validity_time": "2025-07-29T22:00:00Z", "text_items": {"title": "", "text": []}, "timelaps": {"domain_ids": [{"domain_id": "10", "max_color_id": 1, "phenomenon_items": [{"phenomenon_id": "1",
.... and so on.


My code was efficient before 20/7/2025. I dont change anything.
Parameters are exactly the same in the two process Terminal and dzvents.

Re: bug with openURL after updating Domoticz?

Posted: Tuesday 29 July 2025 11:02
by waltervl
From what version did you update? And to what version did you update to (latest beta or a stable version)? Did you also update the OS?
Are you running Domoticz in a docker container?

It seems the openurl is supplying not the correct data to the site. What is the log saying about the openURL action? Perhaps you can switch on dzvents debugging and see if you can find differences: https://wiki.domoticz.com/DzVents:_next ... leshooting

Re: bug with openURL after updating Domoticz?

Posted: Tuesday 29 July 2025 11:34
by FlyingDomotic
This maybe comes from a different message sent by Domoticz and curl.

Should you have Wireshark (or some other network capture tool), it may be pertinent to capture both requests and post them here.

Re: bug with openURL after updating Domoticz?

Posted: Tuesday 29 July 2025 13:50
by Filnet
domoticz beta updated (always on beta since 8 years)
No docker container for domoticz
NB: I use openURL (GET but without headers) in another events and they go fine.

In Debug, the format of the headers seems amazing to me... but I am not a specialist...

Debug:

Code: Select all

2025-07-29 13:30:05.232  dzVents: Debug: - OpenURL = {["method"]="GET", ["_trigger"]="vigilance_MF", ["URL"]="https://public-api.meteofrance.fr/public/DPVigilance/v1/cartevigilance/encours", ["headers"]="!#accept: */*!#apikey: eyJ4NXQiOiJZV0kxTTJZNExxxxxxxxxxxxxxPV014TXpjek1UVmhNbU14T1RSa09ETXlOVEE0Tnc9PSIsImtpZCI6ImdhdGV3YXlfY2VydGlmaWNhdGVfYWxpYXMiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJwaGlsaXBwZS5iZWxsaWFyZEBjYXJib24uc3VwZXIiLCJhcHBsaWNhdGlvbiI6eyJvd25lciI6InBoaWxpcHBlLmJlbGxpYXJkIiwidGllclF1b3RhVHlwZSI6bnVsbCwidGllciI6IlVubGltaXRlZCIsIm5hbWUiOiJEb21vdGljeiIsImlkIjoyMjc0LCJ1dWlkIjoiOWQ4YTdkZTUtOTdmZS00YjEzLTkzZWMtNWQ5ODk3MzQ1MTYzIn0sImlzcyI6Imh0dHBzOlwvXC9wb3J0YWlsLWFwaS5tZXRlb2ZyYW5jZS5mcjo0NDNcL29hdXRoMlwvdG9rZW4iLCJ0aWVySW5mbyI6eyI2MFJlcVBhck1pbiI6eyJ0aWVyUXVvdGFUeXBlIjoicmVxdWVzdENvdW50IiwiZ3JhcGhRTE1heENvbXBsZXhpdHkiOjAsImdyYXBoUUxNYXhEZXB0aCI6MCwic3RvcE9uUXVvdGFSZWFjaCI6dHJ1ZSwic3Bpa2VBcnJlc3RMaW1pdCI6MCwic3Bpa2VBcnJlc3RVbml0Ijoic2VjIn19LCJrZXl0eXBlIjoiUFJPRFVDVElPTiIsInN1YnNjcmliZWRBUElzIjpbeyJzdWJzY3JpYmVyVGVuYW50RG9tYWluIjoiY2FyYm9uLnN1cGVyIiwibmFtZSI6IkRvbm5lZXNQdWJsaXF1ZXNWaWdpbGFuY2UiLCJjb250ZXh0IjoiXC9wdWJsaWNcL0RQVmlnaWxhbmNlXC92MSIsInB1Ymxpc2hlciI6ImFkbWluIiwidmVyc2lvbiI6InYxIiwic3Vic2NyaXB0aW9uVGllciI6IjYwUmVxUGFyTWluIn1dLCJleHAiOjE3ODUzMDAwMjksInRva2VuX3R5cGUiOiJhcGlLZXkiLCJpYXQiOjE3NTM3NjQwMjksImp0aSI6ImU4NGM1N2RmLTU0NDMtNDI2Ni1iZDNiLTFjZmFiNGVkNWJhZSJ9.qAoNqndQV7NWJlnyRwh08_e25NjL1IkciaHWxmc_aJXTT_5lzmw1N1gK7ZNw0IaEK2gg468jZUiI3W0Zl9LHeSaMK7BSAQI4b0PtX13rKqv2yY6aZHHbwm-SjknSMNCj9l0WfvmgSWr9F0aMlIcA-Tvl-sSTykAh4yig34JGR54xz6wKLf7FBaCmZWs-hmyBX89xyVccVQsrWs64CO2Bip4_C_oYEkhyURkUPQsq7xuXQ7ae9Z-HeMUn_CUzoQPD8W4eT2gSerPVzyhTSjHk2Z0APIrZWZ1rBIAl9VvWTDPgaqV6Hm_7W74Q4BsoeT7qnc7-33xG5VkLBXCvX_yLrg=="}
2025-07-29 13:30:05.232  dzVents: Debug: =====================================================

Re: bug with openURL after updating Domoticz?

Posted: Tuesday 29 July 2025 14:51
by waltervl
The latest beta was released 7-july-2025 so nothing happened after 20 July. So perhaps some other change on your system impacted this?
Also recent updates on github seems to have no relation to dzvents , only MQTT AD changes.
https://github.com/domoticz/domoticz/co ... velopment/

And indeed some strange characters on the header ( ["headers"]="!#accept: */*!#apikey: ). Perhaps retype the header section in dzvents, make sure no hidden characters are there?

Re: bug with openURL after updating Domoticz?

Posted: Tuesday 29 July 2025 17:41
by waltervl
The logging seems to always show the header entry starting with !#
eg

Code: Select all

headers = { ['x-access-token'] = 'kjdhcvnlkasjhkhaks' },
results in

Code: Select all

Debug: urltest: OpenURL: headers = !#x-access-token: kjdhcvnlkasjhkhaks
Now it is the question what is really sent...

Re: bug with openURL after updating Domoticz?

Posted: Tuesday 29 July 2025 17:55
by waltervl
I have done the same test in 2025.1 stable and see exactly the same result so it does not seem to be an issue in latest beta.

Code: Select all

dzVents: Debug: urltest: OpenURL: headers = !#x-access-token: kjdhcvnlkasjhkhaks

Re: bug with openURL after updating Domoticz?

Posted: Wednesday 30 July 2025 17:46
by Filnet
I don't understand why Script #3 (LUA) is OK and not in Script #4 (dzvents).

Script #3

Code: Select all

commandArray = {}
    local getHTTP = function(cmd)
        local config=assert(io.popen('curl -m 8 '..cmd))
        local location = config:read('*all')
        config:close()
        return location
    end
    
    apikey = 'xxxxxxxxxxxxx'
    cmd = 'https://public-api.meteofrance.fr/public/DPVigilance/v1/cartevigilance/encours -H \'accept: */*\' -H \'apikey: '..apikey..'\''
    print('Script #3')
    print (getHTTP(cmd))
return commandArray
Script #4

Code: Select all

return {
	on = {
		timer = {'every 1 minutes'},
		httpResponses = {'triggerMF'}
	},

	execute = function(domoticz, item)
		if (item.isTimer) then
		    print('Script #4 Timer')
		    key = 'xxxxxxxxxxxx'
		    domoticz.openURL({
                url = 'https://public-api.meteofrance.fr/public/DPVigilance/v1/cartevigilance/encours',
                method = 'GET',
                headers = { ['accept'] = '*/*', ['apikey'] = key },
                callback = 'triggerMF',
            })
		end

		if ((item.isHTTPResponse) and (item.trigger == 'triggerMF')) then
		    print('Script #4 HTTP')
			if (item.ok) then
				if (item.isJSON) then
                    print('JSON reçu')
                    print(item.json.product.update_time)
                else
                    print(string.sub(item.data, 1, 100))
				end
			else
				domoticz.log('There was a problem handling the request', domoticz.LOG_ERROR)
				domoticz.log(item, domoticz.LOG_ERROR)
			end
		end
	end
}

Re: bug with openURL after updating Domoticz?

Posted: Wednesday 30 July 2025 23:29
by waltervl
When I run your dzvents script #4 ( a little bit modified to see debug) it just works for me.
see attached log in spoiler
my test system:
Version: 2025.1 (build 16739)
Build Hash: c35b41d2d
Compile Date: 2025-07-07 13:32:28
dzVents Version: 3.1.8
Spoiler: show
2025-07-30 23:32:00.573 dzVents: urltest: ------ Start internal script: urltest: HTTPResponse: "triggerMF"
2025-07-30 23:32:00.659 dzVents: Script #4 HTTP
2025-07-30 23:32:00.659 dzVents: JSON reçu
2025-07-30 23:32:00.659 dzVents: Debug: urltest: {"product": {"warning_type": "vigilance", "type_cdp": "cdp_carte_externe", "version_vigilance": "V6", "version_cdp": "1.0.0", "update_time": "2025-07-30T14:00:15Z", "domain_id": "FRA", "global_max_color_id": "2", "periods": [{"echeance": "J", "begin_validity_time": "2025-07-30T14:00:00Z", "end_validity_time": "2025-07-30T22:00:00Z", "text_items": {"title": "Commentaire carte", "text": ["Orages encore actifs en Corse jusqu'en fin d'apr\u00e8s-midi."]}, "timelaps": {"domain_ids": [{"domain_id": "10", "max_color_id": 1, "phenomenon_items": [{"phenomenon_id": "1", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "2", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "3", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "6", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "5", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "4", "phenomenon_max_color_id": 1, "timelaps_items": []}]}, {"domain_id": "11", "max_color_id": 1, "phenomenon_items": [{"phenomenon_id": "1", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "2", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "3", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "6", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "5", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "4", "phenomenon_max_color_id": 1, "timelaps_items": []}]}, {"domain_id": "12", "max_color_id": 1, "phenomenon_items": [{"phenomenon_id": "1", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "2", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "3", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "6", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "5", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "4", "phenomenon_max_color_id": 1, "timelaps_items": []}]}, {"domain_id": "13", "max_color_id": 1, "phenomenon_items": [{"phenomenon_id": "1", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "2", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "3", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "6", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "5", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "4", "phenomenon_max_color_id": 1, "timelaps_items": []}]}, {"domain_id": "14", "max_color_id": 1, "phenomenon_items": [{"phenomenon_id": "1", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "2", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "3", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "6", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "5", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "4", "phenomenon_max_color_id": 1, "timelaps_items": []}]}, {"domain_id": "15", "max_color_id": 1, "phenomenon_items": [{"phenomenon_id": "1", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "2", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "3", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "6", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T14:00:00Z", "end_time": "2025-07-30T22:00:00Z", "color_id": 1}]}, {"phenomenon_id": "5", "phenomenon_max_color_id": 1, "timelaps_items": [{"begin_time": "2025-07-30T
2025-07-30 23:32:00.659 dzVents: urltest: ------ Finished urltest
This is the script I used

Code: Select all

return {
	on = {
		timer = {'every 1 minutes'},
		httpResponses = {'triggerMF'}
	},
	logging = {
		level = domoticz.LOG_DEBUG,
		marker = 'urltest',
	    },

	execute = function(domoticz, item)
		if (item.isTimer) then
		    print('Script #4 Timer')
		    key = 'xxxxxxxxxxxxxx'
		    domoticz.openURL({
                url = 'https://public-api.meteofrance.fr/public/DPVigilance/v1/cartevigilance/encours',
                method = 'GET',
                headers = { ['accept'] = '*/*', ['apikey'] = key },
                callback = 'triggerMF',
            })
		end

		if ((item.isHTTPResponse) and (item.trigger == 'triggerMF')) then
		    print('Script #4 HTTP')
			if (item.ok) then
				if (item.isJSON) then
                    print('JSON reçu')
                    domoticz.log(item.data, domoticz.LOG_DEBUG)
                else
                    print(string.sub(item.data, 1, 100))
				end
			else
				domoticz.log('There was a problem handling the request', domoticz.LOG_ERROR)
				domoticz.log(item, domoticz.LOG_ERROR)
			end
		end
	end
}

Re: bug with openURL after updating Domoticz?

Posted: Friday 01 August 2025 23:36
by waltervl
@Filnet
Found your issue with your dzvents script already?
I have modified the token so it can not be misused anymore

Re: bug with openURL after updating Domoticz?

Posted: Saturday 02 August 2025 7:36
by Filnet
I had created a token available during 72h.

No, my research is a failure.
Something is amazing: I leave the scripts #3 and #4 executing every minute during 48h.
On each call, URL response is effective.

Script #3 (LUA) : Always received a json, every minute.

Script #4 (dzvents): Sometime, 4 json in an hour, randomly. No json otherwise. During 24h, I received 12 jsons... When I didn't received the json, the message from URL is 'Bad credentials'.

Re: bug with openURL after updating Domoticz?

Posted: Saturday 02 August 2025 14:08
by waltervl
Perhaps there is a limit on requests to the host?

Re: bug with openURL after updating Domoticz?

Posted: Saturday 02 August 2025 15:40
by Filnet
I don’t think so because the LUA script work fine in the same Time.