Webtags

From Cumulus Wiki
Revision as of 13:35, 24 September 2022 by HansR (talk | contribs) (→‎Using Webtags)
Jump to navigationJump to search

This page is the new Webtags page. This page and subpages hold a complete rewrite of the Webtags page.

The information that was on this old Webtags page has been moved to Webtags (preserving history). You are advised to use that page until this page is ready and this message has been removed. If any questions or remarks please send a PM to HansR on the forum. Do not use the discussion tab unless accompanied by a PM: there is no automated signal to HansR if you use that page.

This page and its subpages will document the Webtags from the point of view of the CumulusMX software and not the Cumulus 1 legacy software. Cumulus 1 is no longer maintained and will eventually disappear. If you are still using it, please refer to the original Webtags page where @sfws has tried to give both packages equal value. That effort is no longer maintained in this Webtags page. We hope you will understand this approach.

Please do not edit this page while it is being worked on i.e. while this message is still here.


Introduction

Data gathered by CMX is stored locally in the database (see e.g. dayfile and standard logfiles and a range of ini files, Extra Sensor files, Airlink logfiles etc...). To make these data - and calcu;lated derivatives - available to the user CumulusMX (CMX) uses a system of Webtags. In short, a Webtag is a symbolic name which is translated into a value when asked by CMX. So e.g.:

 temp  -> (process) -> 17.1

The webtags can have modifiers to change the output or the input e.g. you can change the decimal point to a comma (output modifier). All these will be described below (or in a sub-page)

For using Webtags see below

List of all tags

The local List

From version 3.12.0 the complete list of Webtags can be generated from your running CumulusMX instance.

Goto the interface. In the menu go to Program settings=>General options, tick List web tags. The next time that MX is restarted, it will create a file called WebTags.txt in the same folder as where the executable is found. Unticking that parameter will have the inverse effect.

The WebTags.txt file will list all the tags your build of Cumulus can currently handle. This list only contains the bare tag_names. Parameters and modifiers will need to be looked up and added to make use of these. This list can be of use if you are using the tags to create your own program or website while interfacing with CumulusMX. It is useful to save it now and then with the CMX version nr in its name. This will make it possible to find the new tags easily through making a difference.

The full List

The full list of Webtags carries a lot of additional information so it has its own Webtag page.

Using Webtags

There are the following methods to ask CMX to do this translation both of which will be discussed below (or in a sub-page). The two methods are:

  1. Processing files through the running instance of CumulusMX
  2. Getting the value by using the local interface GET method.
  3. Getting the values through the local interface POST method

The first method is used in files used as input for the Extra Web Files in CMX which are then processed by CMX if you tick process The output file then contains the value.
The second and third method's principal use is to be used programmatically from anywhere you can reach the CumulusMX machine.

NOTE: it is not possible to give Webtag modifiers by using the get method but it is in the POST method. Check out the differences in the above links.

There are two bonus methods for getting values out of the CMX database:

  1. Getting predetermined data (not really with Webtags)
  2. Using MySQL through the Custom Upload feature

The predetermined methods and the SQL methods are really for programmers.

The local API methods are described on their own page.

Processing files

The oldest, most common and possibly the easiest method for using webtags is processing a file (e.g. a HTML web page or a PHP script) which contains a webtag description like <#temp rc=y>. After processing the output file then contains the value (e.g. 17.1) for that webtag and the complete description, including the brackets have then disappeared.

The configuration should look like the screenshot below:

Extra Webfiles config.jpg



MySQL

In the MySQL settings of the Interface there exists the possibility to create Custom Upload queries. This is n ot the place to treat the use of MySQL extensively, but CumulusMX offers the possibility to use Webtags in such a Custom Upload query definition. The example below should calrify:

 INSERT IGNORE INTO `test_daily_summary` (`MaxRainRate`, `LogDate`, `RollOver`) VALUES ('<#rrateTM>', '<#metdateyesterday format=yyyy-MM-dd>',  '(1 * SUBSTRING(<#rollovertime>,0,2))');

Again, the modifiers are discussed below.

Webtag modifiers