Page 1 of 1

IFTTT and Webhooks

Posted: Monday 01 July 2024 13:34
by mikedavies1953
I am trying to use IFTTT to send a webhook request to set user variables (forecast high and low temperatures) within Domoticz and thus trigger an event. The request format is:

http://IFTTT:password@serverURL:port/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 or even just a browser, it sets the variable without a problem!

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

Any suggestions would be most welcome! Thanks

Re: IFTTT and Webhooks

Posted: Thursday 04 July 2024 0:16
by waltervl
When you use a browser to test the url are you also using the IFFFT user?

If you login into Domoticz using the IFFFT user can you modify the user variable from the Domoticz webinterface? I suppose you cannot as it is not assigned to the user and cannot be assigned to the user.

Re: IFTTT and Webhooks

Posted: Thursday 04 July 2024 8:59
by gizmocuz
Only administrators are able to add/update/delete uservariables
Not sure what 'forecast high' means, but if you are trying to update a Temp+Barometer, you could also add this as a dummy in domoticz and update the device (json udevice call), this is allowed as User

Re: IFTTT and Webhooks

Posted: Thursday 04 July 2024 22:47
by mikedavies1953
Thank you for your responses.

@gizmocuz. That would explain why the User Variable isn’t changed, as “IFTTT” is a User rather than an Administrator. However, it doesn’t explain how the same URL can change the variable when run from a browser on a different machine. The URL calls the Domoticz server, which runs on a Windows machine, using a port on the server’s external IP and the user “IFTTT”.

The IFTTT applet is <<IF forecast high temperature in [location] > 22 THEN send a web request using the URL webhook to set the User Variable at the forecast figure>>. That variable in turn triggers a Domoticz event, ie, heating on/off.

I hope that explains the situation better.

@waltervl. Thank you also - I hope this also answers your question.

Re: IFTTT and Webhooks

Posted: Thursday 04 July 2024 22:56
by waltervl
As gizmocuz already mentioned you perhaps better use a switch to trigger the dzvents script instead of a User variable.

When you test with the url in a browser did you check that user IFTTT is logged in? Probably the admin user logs in instead of the IFTTT user because of a cookie.