Weather Station Plug-In example
Posted: Fri May 06, 2011 5:31 pm
This bash script is an example which pulls actual temperature data from a website (weather data of Sylt) and offers that to Meteohub:
Just put this script into directory "/home/meteohub/myplugin.sh", give it execution rights by "chmod a+x /home/meteohub/myplugin.sh" and insert the path into your plug-in weather station defined on "weather station" page of Meteohub. Sensor "th9" should then appear as a sensor sending data on "sensors" page, as any regular weather station.
Output format of plug-in weather stations is explained in the manual in Appendix B, Plug-Ins.
Code: Select all
#! /bin/sh
#
while :
do
# pull data from website and filter the needed string
wget -O /dev/stdout "http://www.wetter.com/deutschland/sylt_ost/DE0010330.html" 2>/dev/null | grep "deg text_l temp_w" | gawk 'BEGIN {FS=">"} {print $3}' | gawk 'BEGIN {FS="&"} {printf "t9 %d\n", lround ($1 * 10.0)}'
# make sure output gets flushed
sync
# wait 30 seconds for next read
sleep 30
done
Output format of plug-in weather stations is explained in the manual in Appendix B, Plug-Ins.