Sendedienste

From meteoplug
Revision as of 13:17, 25 February 2013 by Admin (Talk | contribs) (Created page with "===E-mail versenden=== Meteobridge kann individuelle E-Mails in definierten Zeitintervallen oder beim Eintritt eines Ererignisses senden. Um diesen Dienst zu aktivieren, müss...")

Jump to: navigation, search
Other languages:
Deutsch • ‎English

Meteobridge stellt eine reihe von individualisierbaren Sendedienste zur Verfügung, die auf verschiedene Arten Wetterdaten an andere Systeme weiterleiten können. Zu den Standardmethoden gehört der zeitgesteuerte Versand von E-Mails und Twitter-Nachrichten mit aktuellen Wetterdaten sowie eine Alarmierungsfunktion, die beim Erreichen individuelle definierbarer Schwellwerte Meldungen per E-Mail oder Twitter versendet.

Wenn der "Expertenmodus" ausgewählt und mit "Speichern" bestätigt wurde, stehen weitere, etwas komplexere Übertragunsmodi zur Verfügung. Bei Ausschalten diese Option verschwinden diese Dienste wieder vond er Seite, die sonst recht überladen wäre.

Die folgenden Abschnitte erläutern wie die Sendedienste im Detail aufgesetz werden. Die Sendedienste sind eher für den technisch versierten Anwender interessant, da man ein Grundverständis über die Funktionsweise dieser Dienste benötigt. Wenn man nur Wetterdaten an vordefinierte Wetternetzwerke übertragen möchte, sollte man diesen Reiter komplett ignorieren.

Grundlegende Sendedienste

In diesem Abschnitt werden zunächst die elementarsten Sendedeinste E-Mail, Twitter und das Versenden bei Erreichen von Alarmbedingungen vorgestellt.


Page6de.png


An Twitter Senden

Meteobridge erlaubt Wetterdaten als kleine Textpakete an den Sienst Twitter zu senden. Da Twitter eine etwas aufwändige Authentifizierung hat, ist initial das Durchlaufen von 6 Schritten erforderlich.


E-mail versenden

Meteobridge kann individuelle E-Mails in definierten Zeitintervallen oder beim Eintritt eines Ererignisses senden. Um diesen Dienst zu aktivieren, müssen die folgenden Einstellungen vorgenommen werden.

  • Sendeinterval: definiert in welchem zeitabstand E-Mail gesendet werden. Die Einstellung "nur bei ALarm" bewrikt, dass kein zeitgesteuerter Versand erfolgt, sondern nur beim Erfüllen definierter Alarmbedingungen (siehe nächsten Abschnitt) eine E-Mail versendet wird. Das Drop-Down-Menu rechts vom Sendeintervall ermöglicht die Definition ob und wie häufig ein gescheiterter Mailversand wiederholt werden soll. Dabei wird nur der Erfolg des Absetzens der E-Mail an den SMTP-Server berücksichtigt, Weiterleitungsprobleme jenseits diese Servers bemerkt Meteobridge nicht. Das sich daran anschließende Drop-Down-Menu erlaubt die Auswahl der Authentifizierungsmethode, mit der Meteobridge den SMTP-Server kontaktiert:
    • keine: Der SMTP-Server wird ohne weiter Authentifizierung kontaktet. Diese Zugriffsart gestatten SMTP-Server nur sehr selten und dann auch nur in geschlossenen LANs, da sie sonst als offene Spam-Relays missbraucht werden können.
    • basis: Ist die klassische Benutzername/Passwort-Authentifikation, die ohne Verschlüsselung dieser Daten auskommt. Zunehmend weniger SMTP-Server erlauben diese gering geschütze Zugriffsart.
    • tls: Ist eine Authentifizierung mit SSL-Verschlüsselung. Diese Variante der SSL-Verschlüsselung wird allerdings selten von SMTP-Servern verwendet.
    • starttls: Ist inzwischen die am Häufigsten genutze Zugangsart, die sowohl Zugangs- wie Nutzdaten per SSL verschlüsselt.
  • SMTP-Server: gibt die IP des oder den Namen des SMTP-Servers an, an den die ausgehenden Mails gesendet werden.
  • Port: Spezifiziert die Port-Nummer auf der der SMTP-Server auf zur Weiterleitung bestimmte E-Mail lauscht. Standard-Ports sind 25 für non-SSL-Verbindungen und 587 für SSL-verschlüsselte Kommunikation)
  • Name: Benutzername zur Authentifizierung
  • Passwort: Passwort zu Authentifizierung
  • Empfänger: E-mail-Adresse, die als Empfänger der Mail fungieren soll.
  • Absender: E-mail-Adresse, die als Absender der Mail fungieren soll. Viele SMTP-Server verlangen, dass die Absenderadresse in der dem Server zugeordneten Domain liegt und verweigern sonst den Versand, um Spamming zu verhindern.
  • Text: Dies ist der eigentliche Inhalt der E-Mail. Man kann mit einem "#" eine Betreffzeile vom Mailtext abtrennen. Diese Zeichenkette ist Gegenstand der Zeichenersetzungsregeln bezüglich der Verwendung von Variable, wie auf der Seite Templates beschrieben.

