Page 1 of 1

cURL inputs

Posted: Thursday 02 February 2017 2:25
by liderbug
When, from a external script (php/bash/etc) doing a:
curl ... 'http://sg53:8080/json.htm?type=command& ... tchcmd=Off'
allow idx to be replaced with name or hw or id.unit.

Would allow for the command to read param=switchlight&Name=Porch&....

tks

Re: cURL inputs

Posted: Thursday 02 February 2017 12:04
by SweetPants

Re: cURL inputs

Posted: Thursday 02 February 2017 13:25
by lost
liderbug wrote: allow idx to be replaced with name
Usually, only IDX are allowed...
http://www.domoticz.com/forum/viewtopic ... 93#p117793

Re: cURL inputs

Posted: Thursday 02 February 2017 21:12
by liderbug
OK, thanks for the response. From your responses I've worked out a soultion:

/domoticz $ MyOnOff Patio On

Code: Select all

[MyOnOff]
#!/bin/bash 

id=`echo "select id from DeviceStatus where name = '$1';" | sqlite3 domoticz.db `
/usr/bin/curl "http://sg53:8080/json.htm?type=command&param=switchlight&idx=$id&switchcmd=$2"


Re: cURL inputs

Posted: Thursday 02 February 2017 22:02
by safi78
Nice! I like this :)

Thanks for sharing!