How to use curl in bash with domoticz API to control switch Topic is solved

All kinds of 'OS' scripts
Post Reply
tonywk
Posts: 5
Joined: Tuesday 13 June 2017 10:28
Target OS: -
Domoticz version:
Contact:

How to use curl in bash with domoticz API to control switch

Post by tonywk » Thursday 13 July 2017 15:13

I have setup a switch in domoticz and want to use curl in a bash file with domoticz API to control switch. bash command is this:

curl http://192.168.1.205:8080/json.htm?type=command&param=switchlight&idx=134&switchcmd=On

the domoticz API: http://192.168.1.205:8080/json.htm?type=command&param=switchlight&idx=134&switchcmd=On
has been tested successfully in web browser, but once I try just type the curl command as above in terminal, below error appears

Can you help me with it? Thanks!
新建图片2.jpg
新建图片2.jpg (41.72 KiB) Viewed 1025 times

SweetPants
Posts: 1614
Joined: Friday 12 July 2013 21:24
Target OS: Linux
Domoticz version: V3.8789
Location: The Netherlands
Contact:

Re: How to use curl in bash with domoticz API to control switch

Post by SweetPants » Thursday 13 July 2017 16:13

Have you put the command between single quotes already?
Ubuntu 16.04.3 LTS on Intel NUC, MySensors, Pro Mini 3.3 with RFM69, ESP8266 (SDK2.1.0), Sonoff, RFLink, RFXcom.

tonywk
Posts: 5
Joined: Tuesday 13 June 2017 10:28
Target OS: -
Domoticz version:
Contact:

Re: How to use curl in bash with domoticz API to control switch

Post by tonywk » Thursday 13 July 2017 17:39

No I didn't. That is it! A tiny thing took me hours yet to figure out, Thanks!

SweetPants
Posts: 1614
Joined: Friday 12 July 2013 21:24
Target OS: Linux
Domoticz version: V3.8789
Location: The Netherlands
Contact:

Re: How to use curl in bash with domoticz API to control switch

Post by SweetPants » Friday 14 July 2017 15:25

tonywk wrote:No I didn't. That is it! A tiny thing took me hours yet to figure out, Thanks!
Can you mark this solved?
Ubuntu 16.04.3 LTS on Intel NUC, MySensors, Pro Mini 3.3 with RFM69, ESP8266 (SDK2.1.0), Sonoff, RFLink, RFXcom.

tonywk
Posts: 5
Joined: Tuesday 13 June 2017 10:28
Target OS: -
Domoticz version:
Contact:

Re: How to use curl in bash with domoticz API to control switch

Post by tonywk » Monday 17 July 2017 6:59

yes, it is working now.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest