Templates

From meteobridge
Revision as of 16:14, 3 January 2018 by Admin (Talk | contribs) (Created page with "Die Meteobridge PRO stellt ein paar zusätzliche Variable zur Verfügung, mit denen der Systemstatus aufgezeichnet wird: * '''data10num''': CPU Auslastung in Prozent * '''data...")

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

Meteobridge provides a very flexible mechanism to smuggle sensor data of different kinds into strings to be used by Meteobridge push services like Twitter, HTTP GET uploads or MySQL database insert requests.

Simply type in the text you want to upload and represent the pieces of sensor data by so called variables. When data gets uploaded, these variables will be replaced by current sensor data and so a string filled with the data you intended will be uploaded.

Jede Variable beginnt und endet mit einer eckigen Klammer "[" und "]". Die Variable in diesen Klammern zeigt die folgende Struktur:
Sensor-Selektor=Konverter.Dezimalstellen:Ersatzzeichenkette

"Konverter", "Dezimalstellen" und "Ersatzzeichenkette" kann weggelassen werden, "Sensor" und "Selektor" müssen angegeben werden. Während "Sensor" festlegt, um welchen Sensor es sich handelt und welcher Sensorwert verwendten werden soll, gibt "Selektor" an, welche Zeitperiode ausgewertet werden soll. Mit "Konverter" kann optional eine Umrechnung in andere Maßeinheiten realisiert werden. Die "Dezimalstellen"-Angabe bestimmt die numerische Auflösung der Daten und die "Ersatzzeichenkette" bestimmt den Wert, der ausgegeben wird, wenn kein Sensorwert für den definierten Zeitraum vorliegt.

Sensoren

Diese Sensoren sind in Meteobridge definiert:

  • th0temp: Außentemperatur in Grad Celsius
  • th0hum: Relative Außenluftfeuchte in Prozent
  • th0dew: Außentaupunkttemperatur in Grad Celsius
  • th0heatindex: Hitzeindex in Grad Celsius
  • thb0temp: Innentemperatur in Grad Celsius
  • thb0hum: Innenluftfeuchte in Prozent
  • thb0dew: Innentaupunkttemperatur in Grad Celsius
  • thb0press: Stationsluftdruck in hPa
  • thb0seapress: auf Meeresspiegelhöhe berechneter Luftdruck in hPa
  • wind0wind: ungemittelte Windgeschindigkeit in m/s
  • wind0avgwind: gemittelte Windgeschindigkeit in m/s
  • wind0dir: Windrichtung in Grad (0° ist Norden)
  • wind0chill: Windchill-Temperatur in Grad Celsius
  • rain0rate: Regenrate in mm/h
  • rain0total: gefallene Regenmenge in mm
  • uv0index: UV-Index
  • sol0rad: Solarstrahlung in W/m^2
  • sol0evo: Evapotranspiration in mm (nur für Davis Vantage verfügbar)

Wenn ein Sensor nicht existiert oder seine Daten älter als das maximal tolerierte Sensordatenalter sind, wird Meteohub keine Daten einsetzen und sofern definiert, stattdessen die Ersatzzeichenkette einsetzen. Falls keine Ersatzzeichenkette definiert ist, bleibt die Variable unersetzt als Zeichenkette stehen. Da einige Wetterstationen auch geringe Batteriespannung anzeigen, sind auch Sensoren thb0lowbat, th0lowbat, etc verfügbar. Diese Sensoren zeigen einen niedrigen Batteriespannung der Basissensoren an (0 = normale Batteriespannung, 1 = niedrige Batteriespannung).

Einige Stationen unterstützen zusätzliche Temperatur/Feuchtesensoren. Meteobridge zählt diese als "th1temp", "th1hum", "th1dew", etc auf. Der Reiter "Live-Daten" zeigt neben den aktuellen Daten auch die Sensornummern dieser Zusatzsensoren. Wenn man über eine mit Bodenfeuchte- und Blattfeuchtesensoren ausgestattete Davis Vantage verfügt, werden diese Sensoren ebenfalls als Temperatur/Feuchtesensoren geführt, allerdings ohne Berechnung eines Taupunktes. Die Bodenfeuchtesensoren weden als "th10temp", "th10hum", ..., "th13temp", "th13hum" und die Blattfeuchtesensoren als "th15temp", "th15hum", ..., "th18temp", "th18hum" geführt. Die "hum"-Werte repräsentieren in diesem Fall nicht die relative Luftfeuchte, sondern Werte in "cbar" und "wet". Meteobridge erfindet für diese Spezialsensoren keine neuen Selektoren. Der generische Selektor "hum" dient dazu, auch die Werte in "cbar" und "wet" dieser Sensoren abzufragen.

Die Meteobridge PRO stellt ein paar zusätzliche Variable zur Verfügung, mit denen der Systemstatus aufgezeichnet wird:

  • data10num: CPU Auslastung in Prozent
  • data11num: Laufzeit in Stunden
  • data12num: Nutzung der Daten-Partition in Prozent
  • data13num: Nutzung des Hauptspeichers in Prozent
  • data14num: Leistungsaufnahme in Watt
  • data15num: Anzahl von Prozessen
  • data16num: Alter der letzten Sensordatenmeldung in Sekunden
  • data17num: Betriebsspannung in Volt
  • data18num: aktueller Stromverbrauch in Ampere
  • data19num: Gesendete Daten in Kilobytes (inkludiert Webinterface-Nutzung)
  • data20num: Empfangene Daten in Kilobytes (inkludiert Webinterface-Nutzung)

Selectors

Sensors are followed by a selector (syntactically separated by a dash) that specifies what period in time should be used for evaluation. Valid selectors are:

  • act: most recent data
  • hmin: minimum value of this hour
  • hmax: maximum value of this hour
  • dmin: minimum value of today
  • dmax: maximum value of today
  • ydmin: minimum value of yesterday
  • ydmax: maximum value of yesterday
  • mmin: minimum value of this month
  • mmax: maximum value of this month
  • ymin: minimum value of this year
  • ymax: maximum value of this year
  • amin: minimum value of all time
  • amax: maximum value of all time

Sensors that deliver cumulated data like "rain0total", "sol0evo" and "sun0total" should be used with the following selectors only:

  • hoursum, daysum or sumday, monthsum, yearsum, allsum, ydaysum: selects summarized delta values from today, this month, this year, all time or yesterday. Example: "rain0total-sumday" is todays rain fall.

When you are interested in timestamps of min/max values, you can make use of these selectors:

  • hmintime: timestamp of minimum value of this hour
  • hmaxtime: timestamp of maximum value of this hour
  • dmintime: timestamp of minimum value of today
  • dmaxtime: timestamp of maximum value of today
  • ydmintime: timestamp of minimum value of yesterday
  • ydmaxtime: timestamp of maximum value of yesterday
  • mmintime: timestamp of minimum value of this month
  • mmaxtime: timestamp of maximum value of this month
  • ymintime: timestamp of minimum value of this year
  • ymaxtime: timestamp of maximum value of this year
  • amintime: timestamp of minimum value of all time
  • amaxtime: timestamp of maximum value of all time
  • starttime: timestamp of first recorded value
  • nonzerotime: timestamp of last occurrence of a nonzero value

Timestamps are strings of format "YYYYMMDDhhmmss". Year "YYYY" is reported in 4 digits, all other values (month "MM", day "DD", hour "hh", minute "mm", second "ss") come with 2 digits, leading zeros are not suppressed.

  • age: reports seconds elapsed since last reception of data for that particular sensor.
  • hold: reports seconds elapsed since last reception of data for that particular sensor, but returns invalid value when age is beyond data hold period of 300 seconds. This allows to return invalid status instead large number of seconds for sensors having dropped off long time ago.


