Curl bash Topic is solved

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
Apievuisy
Posts: 11
Joined: Tuesday 13 August 2019 20:22
Target OS: -
Domoticz version:
Contact:

Curl bash

Post 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)
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Curl bash

Post 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
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Apievuisy
Posts: 11
Joined: Tuesday 13 August 2019 20:22
Target OS: -
Domoticz version:
Contact:

Re: Curl bash

Post 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!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest