Page 1 of 1

Curl bash

Posted: Tuesday 13 August 2019 20:29
by Apievuisy
I have a Raspberry Pi with a motion sensor which when its tripped should visit the domoticz api to notify that it has been tripped.
I would like to visit this api via a shellscript.

This is what i came up with:

Code: Select all

#!/bin/bash

VAR1=$(curl -v "http://192.168.1.9:8084/json.htm?type=command&param=switchLight&idx=3&switchcmd=On");
echo $VAR1;

exit 0

This results is Domoticz telling me something is wrong - ERR.
When i run the curl command from the commandline (without the VAR1 parameter), everything is working fine..

Could somebody pleasy help me, i have been searching for hours and i cant find the solution.
I think it has something to do with the variables in the URL (e.g. &idx=3)

Re: Curl bash

Posted: Wednesday 14 August 2019 9:14
by waaren
Apievuisy wrote: Tuesday 13 August 2019 20:29 VAR1=$(curl -v "http://192.168.1.9:8084/json.htm?type=c ... itchcmd=On");
[/code]
switchLight is not recognized by domoticz. It should be switchlight. (case matters)

Other problem could be that the user executing the bash script is not authorized for this action

Re: Curl bash

Posted: Sunday 18 August 2019 22:13
by Apievuisy
waaren wrote: Wednesday 14 August 2019 9:14
Apievuisy wrote: Tuesday 13 August 2019 20:29 VAR1=$(curl -v "http://192.168.1.9:8084/json.htm?type=c ... itchcmd=On");
[/code]
switchLight is not recognized by domoticz. It should be switchlight. (case matters)

Other problem could be that the user executing the bash script is not authorized for this action
Thanks, this did the trick!