The test button in the "SMTP Hoste" line does send an e-mail with subject "Meteobridge Test" to the given address. If sendig the mail does not work, an error message will pop-up, explaining what went wrong.


Email0.png


Body weather conditions#temp [th0temp-act.1:--]°C\n[wind0wind-max60=kmh.1:--]km/h in example above generates an e-mail with subject "weather conditions" and a body containing two lines (separated by a line feed character "\n"). First line will report current outdoor temperature like "13.4°C" and second line will report max gust speed during last hour, like "34.7km/h". Details of using variables in templates are explained in Templates section.

Alarm Service

Meteobridge can send you an e-mail or twitter message when a certain sensor condition is met. To have this feature activated, as least on of the services "e-mail " or "twitter" must be configured correctly. Alarm services makes use of the e-mail and twitter settings and does not provide seperate credentials for these services. The fields in the screen dump below have this meaning:

  • Alarm Mode: can be "disabled", "send e-mail" or "send twitter". In addition you can choose between "one-time alarms" which are triggered once and need to be cleared before they can be fired again, and "incremental alarms" which allow a retriggering of a non-cleared alarm, when the triggering event matches "raise condition" by a larger magnitude than the last trigger event.
  • Raise Condition: defines the condition to be met in order to fire an alarm. Once an alarm is fired, it will not be fired again until the alarm is cleared again. When you have selected incremental alarms, an alarm can be fired again under certain circumstances. Details on condition statements are explained in "conditions" subsection below.
  • Clear Condition: defines condition to be met to clear a fired alarm. Details on condition statements are explained in "conditions" subsection below.
  • Message: defines the email or twitter text to send. This text is subject to Meteobridge's template replacement mechanism and is handled as already lined out for e-mail and twitter services.

Alarm0.png


Body Gust Warning#Gust speed of [wind0wind-act=kmh.1:--]km/h in example above generates an e-mail with subject "Gust Warning" and a body containing a line like "Gust speed of 65.2km/h", when raise condition in example of gust speeds greater 50 km/h is met.

Conditions

There are two type of conditions that are formulated exactly the same way, but have different meaning. If a "raise condition" is satisfied, an alarm will be triggered and sent via e-mail or twitter. To send out the next email, it needs the "clear condition" to be satisfied first. The idea behind that is to suppress a large amount of follow-up messages on an event already given attention. For example, when raise condition is set to "outdoor temp above 35°C" and clear condition is set to "outdoor temp below 30 °C" and resolution used for comparison is integer level (zero decimals) you will get a message once the temperature goes beyond 35° but will not get additional messages on that until the temperature has dropped below 30°C again. When you habe selected "incremental alarms" and temperature raises from 35°C up to 37.2°C you will get one messages about passing 35°C, one about passing 36° and one about passing the 37°C threshold. This gives you the chance to get informed how much the given threshold was passed.

Condition statements consist of three parts separated by blanks.

  • First part is the variable. Variables in conditions are exactly the same as in Meteobridge Templates, so you don't have to learn a new syntax here. While variables in templates are embedded into a pair of square brackets, variables in condition statements don't have that brackets. The raise condition in the example above has varibale definition wind0wind-act=kmh.1:0, which stands for actual non averaged wind speed, converted to km/h with no decimals and when there is no sensor data there, then 0 is taken as speed.
  • Second part is a comparison operator. Defined operators are
    • = equal, != non equal
    • < less than, <= less than or equal
    • > greater than, >= greater than or equal
  • Third part is a numerical value, which can be integer or float.


Advanced Push Services

When you select "Expert Mode" you have additional options to send weather data to. All these services need a server somewhere which can take data from your Meteobridge client. Supported protocols are HTTP-GET, mySQL and FTP.


Page6b.png


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 10 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't resolve 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: password 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


Query insert upload (temp, wind) values ([th0temp-act.1:-9999], [wind0wind-act=kmh.1:-9999]) in example above stores actual outdoor temperature to field "temp" of table "upload" of database "test". Field "wind" is filled with current non averaged wind speed in km/h. When temperature or wind data is not there a value of -9999 is stored.

Details of using variables in templates are explained in Templates section.

Individual FTP Uploads