Neben obigen Selektoren, die fest definierte Zeitfenster selektieren, kann mit den folgenden Selektoren eine Auswertung für einen relativen Zeitraum in die Vergangenheit durchgeführt werden. Die Rückschau reicht wegen der begrenzten Speicherausstattung der Meteobridge nur bis zu 60 Minuten in die Vergangenheit.

  • val1, val2, val13, ..., val60: selektiert den Sensorwert von vor einer bis 60 Minuten
  • max1, max2, max3, ..., max60: selektiert das Maximum der letzten einen bis 60 Minuten
  • min1, min2, min3, ..., min60: selektiert das Minimum der letzten einen bis 60 Minuten
  • avg1, avg2, avg3, ..., avg60: selektiert den Durchschnittswert der letzten einen bis 60 Minuten

Sensoren wie "rain0total" und "sol0evo", die kumulierte Werte liefern, können wegen der geringeren Abtastdichte (1 Wert pro Minute) bis zu 24 Stunden in die Vergangenheit ausgewertet werden:

  • sum1, sum2, sum3, ..., sum60, sum1h, sum2h, sum3h, ..., sum24h: selektiert zusammengerechnete Deltawerte der letzten einen bis 60 Minuten oder der letzten einen bis 24 Stunden, welches zum Berechnen der gefallenen Regenmenge im definierten Zeitraum erforderlich ist. Beispiel: "rain0total-sum60" ergibt die gefallene Regenmenge in mm der letzten 60 Minuten.
  • delta1, delta2, delta3, ..., delta60, delta1h, delta2h, delta3h, ..., delta24h: zeigt die Differenz zwischen dem aktuellen Sensorwert und dem Sensorwert vor 1 bis 60 Minuten oder dem Sensorwert vor 1 bis 24 stunden. Eine positiver Wert zeigt ein Ansteigen über die Zeit an, ein negativer Wert ein Abfallen. Diese Daten sind für Trendanalysen über unterschiedliche Betrachtungszeiträume hilfreich.

Meteobridge PRO Additions

Selectors val, min, max, avg, sum, mintime, maxtime can be combined with a "@YYYYMMDDhh" specifier, which determines the point in time where the data should be taken from. This specifier also defines if data should be used on a per hour, per day, per month or per year resolution. To get data in a per hour resolution the specifier needs to define the point in time down to the hour. Example: "min@2015121909" selects minimum data from December 19, 2015 09:00 until 9:59 (on a per hour base). This is how the specifier works:

  • @YYYY selects data for the specified year. Example: Using "[th0temp-min@2015]" in a template will report minimum outdoor temperature of 2015. When "YYYY" is not defining a valid year but is in the range of "0000" to "0010" then "0000" is interpreted as the current year, "0001" as the previous year and so on. In that situation the 4 digit number expresses how many years to skip into the past. These skips need to be in 4-digit style, leading zeros are not allowed to be omitted.
  • @YYYYMM selects data for the specified month. Example: Using "[wind0wind-max@201509]" in a template will report maximum wind speed (gust) of September 2015.
  • @YYYYMMDD selects data for the specified day. Example: Using "[rain0total-sum@20151031]" in a template will report total rainfall on October 31, 2015.
  • @YYYYMMDDhh selects data for the specified hour. Example: Using "[uv0index-avg@2015110316]" in a template will report average UV index on November 3, 2015 between 16:00 and 16:59.

In addition to specify an absolute point in time (as explained above) you can also use points in time relative to now. Relative points in time can be specified in terms of years, months, days, hours and minutes as follows:

  • @Yn addresses yearly data n years in the past. Example: When you are in 2016 and specify "[th0temp-max@Y1]" it will return the maximum outdoor temperature of last year (2015), while "@Y3" will address data from 2013.
  • @Mn addresses monthly data n months in the past. Example: "[wind0wind-max@M0] will return max wind speed of current month, while "[wind0wind-max@M1]" will return max wind speed of previous month.
  • @Dn addresses daily data n days in the past. Example: "[th0temp-min@D7]" will return minimum outdoor temperature of the current day, one week in the past.
  • @hn addresses hourly data n hours in the past.

