Corretto problema parsing json su driver sonoff_tasmota_http

This commit is contained in:
lejubila
2018-05-22 12:53:57 +02:00
parent 87edbbbe7a
commit 6f80b8ea21
2 changed files with 5 additions and 3 deletions

View File

@@ -40,10 +40,11 @@ function drv_sonoff_tasmota_http_command {
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"
echo "The curl command failed with: $res - url: $url"
fi
#echo "{\"POWER1\":\"ON\"}"
}

View File

@@ -60,8 +60,9 @@ function drv_sonoff_tasmota_http_rele_close {
local response=$(drv_sonoff_tasmota_http_command "$remote" "$command")
echo "response=$response"
local jskey=${remote_alias^^}
local result=$(echo $response|$JQ -M ".$remote_alias")
local result=$(echo $response|$JQ -M ".$jskey")
echo "result=$result"
if [[ "$result" != "\"ON\"" ]]; then
local error="Command error: $response"