5,838
edits
m (→Where to use) |
m (→Today: Snow explanation rewritten to emphasise C1 and MX differences) |
||
(20 intermediate revisions by 2 users not shown) | |||
=What this article covers =
#At the last count, a 3.5.x version of MX produces ''nine and a half million'' '''web tags'''!
# Those millions of web tags can actually produce billions of different outputs!
#But the file mentioned in previous section contains just 717 items (at 3.5.0, later versions of MX raise this count by another forty tags or so).
#How come this discrepancy?
*Well each web tag has the general format <tt><#tag_name optional_input_parameter optional_output_parameter></tt> and it is adding
*Adding all possible different output parameters generates the billions of different outputs!
Consequently, this article describes:
*Over 7 hundred web tags -'''THIS ARTICLE MAY NOT CONTAIN ALL WEB TAGS AVAILABLE IN LATEST VERSION - It depends on someone updating this article if the developer does not have time to do so'''
*A score of input parameters that modify some of those tags (meaning some web tags can represent 12 different months for example)
*The components that make up output parameters
** some control number of decimal places
** one controls whether decimal comma (if used) is replaced by decimal point (useful for some script languages)
**the majority modify the output from almost all web tags that report a time and/or date (there are so many ways to represent times and dates this multiples up the available output considerably)
*The way that some of those date modifiers are used for naming NOAA reports (a simple, but useful table)
The tables below are not able to indicate which of the billions of combinations possible are valid or invalid for
==Applicability by version and build==
The tip at the start of this article tells you how to check which tags are available in whatever build of Cumulus you are actually using. Given how often a new release alters either what web tags are available or what parameters can be used with particular web tags, it is
Because Cumulus 2 is no longer available, it has been ignored in the tables below. It never really worked for web page generation, so if you happen to have installed Cumulus 2 from when it was available, you probably don't care which web tags it supports.
[[File:Badge v1.png]]This badge is used to highlight text that applies to Cumulus 1.
===Inconsistency in use of "T"===
*
**The lack of a "T"
**This is particularly confusing and is why you must look up today, and all-time, tags in the tables in this article.
*The time-stamp tags add a "T" to the corresponding web tag for the value, but in an inconsistent way:
**the T is a prefix sometimes and
**the T is a suffix sometimes
**This is particularly confusing and is why you must look up time-stamp tags in the tables in this article.
===Choosing script variable names derived from tag names===
For web tags it is much more complicated, simply because it is not just month we may be representing, and we might require only one specifier (being careful whether we use a standard or custom modifier) or we might want to specify a combination of modifiers (and we might want to add a space character or other literals). It is difficult to summarise, but here are some potential issues:
* the reserved characters
* MX introduces the concept of escaping characters (a '''\''' placed before a character can be either a control sequence or an instruction to display the character)
* MX is inconsistent e.g. '''format=d''' gives a different result depending on the tag it is applied to (e.g. the script conditional ''''<#metdateyesterday format=d>' == '<#yesterday format=d)>'''' will never be equal as the LHS returns a full date and the right hand side returns day of month only)
* in MX space in some cases may need to be within the single quotes containing other literals (as in MX space can change the interpretation of a modifier character).
'''Confused even more now?''' I'm not surprised, but maybe some examples will help before we actually list the available modifiers.
|ddddd
|d (as single character format)
|{{Version badge 1}}Cumulus 1.x.y: Displays the date using the format given by the Short Date format. [[File:Badge vMx.png]]
|e.g. '22/03/2019' (British Locale) produced by {{Version badge 1}}<#metdate format=
[[File:Badge vMx.png]]<#metdateyesterday format=d> ''but not'' <#yesterday=d> which would return just '22'
|-
|dddddd
|-
|(not available)
| zzz
|Displays the offset of any time from UTC in hours and minutes
| e.g.-07:00
|-
== "GET" approach ==
You may have used GET as an attribute when defining the action of a HTML form. Equally you might in a script language access the query-string part of a Universal Resource Locator to get parameters for what the script is to supply to the web page. Even if you don't understand the meaning of those technical terms, you probably have seen when using a browser (in the box where a URL is entered) that sometimes the URL seen there has a query-string. You will have seen a question mark (?) followed by one or [separated by ampersand (&)] more '''name=value''' parameters.
The GET approach to using the Cumulus general api works in this way indicating the start of a query-string with a question mark and using ampersands to separate names. The difference is that a tag name (or list of tag names) is used instead of a name=value parameter (or list of name=value parameters). However, when the Cumulus api returns the values they will be in attribute=value format. Therefore if (like example below) you are coding in JavaScript, what is returned is a JavaScript Object and you extract the values by specifying the Object name and the Attribute name. If that technical terminology confuses you, look at the example.
===Selecting values using GET===
Suppose you want to get the values for the following three web tags:
The first parameter is '''rc''' to indicate that the tags that follow are to use decimal points not decimal commas, which is how many script languages expect to see values.
Remember that in
# <#temp rc=y>
# <#hum rc=y>
# <#dew rc=y>
Since '''rc=y''' can be applied to several web tags that don't appear in [[Webtags#No_Commas]] table, this shows how the api can access values without commas for
If you are using the api in a context where it does not matter if decimal commas or decimal points are in the api or for any tags that don't report in real numbers, simply omit the '''rc''' as first item, and just include tag names separated by ampersands.
=== JavaScript example ===
Some people might feel the admin interface could be improved on some of its pages by showing additional information. It is possible from MX 3.7.0 to obtain extra information.
I wanted to improve the log file editing pages, and that was partly by adding validation, and partly by changing the way the editing is done. For the standard log file editor I wanted to achieve even more, I added a script to calculate (and recalculate after any edit) the derived fields from the source fields. To make these calculations work for anyone, I needed to find out what units the Cumulus MX user is using. Before 3.7.0 release the snippet of script that obtained the units via various api calls was quite complex (I described above how the api returned lots of unwanted content), but with 3.7.0
Here is the code (with the api call written using jQuery):
*The jQuery get request takes the api URL as first parameter and the function to deal with the returned result as third parameter
*The middle parameter is irrelevant in this context as only one object instance is returned, but if the qet was returning multiple results, "limit=1" would only return the first result
*The function takes as its sole parameter an Object (a JavaScript Object is a collection of properties), this is what is returned by the api,
*In JavaScript if a variable is defined outside the function, then given a value inside the function, that value can be accessed by later code outside the function (in my case by code within the other functions for calculating each derived value)
*We are only interested in 3 of the '''property_name = property_value''' items in the Object.
*
*The console.log command simply outputs all the items in the list within the brackets into the browser console that in many browsers is displayed by selecting '''F12''' on the keyboard. I included this instead of the lengthy rest of my code that uses the units to do the various calculations correctly.
== "POST" approach ==
The word "Post" in a computer environment means that the Hypertext Transfer Protocol (HTTP) used by the internet is being asked to transfer information enclosed in the body of the request message. Put slightly less technically in this approach you produce a text file with the details of what tags you want and send it to the api server. I suppose it is a bit like sending an email, its header (subject, author, date sent) is easy to view, but you need to open it to see what text is in the body.
You may have used POST as an attribute when defining the action of a HTML form. In that context the form is sent as the contents of a message to whatever web page is going to process the contents of that form.
The post approach has a few advantages over get:
*The parameters are not shown in
*If you fill out a form online, the post approach will be used as the content needs to be kept secure.
**The get approach may be seen when you are navigating through a web site, and a selection is being remembered.
*The POST approach can handle very long requests and return a lot of information.
**In contrast, a URL with query-string is restricted in total length (the restriction is dependent on a number of other factors, but might be at something like 1000 characters in total), so GET comes with a restriction on how many parameters can be specified.
See https://cumulus.hosiene.co.uk/viewtopic.php?p=145050#p145050 for post example
=The Web Tags for Cumulus =
|If you have an RG-11 rain sensor configured in "Tipping Bucket" mode, this gives today's rain total so far according to the sensor
| n/a
|-
|<#snowdepth>
|Meteorologists report snow depth in cm, so this is default unit for Cumulus. If there is an entry in the Weather Diary for Today's date, and current time is between the '''SnowDepthHour''' time (in [[Cumulus.ini#Section:_Station]], default is 9 a.m. for Cumulus 1, and midnight for MX) and subsequent midnight, returns the value set there for depth. Returns 0 otherwise. If time before '''SnowDepthHour''', looks at previous day's date in Weather Diary and reports any non-zero value there, otherwise reports zero.
{{Version badge 1}} Input and output is always as integer. Available from very early builds, weather diary input amended from version 1.8.6 14th April 2009 to allow units to be specified on diary edit screen. If you choose to enter as whole millimetres, you can use JavaScript (or another script language) on your web page to divide the web tag by 10 and get centimetres to 1 decimal place on output.
[[File:Badge vMx.png]] Input is to 2 decimal places. Available from version 3.1.1 - build 3054 when weather diary editor was added to MX. MX allows output in centimetres with decimal places without any script. You can't change the units shown in admin interface, but your value can be input as inches to 2 decimal places if you ignore "cm" that is displayed in that interface.
| n/a
|-
|<#snowlying>
|{{Version badge 1}}Although this tag is not available in Cumulus 1, your web page can use a script to check if <#snowdepth> is non zero, as that means snow is lying
[[File:Badge vMx.png]] Available from version 3.1.1 - build 3054. If there is an entry in [[Weather Diary]] for Today's date, and (if '''SnowDepthHour''' time (in [[Cumulus.ini#Section:_Station]] is defined) current time is between the Snow update time (in [[Cumulus.ini]]) and midnight, then this web tag returns zero if snow lying check box not ticked or one if checkbox is ticked. If no Weather Diary entry found, this web tag returns Null.
| n/a
|-
|<#snowfalling>
|{{Version badge 1}} Not available in Cumulus 1. There is no web page workaround, unless you write a script that reads [[Weather Diary]] and makes relevant information available on your web server.
[[File:Badge vMx.png]] Available from version 3.1.1 - build 3054. If there is an entry in [[Weather Diary]] for Today's date, and (in [[Cumulus.ini#Section:_Station]] is defined) current time is between the Snow update time (in [[Cumulus.ini]]) and midnight, then this web tag returns zero if snow falling check box not ticked or one if checkbox is ticked. If no Weather Diary entry found, this web tag returns Null.
| n/a
|-
|colspan="3" style="background:lightgray;"|Pressure
!style="width:600px" |Function
|-
|1.9.2 onwards and MX
|Total number of data packets received.
|-
|1.9.2 onwards and MX
|Number of missed data packets. From version 3.6.0 build 3076, optionally add "tx=n" parameter, where n=1-8 and equals the desired transmitter id.
|-
|1.9.2 onwards and MX
|Longest streak of consecutive packets received. From version 3.6.0 build 3076, optionally add "tx=n" parameter, where n=1-8 and equals the desired transmitter id.
|-
|1.9.2 onwards and MX
|Number of packets received with CRC errors. From version 3.6.0 build 3076, optionally add "tx=n" parameter, where n=1-8 and equals the desired transmitter id.
|-
|1.9.2 onwards and MX
|Number of times the console resynchronised with the transmitter
|-
|1.9.2 onwards and MX
|The console firmware version
|-
|1.9.x
|A derived temperature using Temperature/Humidity/Wind values read from Davis DLL in Cumulus 1.9.x.
*Available from 1.9.2 Build 1009 (Aug 2011).
|-
|(1.9.x and) MX
|A heat stress indicator using Temperature/Humidity/Solar/Wind values.
#Cumulus MX reads "LOOP2" packets, and the correct value for this tag can be read there and displayed on 'Now' template.
|-
|1.x.x and MX
|The console battery condition in volts. eg "4.82v"
|-
<#txbattery channel=1>
|1.8.9 onwards and MX
'''Cumulus 1.9.3 onwards Only:''' The optional 'channel' parameter returns the status for a particular transmitter, up to channel=8. The channel result is just the string "ok" or "LOW" for a low battery
|-
|1.x.x and MX
|The console 'storm rain' current amount (build 1090 onwards for Cumulus 1; 3021 onwards for MX)
|-
|1.x.x and MX
|The console reported '''date''' of the start of the 'storm' (the console does not report start time, but it appears a minimum of 2 tips within 3 hours will trigger a storm start, so using <#LastRainTipISO> in a script might help), but standard Cumulus [[Webtags#Time.2FDate_.27format.27_Parameter| date/time formatting]] can be applied to that date.
|WLL RSSI of Transmitter #1 (replace 1 by any other transmitter number up to 8)
|}
=== Davis AirLink ===
New from version 3.9.0. Not available for earlier MX, not available for Cumulus 1.
Note, that you can configure an Indoor or Outdoor (or both) AirLink, most people will use an outdoor. There are a similar set of tags for each device.
{| class="wikitable" border="1"
|-
!style="width:150px" |Web tag_name
!style="width:600px" |Function
|-
|colspan="2" style="background:lightgray;"|Particulate Matter
|-
|<#AirLinkPm1[InǀOut]>
|Current PM 1.0 count
|-
|<#AirLinkPm2p5[InǀOut]>
|Current PM 2.5 count
|-
|<#AirLinkPm2p5_1hr[InǀOut]>
|Last hour average PM 2.5 count
|-
|<#AirLinkPm2p5_3hr[InǀOut]>
|Last 3 hours average PM 2.5 count
|-
|<#AirLinkPm2p5_24hr[InǀOut]>
|Last 24 hours average PM 2.5 count
|-
|<#AirLinkPm2p5_Nowcast[InǀOut]>
|The 24 hour "nowcast" weighted average PM 2.5 count
|-
|<#AirLinkPm10[InǀOut]>
|Current PM 10 count
|-
|<#AirLinkPm10_1hr[InǀOut]>
|Last hour average PM 10 count
|-
|<#AirLinkPm10_3hr[InǀOut]>
|Last 3 hours average PM 10 count
|-
|<#AirLinkPm10_24hr[InǀOut]>
|Last 24 hours average PM 10 count
|-
|<#AirLinkPm10_Nowcast[InǀOut]>
|The 24 hour "nowcast" weighted average PM 10 count
|-
|colspan="2" style="background:lightgray;"|AQI Values
|-
|<#AirLinkAqiPm2p5[InǀOut]>
|Current PM 2.5 AQI value - allows use of the "dp=n" and "tc=y" parameters
|-
|<#AirLinkAqiPm2p5_1hr[InǀOut]>
|Last hour average PM 2.5 AQI value - allows use of the "dp=n" and "tc=y" parameters
|-
|<#AirLinkAqiPm2p5_3hr[InǀOut]>
|Last 3 hour average PM 2.5 AQI value - allows use of the "dp=n" and "tc=y" parameters
|-
|<#AirLinkAqiPm2p5_24hr[InǀOut]>
|Last 24 hour average PM 2.5 AQI value - allows use of the "dp=n" and "tc=y" parameters
|-
|<#AirLinkAqiPm2p5_Nowcast[InǀOut]>
|Last 24 hour "nowcast" weighted average PM 2.5 AQI value - allows use of the "dp=n" and "tc=y" parameters
|-
|<#AirLinkAqiPm210[InǀOut]>
|Current PM 10 AQI value - allows use of the "dp=n" and "tc=y" parameters
|-
|<#AirLinkAqiPm10_1hr[InǀOut]>
|Last hour average PM 10 AQI value - allows use of the "dp=n" and "tc=y" parameters
|-
|<#AirLinkAqiPm10_3hr[InǀOut]>
|Last 3 hour average PM 10 AQI value - allows use of the "dp=n" and "tc=y" parameters
|-
|<#AirLinkAqiPm10_24hr[InǀOut]>
|Last 24 hour average PM 10 AQI value - allows use of the "dp=n" and "tc=y" parameters
|-
|<#AirLinkAqiPm10_Nowcast[InǀOut]>
|Last 24 hour "nowcast" weighted average PM 10 AQI value - allows use of the "dp=n" and "tc=y" parameters
|-
|colspan="2" style="background:lightgray;"|Stats Values
|-
|<#AirLinkPct_1hr[InǀOut]>
|Percentage of possible values that were included in the 1 hour averages
|-
|<#AirLinkPct_3hr[InǀOut]>
|Percentage of possible values that were included in the 3 hour averages
|-
|<#AirLinkPct_24hr[InǀOut]>
|Percentage of possible values that were included in the 24 hour averages
|-
|<#AirLinkPct_1hr[InǀOut]>
|Percentage of possible values that were included in the 24 hour weighted averages
|-
|colspan="2" style="background:lightgray;"|Sensor Info
|-
|<#AirLinkFirmwareVersion[InǀOut]>
|Shows the AirLink firmware version as a date string.
NOTE: This web tag requires a WeatherLink Pro subscription to work
|-
|<#AirLinkTemp[InǀOut]>
|The sensors internal temperatue value
|-
|<#AirLinkHum[InǀOut]>
|The sensors internal humidity value
|-
|<#AirLinkWifiRssi[InǀOut]>
|The sensors WiFi signal strength in dB - anything below -90 is considered very poor.
NOTE: This web tag requires a WeatherLink Pro subscription to work
|}
===Fine Offset===
|
edits