Is it possible to start a Domoticz script by sending a HTTP request?  [Solved]

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

Moderator: leecollings

Post Reply
User avatar
pgielen
Posts: 91
Joined: Monday 18 February 2019 14:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Boxmeer
Contact:

Is it possible to start a Domoticz script by sending a HTTP request?

Post by pgielen »

I's like to send a HTTP request from IFTTT to start a dzvents script in Domoticz. Is this possible? How? :?:
https://robothuis.nl, RPi4B, RFXCOM XL, Aeotec Z-Stick, ESP Easy, Weatherstation, several switches and sensors, Ikea Trädfri, Philips Hue, Foscam, Reolink, Lyric T6, Ring
User avatar
felix63
Posts: 244
Joined: Monday 07 December 2015 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Gouda
Contact:

Re: Is it possible to start a Domoticz script by sending a HTTP request?  [Solved]

Post by felix63 »

I would create a dummy switch in Domoticz. Then in IFTTT create an action using ‘Webhooks’ to flip the switch and use that as a trigger to start your script.

In webhooks you can use this (after replacing the appropriate parts with real values):

Code: Select all

https://USERID:PASSWORD@URL:PORT/json.htm?type=command&param=switchlight&idx=IDX&switchcmd=On
User avatar
pgielen
Posts: 91
Joined: Monday 18 February 2019 14:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Boxmeer
Contact:

Re: Is it possible to start a Domoticz script by sending a HTTP request?

Post by pgielen »

Thanks. I've got a lot of virtual devices already :-)
https://robothuis.nl, RPi4B, RFXCOM XL, Aeotec Z-Stick, ESP Easy, Weatherstation, several switches and sensors, Ikea Trädfri, Philips Hue, Foscam, Reolink, Lyric T6, Ring
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Is it possible to start a Domoticz script by sending a HTTP request?

Post by waaren »

pgielen wrote: Tuesday 02 July 2019 13:38 Thanks. I've got a lot of virtual devices already :-)
If you prefer you can also use a domoticz uservariable as trigger for your script.
JSON/API would then look like

/json.htm?type=command&param=updateuservariable&vname=USERVARIABLENAME&vtype=USERVARIABLETYPE&vvalue=USERVARIABLEVALUE

where USERVARIABLETYPE can be
a digit (0,1,2,3,4) or a string (Integer, Float, String, Date, Time) (string only when domoticz version = 4.10906 or later)
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
mikedavies1953
Posts: 6
Joined: Thursday 09 January 2020 19:24
Target OS: Windows
Domoticz version:
Contact:

Re: Is it possible to start a Domoticz script by sending a HTTP request?

Post by mikedavies1953 »

I know this question was answered some years ago but I have a related problem with which I’m hoping somebody can help.

I’m using IFTTT to send a webhook request to set a user variable (forecast high and low temperatures) within Domoticz. The URL is the updated version of the one suggested above:

http://IFTTT:xxxxxxxxxxxxxxxxxxxxxxxxxx/json.htm?type=command&param=updateuservariable&vname=Narboroughhigh&vtype=0&vvalue=18

My problem is that, although the IFTTT applet runs correctly and sends the request to Domoticz, it doesn’t set the variable but just generates an error message: “Error: User: IFTTT tried to update a uservariable!”

However, if I open the link manually from within IFTTT, it sets the variable without a problem!

The Domoticz user IFTTT successfully uses other webhooks to set the state of virtual switches and has “sharing” set to ON but cannot seem to change a user variable. Is there another permission that I have missed?

Any suggestions would be most welcome! Thanks
User avatar
waltervl
Posts: 5894
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Is it possible to start a Domoticz script by sending a HTTP request?

Post by waltervl »

mikedavies1953 wrote: Monday 01 July 2024 2:07 I know this question was answered some years ago but I have a related problem with which I’m hoping somebody can help.

I’m using IFTTT to send a webhook request to set a user variable (forecast high and low temperatures) within Domoticz. The URL is the updated version of the one suggested above:

http://IFTTT:xxxxxxxxxxxxxxxxxxxxxxxxxx/json.htm?type=command&param=updateuservariable&vname=Narboroughhigh&vtype=0&vvalue=18
Already answered here https://www.domoticz.com/forum/viewtopi ... 28&t=42471
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