Page 1 of 1

n8n webhook in dzevents

Posted: Monday 30 June 2025 13:54
by acaonweb
Hi everyone,
i need an help with a script.

i want create a script that trigger a device. When triggered, the script has to call a n8n webhook, and get some data.
Something like that

Code: Select all

return {

	active = true, -- set to false to disable this script

	-- trigger
	on = {
		devices = {'Irrigatore'},
	        }
	},
	execute = function(dz, device, tginfo)
	-- start webhook
	-- return data from webhook
	-- end webhook
	end
	
the script have to wait until the call is ended.
the url is somethink like

Code: Select all

https://IP/webhook/irrigazione
and i need to pass some a JSON
Everything is working manually with curl

Code: Select all

curl -X GET https://IP/webhook/irrigazione  -H "Content-Type: application/json" -d '{"umidita": 59, "temperatura_esterna": 31.5, "temperatura_terriccio":31.5}'
how can do that?


Thanx in advance
Fabrizio

Re: n8n webhook in dzevents

Posted: Monday 30 June 2025 15:51
by waltervl
Make use of the dzvents asynchronous openURL function.
wiki: https://wiki.domoticz.com/DzVents:_next ... P_requests
example: viewtopic.php?p=319573#p319573