Success!!!
Now I can send from gateway to wunderground.com
Now how to do it:
1)you will need bash calculator
2)you will need to add
var fs = require('fs'); // reqire fileSystem node module
fs.writeFile("/home/pi/gateway/LOG_FILE", data );
to gateway.js, right after
var entry = {_id:id, updated:existingNode.updated, type:existingNode.type||undefined, label:existingNode.label||undefined, descr:existingNode.descr||undefined, hidden:existingNode.hidden||undefined, rssi:existingNode.rssi, metrics:Object.keys(existingNode.metrics).length > 0 ? existingNode.metrics : {}, events: existingNode.events, settings: existingNode.settings};
By now you will have ability to calculate float in bash and you will be write "data" (which is what serial gets) to file (append/overwrite).
3)After that, you will need bash script: nano SCRIPT_NAME.sh
#!/bin/bash
while :
do
var="$(less -FX /home/pi/gateway/LOG_FILE | awk '{print $1}' )"
echo $var
if [ "$var" == "[5]" ]
then
temp1="$(less -FX /home/pi/gateway/LOG_FILE | awk '{print $2}' | sed -e 's/C://')"
temp=$(echo "$temp1*1.8+32" | bc)
fi
###########################################################################################################################################################################################################################################
if [ "$var" == "[40]" ]
then
humidity1="$(less -FX /home/pi/gateway/LOG_FILE | awk '{print $3}' | sed -e 's/H://')"
pressure1="$(less -FX /home/pi/gateway/LOG_FILE | awk '{print $4}' | sed -e 's/P://')"
humidity=$(echo $humidity1/1 | bc)
baro=$(echo "scale=2;$pressure1/33.863753" | bc)
fi
###########################################################################################################################################################################################################################################
echo $temp
echo $humidity
echo $baro
curl "https://weatherstation.wunderground.com/weatherstation/updateweatherstation.php?ID=YOURSTATIONNAME&PASSWORD=YOURPASSWORD&dateutc=now&tempf=${temp%$cr}&baromin=${baro%$cr}&humidity=${humidity%$cr}&weather=&clouds=&softwaretype=Arduino-ESP8266&action=updateraw"
sleep 10
done
run ./SCRIPT_NAME.sh
if you are in the same folder as SCRIPT_NAME.sh, else enter full path
Oh and BTW, I do calculations because I have °C, and mBar and not °F and inHg, which site expects.
Have fun
Note: Have changed the two files names, so that is more clear which is which, since they are both in the same folder