. /usr/share/libubox/jshn.sh


if [ $# != 1 ] ; then
echo "USAGE: $0 meter addr"
echo " e.g.: $0 2123445"
exit 1;
fi

meter_addr=$1

file="/app/node/nodes_cfg.json"
#load json file
json_load "`/bin/cat $file`"
json_select nodes_cfg
# # array first index is 1
json_select 1
json_select ..
index=1
while json_get_type status $index && [ "$status" = "object" ];do
json_select $index
json_get_var sn_v    sn
    if (echo ${sn_v} |grep -q "METER"); then
        json_add_string term_addr $meter_addr
    fi
# echo "***index:$index***term_addr:"$out"**sn_v:$sn_v*************"
json_select ..
index=$((index+1))
done

# json_dump
json_dump>$file

