Eseguito correzioni su driver sonoff_tasmota_http

This commit is contained in:
lejubila
2018-05-21 22:21:27 +02:00
parent 3eb45fd1e9
commit 87edbbbe7a
3 changed files with 19 additions and 12 deletions

View File

@@ -21,21 +21,28 @@ function drv_sonoff_tasmota_http_command {
local remote_user="${!remote_user_var}"
local remote_pwd="${!remote_pwd_var}"
local url="http://$remore_ip/cm"
local url="http://$remote_ip/cm"
local credentials=""
local response=""
#$CURL -LI http://$remote_ip/ -o /dev/null -w '%{http_code}\n' -s
if [[ ! -z $remote_user ]] && [[ ! -z $remote_pwd ]]; then
credentials="user=$remote_user&password=$remote_pwd&"
fi
url="$url?$credentials$command"
$CURL -sb -H "$url"
echo "url api sonoff: $url" >> "$LOG_OUTPUT_DRV_FILE"
#$CURL -LI $url -o /dev/null -w '%{http_code}\n' -s
$CURL --connect-timeout 5 -sb -H "$url"
local res=$?
echo "curl code response: $res" >> "$LOG_OUTPUT_DRV_FILE"
if [ "$res" != "0" ]; then
#echo "The curl command failed with: $res - url: $url"
local FOO="bar"
fi
}