val zeigt grundsätzlich dieselben Werte wie "avg". Bei minütlicher Auflösung zeigt "val" den Durchschnitt der Werte der Minute, falls mehrere Werte in der Minute angeliefert wurden.

mintime und maxtime zeigen den Zeitstempel des gesuchten Minimums oder Maximums in dem definierten Zeitraum. Der Zeitstempel wird in der Notation "YYYYMMDDhhmmss" in Sekundenauflösung berichtet.

Converters

Sensor data is reported in ISO units (°C, hPa, mm, m/s) by default, but can be converted into non-ISO units (imperial) by adding a conversion token. Defined tokens are:

  • F converts temperature from Celsius to Fahrenheit.
  • psi converts pressure from hPa (equivalent to mbar) to psi.
  • mmHg converts pressure from hPa to millimeters of mercury.
  • inHg converts pressure from hPa to inches of mercury.
  • kmh converts wind speed from meters per second to kilometers per hour.
  • mph converts wind speed from meters per second to miles per hour.
  • kn converts wind speed from meters per second to knots.
  • bft converts wind speed from meters per second to Beaufort scale.
  • in converts millimeters to inches.
  • ft converts meters to feet.
  • endir converts a wind direction into one of 16 English direction texts.
  • nldir converts a wind direction into one of 16 Dutch direction texts.
  • dedir converts a wind direction into one of 16 German direction texts.
  • barotrend converts a delta measurement (selector delta) into a barometer trend analysis pattern (1 hPa is about 0.03 inHg):
    • -2: delta <= -2 hPa
    • -1: -2 hPa < delta <= -1 hPa
    • 0: -1 hPa < delta < +1 hPa
    • +1: +1 hPa <= delta < +2 hPa
    • +2: +2 hPa <= delta
  • enbarotrend reports trend as strings FF, FS, ST, RS, RF

Converters "F", "psi", "mmHg", "inHg", "kmh", "mph", "kn", "bft", "in", "ft" can be followed by a multiplier. For example: Converter "F10" tells that temp data of sensor will be converted to degrees of Fahrenheit and multiplied by 10 or to say it the other way round the data will be represented in 1/10 degrees of Fahrenheit. As a special case a converter can also just be a multiplier. In that case the multiplier is applied without conversion of units.

Wenn Variable einen Zeitstempel liefern, kann dieser von lokaler Zeit (Voreinstellung) auf Weltzeit (UTC) umgerechnet weden:

  • utc gibt den Zeitstempel nicht in lokaler Zeit (Voreinstellung) sondern in Weltzeit aus.
  • apm berichtet den Zeitstempel in AM/PM-Notation. Beispiel: "201603011123344AM" steht für den 11. März 2016 um 12:33:44 AM".

Forecast Variables

When you are using a Davis Vantage station, it provides a couple of forecast rules, which Meteobridge can report via template variables. All forcast variables start with sensor name "forecast" followed by one of these selectors:

  • rule: reports Vantage rule number. When no rule present (or not a Vantage this will be a negative number).
  • text: reports forecast text in English
  • textde: reports in German (UTF-8 coded)
  • textdeiso: reports in German (ISO-8859 coded)
  • textdehtml: reports in German (HTML coded)
  • textit: reports in Italian
  • textnl: reports in Dutch
  • textest: reports in Estonian
  • texthr: reports in Hungarian
  • textcz: reports in Czech

When converter "us" is added, all blanks are replaced by underscores.

System Variables

Meteobridge provides some additional variables that tell details not directly related to weather conditions. Sensor name is "mbsystem", defined selectors are:

  • mac: Meteobridge MAC hardware address (example: "40:01:FE:23:12:A8")
  • swversion: Meteobridge version string (example: "1.1")
  • buildnum: build number as integer (example: 1673)
  • platform: string that specifies hw platform (example: "TL-MR3020")
  • station: string that specifies selected weather station (example: "WMR-200")
  • stationnum: integer that specifies selected weather station (example: 49)
  • language: language used on Meteobridge's web interface (example: "English")
  • timezone: defined timezone (example: "Europe/Berlin")
  • latitude: latitude as float (example: 53.875120)
  • longitude: longitude as float (example: 9.885357)
  • uptime: uptime of Meteobridge in seconds
  • cpuload1m, cpuload5m, cpuload15m shows average cpu load during last 1, 5, 15 minutes
  • ip: IP address
  • lanip: IP address on the LAN port (if connected)
  • wlanip: IP address of the WLAN (if connected)
  • lastdata: seconds passed since last piece of data received from weather station, returns -1 if no data received. Does not distinguish between useful and useless garbage data
  • lastgooddata: seconds passed since last piece of meaningful sensor data recorded, returns -1 if no sensor data recorded so far
  • solarmax: maximum possible solar radiation on that day at that point of the earth. Needs latitude and longitude set and pressure data available.
  • lunarage: days passes since new moon as integer (example: 28)
  • lunarpercent: lunarphase given as percentage from 0% (new moon) to 100% (full moon)
  • lunarsegment: lunarphase segment as integer (0 = new moon, 1-3 = growing moon: quarter, half, three quarters, 4 = full moon, 5-7 = shrinking moon: three quarter, half, quarter)
  • daylength: length of day (example: "11:28")
  • daylengthmin: length of shortest day of the year
  • daylengthmax: length of longest day of the year
  • civildaylength: alternative method for day length computation (example: "12:38")
  • civildaylengthmin: length of shortest day of the year according to civil day length computation
  • civildaylengthmax: length of longest day of the year according to civil day length computation
  • nauticaldaylength: alternative method for day length computation (example: "14:00")
  • nauticaldaylengthmin: length of shortest day of the year according to nautical day length computation
  • nauticaldaylengthmax: length of longest day of the year according to nautical day length computation
  • sunrise: returns time of astronomical sunrise in local time. Can be converted to UTC by applying "=utc" to the variable (example: "06:47", resp. "05:47") or can be converted to 12h time mode by applying "=apm" (example: "8:45AM").
  • sunset: returns time of astronomical sunset in local time. Can be converted to UTC by applying "=utc" to the variable (example: "18:15", resp. "17:15") or can be converted to 12h time mode by applying "=apm" (example: "12:45AM").
  • civilsunrise, civilsunset, nauticalsunrise, nauticalsunset: alternative computations for sunset and sunrise. These can also be converted to UTC ("=utc") or AM/PM ("=apm") as "sunrise and sunset".
  • daynightflag: returns "D" when there is daylight, otherwise "N" (civil sunrise/sunset is used as reference).
  • isday: returns "1" when there is daylight, otherwise "0" (civil sunrise/sunset is used as reference).
  • isnight: returns "0" when there is daylight, otherwise "1" (civil sunrise/sunset is used as reference).
  • moonrise: time of moonrise in local time. Can be converted to UTC or AP/PM notation by applying "=utc" resp. "=apm" to the variable. Please notice that not every day has a moonrise time, therefore, variable can be non-existent on certain days (example: "05:46", resp. "04:46")
  • moonset: time of moonset in local time. Can be converted to UTC or AP/PM notation by applying "=utc" resp. "=apm" to the variable. Please notice that not every day has a moonset time, therefore, variable can be non-existent on certain days (example: "17:00", resp. "16:00")
  • graphA: returns URL of the user's Meteoplug chart "*instruments-black"
  • graphB: returns URL of the user's Meteoplug chart "*instruments-black-imp"
  • graphC: returns URL of the user's Meteoplug chart "*iphone-black"
  • graphD: returns URL of the user's Meteoplug chart "*iphone-black-imp"
  • graphE: returns URL of the user's Meteoplug chart "*iphone-tw-2d"
  • graphF: returns URL of the user's Meteoplug chart "*iphone-tw-2d-imp"
  • graphG: returns URL of the user's Meteoplug chart "*iphone-pr-2d"
  • graphH: returns URL of the user's Meteoplug chart "*iphone-pr-2d-imp"

