Code: Select all
#! /bin/sh
temp=$(vcgencmd measure_temp | egrep -o '[0-9]*\.[0-9]*')
echo "System temperature: $temp"
url="http://192.168.1.52:8080/json.htm?type=command¶m=udevice&idx=571&nvalue=0&svalue=$temp"
echo "$curl"
curl "$url"
However, this does not work; curl answers (3) URL using bad/illegal format or missing URL, because it apparently expects double quotes arount the url (if I directly type in something like: curl "http://192.168.1.52:8080/json.htm?type= ... &svalue=77" in the cli, the value is passed on to Domoticz without problems).
Changing line 4 to:
Code: Select all
url="\"http://192.168.1.56:8088/json.htm?type=command¶m=udevice&idx=571&nvalue=0&svalue=$temp\""
I tried the same with wget in stead of curl, with the same results...
Is there another way to pass such a value from bash to Domoticz or should I switch to PHP or Python for this relatively simple task?