n8n webhook in dzevents

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

Moderator: leecollings

Post Reply
acaonweb
Posts: 87
Joined: Thursday 23 March 2017 14:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

n8n webhook in dzevents

Post 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
User avatar
waltervl
Posts: 5852
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: n8n webhook in dzevents

Post 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
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest