Weather Station Plug-In example

Answers to Questions that pop up more than once.

Moderator: Mattk

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

Weather Station Plug-In example

Post by admin »

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 :
  # pull data from website and filter the needed string
  wget -O /dev/stdout "" 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 
  # wait 30 seconds for next read
  sleep 30
Just put this script into directory "/home/meteohub/", give it execution rights by "chmod a+x /home/meteohub/" 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