我下面有脚本
echo Getting Data from MyTotalControl Website
/etc/openhab2/scripts/therm.py -s > /var/log/honeywell.log
TEMPDATA="/var/log/honeywell.log"
#
#
echo Checking Indoor Temp
TEMPSTATUS=$( grep "Indoor Temperature" "$TEMPDATA" | sed -n -e 's/^.*Indoor Temperature: //p')
curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "$TEMPSTATUS" "http://xxx.xxx.xxx.xxx:xxxxx/rest/items/IndTemp" "\n"
echo "$TEMPSTATUS"
#
#
exit 0
我得到了错误:
Getting Data from MyTotalControl Website
Checking Indoor Temp
curl: (3) Illegal characters found in URL
28
: numeric argument required: line 39: exit: 0
它获取室内温度,但是我有一个卷曲错误和那个数字参数。
当我在终端中使用curl命令
$ curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "33" "http://xxx.xxx.xxx.xxx:xxxxx/rest/items/IndTemp"
它按预期工作,并更新了我的商品。 我究竟做错了什么? 预先谢谢你。