Corretto problema parsing json su driver sonoff_tasmota_http
This commit is contained in:
@@ -40,10 +40,11 @@ function drv_sonoff_tasmota_http_command {
|
|||||||
echo "curl code response: $res" >> "$LOG_OUTPUT_DRV_FILE"
|
echo "curl code response: $res" >> "$LOG_OUTPUT_DRV_FILE"
|
||||||
|
|
||||||
if [ "$res" != "0" ]; then
|
if [ "$res" != "0" ]; then
|
||||||
#echo "The curl command failed with: $res - url: $url"
|
echo "The curl command failed with: $res - url: $url"
|
||||||
local FOO="bar"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#echo "{\"POWER1\":\"ON\"}"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -60,8 +60,9 @@ function drv_sonoff_tasmota_http_rele_close {
|
|||||||
local response=$(drv_sonoff_tasmota_http_command "$remote" "$command")
|
local response=$(drv_sonoff_tasmota_http_command "$remote" "$command")
|
||||||
|
|
||||||
echo "response=$response"
|
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"
|
echo "result=$result"
|
||||||
if [[ "$result" != "\"ON\"" ]]; then
|
if [[ "$result" != "\"ON\"" ]]; then
|
||||||
local error="Command error: $response"
|
local error="Command error: $response"
|
||||||
|
|||||||
Reference in New Issue
Block a user