Meteobridge allows you define a FTP server where it can upload up to 4 different files. FIles to be uploaded have to be accessable in the Internet via HTTP. Meteobridge downloads the files pointed to, replaces Meteobridge variables inside the downloaded file by current weather data and uploads resulting file to the specified directory. Meteobridge can just handle one FTP server, but distinct directories and file names for each of the four uploads. Setup of FTP upload credentials is done as follows:

  • FTP Host: server name or IP of server (when DNS can't resolve the name)
  • Port: port number where to reach MYSQL database on your server
  • FTP User: user name to be used for FTP upload
  • FTP Password: password to be used for FTP upload

In order to check if FTP credentials do work, you can press "Test Upload" button. Meteobridge will upload a file named "test-upload" with current time stamp as content to your FTP server. File will be located at directory that is default when doing FTP login. When you want to test upload to different directories you can specify an path in "Test Path" field. This path is used for test uploads only.

In oder to define the payload Meteobridge should upload in regular intervals you have 4 lines to select content. Each line specifies an upload schema determined by three input fields.

  • Upload Interval: can have values from "no upload", "once per minute" up to "every hour".
  • Template file: this specifies an URL where to find the template in the Internet that Meteobridge should download, fill in weather data and upload to FTP server.
  • Path: defines the path where to store the data on the FTP server. Path includes directory and file name in Linux style (separated by "/"). Filename of the template is not used as default, you always have to specify a complete target file name.

To minimize traffic, Meteobridge does not download the referenced template files each time it does prepare a FTP upload. Templates are downloaded once during startup of Meteobridge and stay untouched until you press "Reload Templates" button. When you are working on the design of new templates, don't forget to press the reload button to make template changes effective to Meteobridge.


Ftp.png


Example above defines an upload schema to FTP server "ftp.myfamousserver.com" for user "myself". Template template.meteobridge.com/simpledash.html has been loaded on start up of Meteobridge and will be updated with recent data every minute and then uploaded to FTP server as file "mydash.html". When you view "mydash.html" with your browser it looks like this:


Mydash.png


Details of using variables in templates are explained in Templates section. To illustrate that using these varibales is quite easy the HTML body part (omitting the CSS styles for formating it nicely) of the template used in above's example is attached below:

<body>
  <table id="table-2">
    <thead><tr><th>Sensor</th>
               <th>Current</th>
               <th>Today (min)</th>
               <th>Today (max)</th></tr></thead>
    <tbody>
      <tr><td>Outdoor Temperature</td>
          <td>[th0temp-act.1:--]° C</td>
          <td>[th0temp-dmin.1:--]° C</td>
          <td>[th0temp-dmax.1:--]° C</td></tr>
      <tr><td>Outdoor Humidity</td>
          <td>[th0hum-act.0:--] %</td>
          <td>[th0hum-dmin.0:--] %</td>
          <td>[th0hum-dmax.0:--] %</td></tr>
      <tr><td>Outdoor Dew Point</td>
          <td>[th0dew-act.1:--]° C</td>
          <td>[th0dew-dmin.1:--]° C</td>
          <td>[th0dew-dmax.1:--]° C</td></tr>
      <tr><td>Wind Chill Temperature</td>
          <td>[wind0chill-act.1:--]° C</td>
          <td>[wind0chill-dmin.1:--]° C</td>
          <td>[wind0chill-dmax.1:--]° C</td></tr>
      <tr><td>Air Pressure</td>
          <td>[thb0seapress-act.1:--] hPa</td>
          <td>[thb0seapress-dmin.1:--] hPa</td>
          <td>[thb0seapress-dmax.1:--] hPa</td></tr>
      <tr><td>Wind Direction</td>
          <td>[wind0dir-act.0:--]°</td>
          <td></td><td></td></tr>
      <tr><td>Wind Speed (averaged)</td>
          <td>[wind0avgwind-act.1:--] m/s</td>
          <td>[wind0avgwind-dmin.1:--] m/s</td>
          <td>[wind0avgwind-dmax.1:--] m/s</td></tr>
      <tr><td>Gust Speed</td>
          <td>[wind0wind-max5.1:--] m/s</td>
          <td>[wind0wind-dmin.1:--] m/s</td>
          <td>[wind0wind-dmax.1:--] m/s</td></tr>
      <tr><td>Rain</td>
          <td>rate: [rain0rate-act.1:--] mm/h</td>
          <td>sum [rain0total-sumday.1:--] mm</td>
          <td></td></tr>
      <tr><td>Solar Radiation</td>
          <td>[sol0rad-act.0:--] W/qm</td>
          <td>[sol0rad-dmin.0:--] W/qm</td>
          <td>[sol0rad-dmax.0:--] W/qm</td></tr>
      <tr><td>UV Index</td>
          <td>[uv0index-act.1:--] uvi</td>
          <td>[uv0index-dmin.1:--] uvi</td>
          <td>[uv0index-dmax.1:--] uvi</td></tr>
    </tbody>
  </table>
</body>