Weather Station Plug-In example

Answers to Questions that pop up more than once.

Moderator: Mattk

Post Reply
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 5237
Joined: Mon Oct 01, 2007 10:51 pm

Weather Station Plug-In example

Post by admin » 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:

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
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.

Post Reply