Difference between revisions of "Add-On Services"

From meteobridge
Jump to: navigation, search
(Individual MYSQL Uploads)
Line 79: Line 79:
 
[[File:mysql.png]]
 
[[File:mysql.png]]
  
Example above stores actual outdoor temperature to field "temp" of table "upload" of database "test". Fields "hum" and "wind" are also filled with relative outdoor humidity and current non averaged wind speed in km/h.
+
Example above stores actual outdoor temperature to field "temp" of table "upload" of database "test". Field "wind" is also filled with relative outdoor humidity and current non averaged wind speed in km/h. When temprature or wind data is not there a value of -9999 is stored.
  
 
Details of using variables in templates is explained in "Template" section of left menu.
 
Details of using variables in templates is explained in "Template" section of left menu.

Revision as of 00:50, 27 January 2013

Meteobridge provides some additional services, which might be interesting, when you also want to use received data with your own postprocessing IT. Live data can be derived in two ways. Meteobridge client can be asked by a HTTP request to return data (pull mode) or can send data as HTTP-GET requests with user-defined URL parameters to a user-defined Internet address (push mode).

Pull Mode

Web server of Meteobridge client, which presents web interface for adminstration to you, can also deliver weather data. There are two URLs defined that can be polled to get most recent sensor data in XML or plain text. Although we don't recommend this for security reasons, you can make that URLs accessible from the Internet by configuring your router appropriately. However, when you want to bring sensor data to one of your own servers in the Internet we recommend to make use of Meteobridge's push mode, which will not need you to open up your firewall.

Live Data as XML

By sending the meteobridge a HTTP request like "http://ip-of-meteobridge/cgi-bin/livedataxml.cgi" (where "ip-of-meteobridge" must be replaced by the IP itself) meteobridge returns current weather data in XML notation. Each reply starts witch tag <logger> and ends with </logger> with the sensor data as records with sensor specific tags "THB", "TH", "WIND", "RAIN", "UV", "SOLAR". Example below illustrates the XML format:

<logger>
  <THB date="20121227224318" id="thb0" temp="26.0" hum="37" dew="10.2" 
       press="1008.8" seapress="1010.1" fc="2"/>
  <TH date="20130104141909" id="th0" temp="9.1" hum="95" dew="8.3"/>
  <RAIN date="20130104141856" id="rain0" rate="0.0" total="3.0" delta="0.0"/>
  <WIND date="20130104141916" id="wind0" dir="109" gust="0.9" wind="2.2" chill="9.1"/>
</logger>

Each sensor data record has a mandatory "date" and "id" parameter. The other parameters are sensor specific. Meaning of parameters is:

  • date: UTC timestamp of reception of sensor data in format "YYYYMMDDhhmmss"
  • id: Unique ID of sensor, consists of a sensor type description shortcut followed by a number, which is always "0" in Meteobridge, as additional sensors are not supported
  • temp: temperature in degrees Celsius (with one decimal)
  • hum: relative humidity in percent (no decimals)
  • dew: dew point temperature in degrees Celsius (with one decimal)
  • press: station pressure (without altitude correction) in hPa (with one decimal)
  • seapress: normalized pressure with altitude correction (also called sea level pressure) in hPa (with one decimal)
  • fc: stations forecast code, if provided. As this has low evidence and also largely varies between stations, meteobridge does not recommend to make use of this data.
  • rate: measured rain rate in mm per hour (with one decimal).
  • total: current value of rain bucket counter, converted to mm (with one decimal).
  • delta: additional rain fall in mm since previous readout of this data (with one decimal).
  • wind: current average wind speed im m/s (with one decimal).
  • gust: curent not avergaed wind speed in m/s (with one decimal).
  • dir: wind direction in degrees (0-359, no decimals).
  • chill: wind chill temperature in degrees Celsius (with one decimal).
  • more to come...

Live Data as Plain Text

By sending the meteobridge a HTTP request like "http://ip-of-meteobridge/cgi-bin/livedata.cgi" (where "ip-of-meteobridge" must be replaced by the IP itself) meteobridge returns current weather data as plain text. Each reply consists of a series of lines, where each line represnets a sensor. Lines do start with a time stamp and a unique sensor id followed by sensor specific parameters. Example below illustrates the format:

20130104142614 thb0 26.9 38 11.4 1020.4 1021.7 2
20130104142610 rain0 0.0 3.0 0.0
20130104142636 th0 9.1 95 8.3
20130104142652 wind0 160 2.2 1.8 8.0

Push Mode

When you select expert mode at the bottom of "Upload Data" tab, you will see an additional entry that allows you to send sensor data to a user-defined server.

Twitter Upload

Meteobridge allows you to send weather data snippets to your twitter account. As twitter requires a bit complicated authentication you will have to run through 6 steps.

Individual HTTP Upload

Data will be sent as HTTP GET requests with URL parmeters you can define to your liking. Parameters of a URL consist of name-value pairs seperated by '&'. You can define names yourself and can use a certain set of variables provided by Meteobridge to be used as values. Variable names will be automatically replaced by their current values, each time a HTTP request is sent. Please have a look at the example below.


Http-upload.png


Upload schedule is defined to every 5 seconds. URL specifies server address, where to deliver data ("http://myserver.com/upload.php" in the example above). "Success Condition" allows to specify a matching string which is compared to to the return message from the server to decide if upload was successful or not.

Weather data is transported to the server by means of URL parameters. Meteobridge provides a large set of variables that can be used to feed URL parameters with current sensor data. Section "Templates" will explain how to use these variables to fill URL parameters with recent sensor data.

Individual MYSQL Uploads

When you prefre to store your weather station's data in your own MYSQL database, Meteobridge can feed sensor data to it in a very easy way. Just state

  • Host: server name or IP of server when DNS can' resolv the name
  • Port: port number where to reach MYSQL database on your server
  • Database: name of database to feed
  • User: name of database user to use for data upload
  • Password: passwrod for user name.
  • Query: payload that should be sent to the database. Query usually contains a MSQL insert statement followed by a table name and a list of column names and values. The query ist subject to template replacement, so you can use Meteobridge variables to upload weather data to your database.

Mysql.png

Example above stores actual outdoor temperature to field "temp" of table "upload" of database "test". Field "wind" is also filled with relative outdoor humidity and current non averaged wind speed in km/h. When temprature or wind data is not there a value of -9999 is stored.

Details of using variables in templates is explained in "Template" section of left menu.