Converters for System Variables

Meteobridge supports converters to be applied to day length computations. Normally day length values are reported in a "HH:MM" fashion. This can be altered in the following ways:

  • secs converter returns day length information as number of seconds
  • mins converter returns day length information as number of minutes (can have decimals)
  • hours converter returns day length information as number of hours (can have decimals)

Timestamps can also be converted in various ways. Normal output is 24h notation "HH:MM" in local time. These converters can be applied:

  • utc reports timestamp in UTC instead of local time
  • apm reports timestamp in American AM/PM style.

Zeit/Datums-Variable

Die Ausgaben der aktuellen Zeit oder des aktuellen Datums entspricht nicht dem "Sensor-Selektor=Konverter" Schema, sondern ist wie folgt definiert.

Date und time variables are defined as follows:

  • YYYY: year as four digit number
  • YY: year as two digit number
  • MMM: month as three character English abbreviation ("Jan", Feb", ...)
  • MM: month as two digit number, if only one digit needed a zero will be used as first digit
  • M: month as one or two digit number, no leading zeros
  • DD: day of month as two digit number, if only one digit needed a zero will be used as first digit
  • D: day of month as one or two digit number, no leading zeros
  • hh: hour in 24h notation as two digit number, if only one digit needed a zero will be used as first digit
  • h: hour in 24h notation as one or two digit number, no leading zeros
  • HH: hour in 12h notation as two digit number, if only one digit needed a zero will be used as first digit
  • H: hour in 12h notation as one or two digit number, no leading zeros
  • apm: returns "am" or "pm" to be added to 12h time notations
  • APM: returns "AM" or "PM" to be added to 12h time notations
  • mm: minute as two digit number, if only one digit needed a zero will be used as first digit
  • m: minute as one or two digit number, no leading zeros
  • ss: seconds as two digit number, if only one digit needed a zero will be used as first digit
  • s: seconds as one or two digit number, no leading zeros

When a capital "U" preceeds a date/time variable name, UTC is used instead of local time ("[Uhh]:[Umm]:[Uss] UTC" is evaluated to a string like "16:03:33 UTC")

  • epoch: epochtime as defined in Unix (seconds since January 1, 1970)

Decimals

Unless otherwise defined numbers are reported with one decimal. By specifying a value for "decimals" you can determine resolution of presented values. When the value consists of zeros only (no decimals required) output will be filled up with leading zeros to match the length of the given pattern. Example: [th0temp-act.000:--] will result to "008" when outdoor temperature is 8.2° Celsius.

When variable returns a string instead of a number (in case of a timestamp for example), "decimal" specification does have a different format and meaning, which allows to select a substring. Specification of the substring consists of two lower-case letters. The first one specifies start point of the substring, second letter the position of last character of the string to be reported. For example, when string is timestamp "20130303121055" a specification of ".ad" selects a substring from first character (position code "a") until fourth character (position code "d"). When you want to grab the time for lowest outdoor temperature of today the template for that will be [th0temp-dmintime.ij:--]:[th0temp-dmintime.kl:--]. "ij" selects the hour part at position 9-10 and "kl" selects minute part at position 11-12 of the timestamp.

Ersatzzeichenkette

Wenn eine Variable nicht definiert ist oder keinen gültigen Wert liefern kann, wird die spezifizierte Ersatzzeichenkette ausgegeben, die auch leer sein kann. Fehlt die Angabe der Ersatzzeichenkette bleibt die Variabledefinition unverändert in der Zeichenkette stehen und wird nicht ersetzt.

Numerical Expressions

A numerical expression that Meteobridge should evaluate needs to be enclosed by {* and *}. The enclosed expression can also include template variables. This allows to do various computations with numerical data. Resulting value is returned with two decimals. You can define how many digits the return value should have by stating the number of decimals betwenn the * and } when closing the numerical expression. For example, *0} does set number of decimals to 0, which will return a rounded integer value. When you are looking for a non-rounded, truncated integer then *t} will do the job. When you need an output with a certain number of leading zeros, you can specify this the same way as explained in "Decimals" paragraph on this page.

The following operators can be used within numerical expressions:

operators in increasing precedence (from top to bottom)
Operator / Function Description
&&, ||, &, | logical "and", "or" operators working on value range: 1=true, 0=false
==, =, !=, <>, >, >=, <, <= comparison operations working on value range: 1=true, 0=false
+, - arithmetic operators "plus" and "minus"
*, /, % arithmetic operators "multiply", "divide" and "modulus" (which rounds the operands to integers first)
^ arithmetic operator "power"
sqrt(), log(), exp(), sin(), asin(), cos(), acos(), tan(), atan(), atan2(), abs(), fabs(), floor(), ceil(), round() arithmetic functions: square root, logarithm, logarithmic exponent, sinus, arcus sinus, cosinus, arcus cosinus, tangens, arcus tangens, arcus tangens2, absolute, floating point absolute, lower integer, upper integer, rounded integer

Um die Operator-Präzedenz zu brechen, können wie üblich Klammern "( )" verwendet werden.

Bedingte Ausdrücke

Templates können einfache bedingte Ausdrücke verwenden. Diese Ausdrücke erlauben keine Schachtelung und können nicht innerhalb numerischer Ausdrücke verwendet werden. Bedingte Ausdrücke müssen in der starren Form #if# ... #then# ... #else# ... #fi# angewendet werden.

  • #if# zeigt den Beginn des bedingten Ausdruckes an.
  • Zwischen #if# und #then# wird eine Zahl erwartet. Leerzeichen werden ignoriert. Wenn die Zahl größer as 0.0 ist, wird der Ausdruck als "true" anderenfalls als "false" betrachtet.
  • Im Falle von "true" werden die Zeichen zwischen #then# und #else# verwendet um den gesammten bedingten Ausdruck im Template zu ersetzen.
  • Im Falle von "false" werden die Zeichen zwischen #else# und #fi# verwendet um den gesammten bedingten Ausdruck im Template zu ersetzen.

Da die bedingten Ausdrücke erst ganz am Ende aufgelöst werden, erfolgen alle anderen Template-Ersetzungsfunktionen oder Auswertungen numerischer Ausdrücke vorher.


Beispiele

Anbei ein paar Beispiele, die helfen, den Ersetzungsmechanismus besser zu verstehen.

  1. Template Outdoor temperature is [th0temp-act=F.1:--]°F wird umgewandelt in Outdoor temperature is 3.4°F, wenn keine Außentemperatur vorliegt erscheint Outdoor temperature is --°F.
  2. Template Local time is [hh]:[mm] wird umgewandelt in Local time is 09:27.
  3. Template Max gust in last 10 minutes was: [wind0wind-max10.1:--]m/s, [wind0wind-max10=mph.1:--]mph, [wind0wind-max10=kn.0:--]kn wird umgewandelt in Max gust in last 10 minutes was: 10.5m/s, 23.5mph, 20kn.
  4. Template Max gust in last 10 minutes was: [wind0wind-max10.1:0]m/s, {*[wind0wind-max10.1:0] * 3.6 *1}kph wird umgewandelt in Max gust in last 10 minutes was: 10.5m/s, 37.8kph.
  5. Template Max gust in last 10 minutes was: #if#{*[wind0wind-age:999]>600*}#then#--#else#[wind0wind-max10.1:0]m/s, {*[wind0wind-max10.1:0] * 3.6 *1}kph#fi# wird umgewandelt in Max gust in last 10 minutes was: 10.5m/s, 37.8kph wenn die letzten Winddaten jünger als 10 Minuten (600 Sekunden) sind und wenn nicht, dann Max gust in last 10 minutes was: -- .
  6. Template [th0temp-dmintime=apm.ij]:[th0temp-dmintime=apm.kl][th0temp-dmintime=apm.op] berichtet den Zeitstempel der Tagestiefsttemperatur des Aussentemperatursensors in 12-Stunden AM/PM-Notation: 12:34AM