MX on Linux and Webtags/Parameters (preserving history): Difference between pages
m (→Preparing for an install: mention "free -m") |
m (→Which tag names take date/time output formatting modifiers: add 'StormRainStart') |
||
| Line 1: | Line 1: | ||
{{Template: |
{{Template:Version badge Mx}}{{Version badge 1}}This Wiki page applies to both flavours of Cumulus currently available. |
||
=Introduction= |
|||
'''This page focuses on aspects of MX that are specific to the Linux operating systems.''' |
|||
This page is about parameters used for modifying Cumulus web tags. |
|||
If you are running MX on on any computer running the Microsoft Windows Operating System, then you should be reading the [[MX on Windows OS]] page instead. |
|||
A [[Cumulus template file|'''Cumulus Template File''']] is the name given by Steve Loft to any files that contain web tags. Each of those files need to be processed before they actually include values: |
|||
{{TOCright}} |
|||
* MX avoids using these template files, the code itself internally generates most of the data files that are sent externally. |
|||
=Page Content= |
|||
* The legacy Cumulus 1 software, and MX releases up to release 3.9.7 - build 3107, used lots of template files (see [[Customised templates]]. |
|||
For Cumulus MX, there is still one Cumulus template file, the web tags that supply values to the various tables in the [[New Default Web Site Information|Default Web Site]] are stored in [[websitedataT.json]] file. Most of those web tags use the default output format, but a few use some of the [[#Output modification parameters]] listed below. To customise the default web site, you might want to edit '''websitedataT.json''', by using information found on this page. |
|||
This page: |
|||
* describes the options available for installing MX, and the other Cumulus packages |
|||
* describes the pre-requisite '''MONO''' software needed to run the various Cumulus executables, (for Raspberry Pi only), how to add the Mono repository to your system, and how to upgrade MONO |
|||
* explains the few key Linux commands it uses |
|||
* describes the administrative interface and instructions for configuring MX |
|||
* it tries to be useful to anyone who has never used MX, and anyone who knows Cumulus, but has not run MX on Linux before |
|||
* describes the various options available to run MX |
|||
* describes the optional parameters you can add when starting MX |
|||
* describes the other executables |
|||
To set context, let us learn the terminology with cross-references to where those features are explained further. |
|||
There are various related pages to get more information: |
|||
*Go to [[:Category:Terminology]] for links to pages that explain terminology used by Cumulus (some of these need updating for MX) |
|||
*Go to [[:Category:Cumulus MX]] for links to all pages in this Cumulus Wiki that relate specifically to MX |
|||
*[[MX Administrative Interface|Admin interface]] provides information on configuration and web pages for viewing your weather data locally |
|||
*Go to [[:Category:Cumulus Files]] for links to all pages describing the sub-folders and files used by MX |
|||
*If you encounter a problem when running MX, see [[What to do when I have a problem with MX]] |
|||
*The [[Cumulus MX FAQ]] page was created with snippets from the forum, but nobody has yet sorted this out into a useful page or updated it for recent releases |
|||
*If you were using the original (now legacy) Cumulus software, please read [[Migrating_from_Cumulus_1_to_MX]], although that is mostly directed at those using MX on the same Windows PC as they used for Cumulus 1, and was written for an old MX release, it will help you understand configuration differences. |
|||
*If you want to use a script language, you might want to read [[PHP|PHP Hypertext Pre-processor and JavaScript]] page |
|||
==What is a web tag? == |
|||
=Using MX on UNIX-derived Operating Systems= |
|||
Put simply, a [[Webtags|web tag]] is included in a [[Cumulus template file]] to indicate where Cumulus should insert values when it [[Customised_templates#What_is_meant_by_.27Cumulus_processes_templates.27|processes that template]] and produces an output file. |
|||
MX runs on any UNIX-derived operating systems (OS): |
|||
* including those found on Apple Mac computers, |
|||
* and those found on a multitude of devices running Linux. |
|||
The output file can be: |
|||
UNIX is a long established operating system, and both UNIX and its derivatives have good long term compatibility. This means that commands are generally easy to learn and use. Most devices also have a graphical user interface that can do the more straightforward tasks without needing to know all the commands. |
|||
* a [[Customised_templates#HTML_5_-_a_very_quick_guide_to_structure|web page]], |
|||
* a [[Php_webtags#Option_3:_JavaScript_Object_Notation|JavaScript Object Notation (.json) file]] |
|||
* a [[Feels_Like#HTML_code_to_translate_web_tags_to_JavaScript_variables_.28as_modified_for_additional_parameters.29|JavaScript file]], |
|||
* a [[PHP]] script file, or |
|||
* a [[Xml_webtags|eXtensible Mark-up Language (XML)]] file. |
|||
==General Format for Web Tags== |
|||
==Device Coverage== |
|||
In the position in the template file where Cumulus is to insert the relevant data, place a web tag in the '''general format''' specified here: |
|||
Linux is available based on a multitude of different kernels (the building block for the operating system), on a multitude of devices. |
|||
<code><#tag_name [optional input selection parameters] [optional output modification parameters]></code> |
|||
It is hoped that contributions to this page will be made by Cumulus users with a range of such devices. The page has been originated by a contributor using the Raspberry Pi Operating System (this is based on Debian, one of the Linux kernels). Where appropriate, this page gives instructions specific to a [[Raspberry Pi computer page|Raspberry Pi computer]]. |
|||
==== Case sensitivity for tag names ==== |
|||
:Until somebody creates a separate page for Apple Mac computers (that would be a good idea), this page is the closest. |
|||
The tag_name in the general format above is case sensitive, so please type the tag name exactly as shown in the tag name columns in the tables on the [[Webtags|tag names page]]. |
|||
==What do people think about MX on Linux?== |
|||
== What is a web tag parameter?== |
|||
Contributions to the [https://cumulus.hosiene.co.uk/viewforum.php?f=40 Cumulus Support Forum] suggest that: |
|||
*Use on a Raspberry Pi (RPi) computer is very popular |
|||
*In general, people find installing, and running, MX on Linux is easy |
|||
*The few people who do have difficulties are those who have good knowledge of Microsoft systems and feel scared to swap to something different. |
|||
Now we get to the terminology for what this Wiki page will document. |
|||
Microsoft has had a deliberate policy of being different to traditional computers mostly based on UNIX, and the [[MX_on_Windows_OS|Running Cumulus MX on Microsoft Windows]] page covers those aspects of MX that are specific to Personal Computers running Microsoft's Windows Operating System. |
|||
The parameters shown in the general format above are of two kinds: |
|||
In the Cumulus support forum, there are many posts from people who are struggling with MX on PCs, as it seems people often find “installing”, and using, MX is more difficult when using Microsoft Windows. |
|||
# Input modifying |
|||
# Output modifying |
|||
You can include both optional input modification, and optional output modification parameters |
|||
=For those using Raspberry Pi computers= |
|||
* As the general format above shows, you separate them with spaces, e.g. <#ByMonthTempHT mon=7 format=hh:nn>. |
|||
** In that example, the time only is returned for the highest ever temperature in July, after processing by Cumulus of the time-stamp web tag. |
|||
=== Case sensitivity for parameters === |
|||
You have two choices: |
|||
The optional input modification parameters always use lower case, so please type them exactly as shown in the [[#Input modification Parameters|section below]]. |
|||
CHOICE ONE: ‘’’Create a micro-SD card that has everything on it to load a kernel onto your computer and run MX’’’ |
|||
The content of optional output parameters are only case insensitive when used in Cumulus 1. |
|||
The developer has created [[Software#Raspberry_Pi_Image|an image you can download]]. |
|||
For Cumulus 2 and later, so this includes MX, the output parameters are case sensitive and also dependent on what other output formatters are being used if any, so please read the sections on output parameters and study the examples in the tables carefully. |
|||
That image contains: |
|||
#Raspberry Pi Lite Operating System as kernel (no graphical user interface, designed for a RPi without keyboard or monitor) |
|||
#Mono-complete package |
|||
#Cumulus MX package |
|||
= Input modification Parameters = |
|||
* If you are new to MX, after booting from image, you will need to use the [[MX_Administrative_Interface#Station_Settings|admin interface]] to define station type, your choice of units, and some other settings, before MX can start recording data from the connected weather station. |
|||
* If you are migrating from another computer, after booting from image, you need to add (using an external memory stick or file transfer from your other device to the RPi), the following: |
|||
** (mandatory) [[Cumulus.ini]], |
|||
**(optional) [[strings.ini]], |
|||
**(mandatory) all files from old [[Data_folder|data sub-folder]], |
|||
**and any (optional) files from old Reports sub-folder. |
|||
'''Most web tags do not require any input parameters'''. Luckily, where they are needed, it is quite simple to use them, see table below. |
|||
If you want to pursue that approach, please read [[Raspberry_Pi_Image]] page, instead of continuing to read this page. Obviously, you can return to this page if you want to learn more. |
|||
* An input parameter is used where the same web tag can represent a value for a number of different past time instants. |
|||
CHOICE TWO: ‘’’Load the software packages individually’’’ |
|||
* Each of those past time instants is represented by a different value for the input parameter. |
|||
* So a combination of web tag name and input modification parameter lets Cumulus select the value you want to see. |
|||
Please read on, this page will tell you all you need to know. |
|||
* The web tags that can use input modification parameters will depend on which Cumulus release you are using |
|||
= Do you have a Operating System? = |
|||
New hardware might come preloaded with an operating system, or might allow you to choose which operating system to install on it. |
|||
Please see [[Raspberry Pi computer page]] if you want guidance on choosing which model to buy and how to install an operating system on those computers, so you are ready to install MX. |
|||
=Do you know how to install packages?= |
|||
If you already know how to install packages, your computer has the pre-installed image, or you have installed MX before, you will want to skip the sub-sections that follow on here, and continue reading at [[#Cumulus packages]]. |
|||
Otherwise, here is a short technical digression to explain the commands. |
|||
==The various components to commands for installation== |
|||
Linux computers have a “source list” which references the repositories from which software packages can be installed. |
|||
If a particular package can not be found in repositories already in the source list, then another repository can be added to the source list. |
|||
===sudo=== |
|||
By default, a Linux user will log in as a default user with limited rights. For example, on the Raspberry Pi Operating System, there is a single default user, initially called "Pi", with their home folder that can be referenced as "~". |
|||
The initial "sudo" part of many commands gives us super-user (root) rights when executing the instruction that follows. |
|||
If we are working away from the folder(s) owned by the default user, we can consider whether we want to change the ownership of these parts of the file system (how to do this for a MX installation is explained later) so that we can access the files with our default user without using "sudo" for file/folder commands. |
|||
In some limited cases, it might make sense to just change "read" rights,so that the default user can read a file/folder, but other actions are not possible without using "sudo" prefix. This limits our ability to accidentally delete files that other processes need. |
|||
===apt=== |
|||
The second part of our installation commands is “apt” meaning “Advance Package Tool”. In simple terms, it runs the “package manager” used in Linux. |
|||
If you are looking online for a tutorial on how to install packages, you might see “apt-get” or "apt-cache" used in examples they quote. It should be safe to replace these older package managers with "apt". I have included a little technical explanation at the end of this page if this really worries you. |
|||
===install=== |
|||
The third part of our installation instruction is “install”, which tells our package manager what we are trying to do. |
|||
For the record only, here is full list of what can follow “apt”: |
|||
{| class="wikitable" border="1" |
{| class="wikitable" border="1" |
||
|- |
|- |
||
!style="width: |
!style="width:15px" | Tag names |
||
!style="width: |
!style="width:100px" | Values Available |
||
!style="width:200px" | Input Modification Parameters |
|||
|- |
|||
!style="width:60px" | Introduced |
|||
|install |
|||
!style="width:500px" | Examples |
|||
|To install a package and its dependencies |
|||
!style="width:900px" | Description |
|||
|- |
|||
|update |
|||
| The "source list" [[#The various components to commands for installation|mentioned earlier]] that references the repositories from which software packages can be installed, needs to be updated periodically so it reflects any changes within those repositories. The instruction "update" is included after "apt" to make sure your computer has up to date information about repositories installed, and to report if these contain packages that can be upgraded |
|||
|- |
|||
|upgrade |
|||
| Once your "source list" is up to date, the instruction "upgrade" can be included after "apt" to download any newer versions now available in repositories, and to replace those packages that are already installed on your computer with those newer versions |
|||
|- |
|- |
||
! scope="row"| Tag names listed at [[Webtags#Table of Recent History tag names available|'''Table of Recent History tag names available''']] (see [[Recent history]] page for explanation) |
|||
|autoremove |
|||
| One value for each minute in last 7 days |
|||
| The instruction "autoremove" can be included after "apt" to check all components in the packages you have installed onto your computer, and remove any components that are not needed by the dependencies of the packages you are using. A download for software frequently includes some components specifically for their software to work with particular other optional packages. |
|||
| '''d''' specifies number of days ago, |
|||
'''h''' specifies number of hours ago, |
|||
When we install mono-complete later, the other packages we install do not need every component that has installed, and “autoremove” can be used to tidy up when all our installations are finished. |
|||
and '''m''' specifies number of minutes ago. |
|||
* You can use any combination of the three parameters. |
|||
* The same d, h, and m, parameters are used by Cumulus 1 and MX. |
|||
| Cumulus 1.9.3 beta build 1033 (remain available in MX) |
|||
| Examples for outside temperature: |
|||
* <#RecentOutsideTemp m=1> will give the temperature one minute ago, <#RecentOutsideTemp h=1> will give the temperature one hour ago (as will <#RecentOutsideTemp m=60>). |
|||
* <#RecentOutsideTemp d=1> will give the temperature one day ago. |
|||
* <#RecentOutsideTemp d=1 h=1 m=1> will give the temperature one day, one hour and one minute ago. |
|||
|All values supplied for parameters must be whole numbers. |
|||
* If you don't supply any parameters, the result is undefined for Cumulus 1, and an illegal web tag for MX. |
|||
* '''Beware: If you use <code><#RecentRainToday d=2></code> remember that rainfall can accumulate during a day, so "d=2" returns an estimate of the rain between rollover 2 days ago and the same time as now 48 hours ago, it does not return the total rainfall 2 days ago! |
|||
* ''''''Please note:''' Some Cumulus users say that using <#RecentOutsideTemp d=1 m=1> is more reliable at getting the temperature at a similar time the day before, the extra minute apparently gives better results when you might not be using Cumulus all the time, or your weather station might have some drift on when it supplies readings. See which works best for you. |
|||
|- |
|- |
||
! scope="row"| [[Webtags#Monthly_All_Time_Records|'''monthly all-time extreme records''']] |
|||
|remove |
|||
| These exist for all occurrences of the current month, and for all occurrences of each month |
|||
|If you want to remove just one component manually, after "apt", use “remove” followed by the name of component you no longer want |
|||
| '''mon=N''' |
|||
|- |
|||
|purge |
|||
| To remove any installed package and delete all related configuration files, after "apt" type "purge" then the name of the package we no longer want |
|||
|- |
|||
|search |
|||
|To search in repositories in source list for a package you specify after “search” |
|||
|- |
|||
|show |
|||
|To show any information available about a package that you name after the “show” |
|||
|} |
|||
where N is the index of the month of the year that you want the value for (1 =January, and so on, to 12 =December) |
|||
=== Flags === |
|||
| Cumulus 1.9.3 beta build 1033 (remain available in MX) |
|||
| <#ByMonthDewPointH mon=3> is highest monthly dew point for any March and <#ByMonthDewPointHT mon=3> is the related time and date. |
|||
<#ByMonthTempH mon=3> gives highest temperature in any March, <#ByMonthTempHT mon=3> gives the date and time for that highest temperature |
|||
The basic syntax is either one or two hyphens, followed by one or two letters (each letter has to be a specific case). Various examples will be seen on this page, but here just one is explained here. |
|||
| Only one input parameter applies: |
|||
* The value of "N" supplied should be an integer between 1 and 12 |
|||
* If you don't supply an input parameter (or supply an invalid value like zero) the current month will be used. |
|||
Use without an input parameter applies if you want to write a template that will always supply values for the current month and don't want to process a script, to calculate the correct input parameter, before Cumulus processes the template. |
|||
If we selected "install" or "upgrade" to follow "apt", we can add a “-y” flag to signify that we want the install to continue. Without this flag, the package manager will ask periodically if we want it to continue, and we have to then respond with a “y” each time. For example, when we ask to install a package, "apt" will do a search, it will list what components it has found, and output how big their demands are on storage, without "-y" flag, it will then ask (at least once) if it is okay to continue to installing. |
|||
|- |
|||
! scope="row"| [[Webtags#Monthly|Only <#SunshineHoursMonth>]] and [[webtags#Yearly|Only <#SunshineHoursYear>]] |
|||
| Values available for current month/year, and for past month/year |
|||
| Listed web tags take: '''r=-ww''' (note minus sign and up to 2 digits) |
|||
* Monthly tags also take: '''m=N y=nnnn''' ('''N''' can be 1 to 12, ''nnnn'' is 4 digit year) |
|||
* Yearly tags also take: '''y=nnnn''' |
|||
Omit input modification parameter to get value for current month/year |
|||
| MX release 3.12.0 |
|||
| Monthly examples: |
|||
* <#SunshineHoursMonth> gives total sunshine hours since 1 minute past midnight at start of current month |
|||
* <#SunshineHoursMonth y=2021 m=1> for the January 2021 total |
|||
* <#SunshineHoursMonth r=-1> for last month's total |
|||
* <#SunshineHoursMonth r=-12> for same month as current month, but one year ago |
|||
Yearly examples: |
|||
* <#SunshineHoursYear> gives total sunshine hours since 1 minute past midnight on New Year's Day |
|||
* <#SunshineHoursYear y=2019> for the total for 2019 |
|||
* <#SunshineHoursYear r=-2> total for the year before last (if current year is 2021, that returns total for 2019 as previous example) |
|||
| Returns the sunshine hours total in selected period |
|||
(You need a sensor to be monitoring this throughout selected period) |
|||
=== Name === |
|||
|} |
|||
= Output modification parameters = |
|||
The final part of the package command is the name of the package or component that we want to install/upgrade/purge/show/remove or search for. |
|||
This page does not tell you which web tags fall into each of these 3 types: |
|||
=Install starts here= |
|||
* A few web tags always need an output format specifier |
|||
* Some web tags ignore any output format specifier as they have a fixed output format |
|||
* The majority of web tags have a default output if there is no output format modifier, but accept an output format parameter, so you can change what they output. |
|||
To make life more complicated, the availability of output format parameters for particular web tags is dependent on which Cumulus release you are running. There is a general [[Webtag_Applicability|discussion about applicability]], but that needs updating as it does not specify dependencies for individual [[Webtags|web tags]]. |
|||
If your computer has the pre-installed image, or you have installed MX before, you can skip the sub-sections that follow on here and continue reading at [[#Cumulus packages]]. |
|||
If you are using MX: |
|||
== Preparing for an install== |
|||
* if your locale specifies that integer and decimal parts of real numbers are separated by a comma, there is an output parameter to replace that decimal comma by a decimal point for any script that does not recognise decimal commas |
|||
* there are two output modifiers for changing number of decimal places |
|||
* there are multiple output modifiers for changing date and/or time format |
|||
If you are using the legacy Cumulus (or a very early MX release), please skip to [[#Two Output (format modifier) parameters for decimal places]] as the changing decimal comma into decimal point parameter is not available to you. |
|||
Before we do an install of a new package, we typically use this series of commands to ensure our computer is in the best state to work out dependencies of what we are about to install: |
|||
<code> |
|||
sudo apt update |
|||
sudo apt -y upgrade |
|||
sudo apt autoremove |
|||
</code> |
|||
Each of these |
Each of these will be explained in turn. |
||
==Output Modification Parameter for changing any decimal comma into a decimal point== |
|||
If you are installing onto a Pi zero, or similar slow computer, please ensure the size of the swapfile is as big as possible, as the mono-complete we will install is large. In linux, we type <code>free -m</code> to see our RAM size and our swapfile size. |
|||
General format: <tt><#tag_name rc=y></tt> |
|||
To change swapfile size on the Raspberry Pi, you need to edit a file <code>sudo nano /etc/dphys-swapfile</code>. Move the cursor down line by line until it reaches '''CONF_SWAPSIZE=100'''. That is showing that the swapfile is only 99 mb bt default in the Raspberry Pi Operating System. Now move the cursor to the 100, and change it to "512" which is enough for mono even on a Pi zero. Next, stop, and restart the relevant service using <code>sudo /etc/init.d/dphys-swapfile stop && sudo /etc/init.d/dphys-swapfile start</code>. That should complete quickly, and we can type <code>free -m</code> again to see the 99 we saw previously has been replaced by 511. |
|||
This only applies: |
|||
=== USB HID === |
|||
*if the web tag name represents a real number with integer and decimal parts |
|||
*if you are using MX |
|||
There is one more prerequisite package for MX with some weather station types. |
|||
**From beta release 3.0.0, build 3047 (3 February 2019), up to and including release 3.5.3, only implemented on a few new web tags (#MoonPercent, #MoonPercentAbs, #MoonAge) |
|||
**From release 3.6.6 onwards (1 June 2020), it was extended to other web tags that output real numbers. |
|||
The cross-platform [https://www.nuget.org/packages/HidSharp/ Universal Serial Bus (USB) Human Interface Device (HID) library] used by MX to connect to weather stations that appear as a HID connecting via USB (like Fine Offset and USB connected Oregon Scientific models) calls a package file called ''libudev.so.1'', so you may need to [[#install|search]] your Linux computer for this file, and [[#install]] it if it is missing. Alternatively, you might just need a symbolic link where MX looks to where the file is. |
|||
**From release 3.10.5 onwards (29 March 2021), the use of <tt><#tag_name rc=n></tt> became also possible, to ensure decimal comma shown when locale specifies it |
|||
To check your USB devices, type <code>sudo lsusb -t</code). |
|||
To check HID, download this [https://cumulus.hosiene.co.uk/download/file.php?id=11414 USB HID test package] and run it. |
|||
Optionally read about [https://cumulus.hosiene.co.uk/viewtopic.php?f=39&t=14310&p=111593&hilit=libudev.so.1#p111593 Oregon Scientific] issues. |
|||
To read about [https://cumulus.hosiene.co.uk/viewtopic.php?p=107913#p107913 Fine Offset issues and the (file may need to be linked to where MX wants it) file link instructions] |
|||
==Changing the Source List== |
|||
The "source list" [[#The various components to commands for installation|mentioned earlier]] may not contain all the repositories we need for our installations. |
|||
Consequently, type <code>sudo apt search mono-complete</code>, to find out whether the mono package is available from one of the repositories already in our source list, and if the version available is compatible with MX (Release announcements for MX should specify which versions of Mono will work). Each of the parts of that command was explained earlier. |
|||
If mono-complete is not available (or only available in an older version incompatible with MX), then we have to add a new repository, and the one to add depends on which Linux kernel is used by our Operating System. |
|||
There are a number of sub-sections below, please check which applies to you, and only read that one. |
|||
===Add the Mono repository for a Raspberry Pi=== |
|||
The two Mono repositories listed here are specific to the 2017 and 2019 releases (respectively) of the operating system for a Raspberry Pi computer. These are taken from [https://www.mono-project.com/download/stable/#download-lin-raspbian]. |
|||
# the first line (in each case) installs a certificate |
|||
# the echo line defines a repository to add to the sources list. |
|||
This output modification format parameter can be used to replace all commas in the output by a full stop (don't worry, MX does not use a comma for separating off thousands, so it is the decimal comma that becomes a decimal full stop like character when this remove comma specifier is used). |
|||
{| class="wikitable" border="1" |
{| class="wikitable" border="1" |
||
|- |
|- |
||
!style="width: |
!style="width:150px" | Parameter |
||
!style="width: |
!style="width:600px" | Explanation |
||
!style="width:600px" | Example |
|||
|- |
|- |
||
|rc=n |
|||
|<code>sudo apt install apt-transport-https dirmngr gnupg ca-certificates<br> |
|||
|This is the default, so does not need to be specified. The output from the web tag will use either decimal comma or decimal point as specified by the locale in which MX is running |
|||
<br> |
|||
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF<br> |
|||
<br> |
|||
echo "deb https://download.mono-project.com/repo/debian stable-raspbianstretch main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list |
|||
</code> |
|||
|<code>sudo apt install apt-transport-https dirmngr gnupg ca-certificates<br> |
|||
<br> |
|||
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF<br> |
|||
<br> |
|||
For more information about how the computer determines whether decimal commas is your default, see [[#Locale]] section later. |
|||
echo "deb https://download.mono-project.com/repo/debian stable-raspbianbuster main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list |
|||
| Both <#tempYH> and <#tempYH rc=n> will return yesterday's highest temperature using what is specified by locale to separate integer and decimal parts |
|||
</code> |
|||
|- |
|||
|rc=y |
|||
|the attribute '''rc''' takes the value 'y' to replace any commas defined by the locale with full stops to separate integer and decimal parts of the output value. |
|||
| <#tempYH rc=y> will return yesterday's highest temperature as integer part then full stop then decimal part, regardless of local |
|||
|} |
|} |
||
==Add the Mono repository to Ubuntu, Debian, Fedora== |
|||
'''Why would you want to remove decimal commas?''' Well because the JavaScript language cannot understand decimal commas, and MX has several scripts written in this language, equally some third party alternative web pages rely on ajax to update them (and Ajax uses JavaScript). |
|||
At time of writing, [https://www.mono-project.com/download/stable/#download-lin-ubuntu], shows the instructions for versions 16, 18, and 20 of Ubuntu. |
|||
==Controlling the number of decimal places== |
|||
Equally, [https://www.mono-project.com/download/stable/#download-lin-debian], gives details for debian, and [https://www.mono-project.com/download/stable/#download-lin-fedora] for Fedora. |
|||
Internally, Cumulus stores numbers in binary. You cannot represent base 10 decimal places exactly in base 2. |
|||
Others can be found by choosing other tabs on any of those links. |
|||
Therefore, Cumulus stores to a precision that would generally give about 24 significant figures when expressed in base 10. |
|||
== Installing Mono instruction == |
|||
Cumulus is written to assign particular numbers of decimal places to any outputs it makes, and in any logging of current, or extreme values (for day or longer periods). It determines these precisions, by reference to the units chosen for outputs. |
|||
Now we have the certificate needed, and the repository for mono-complete is added to our source list, we can do the actual install: |
|||
: <code>sudo apt install -y mono-complete</code>. |
|||
From release 3.12.0, you can set the default number of decimal places to output for all derivatives of temperature, pressure, etc. by [[Cumulus.ini#Units.2C_Derivative_Options.2C_and_Decimal_Places|advanced settings]]. Those settings can force output as integers, stopping these modification parameters from working. |
|||
The “sudo”, “apt”, “install”, and “-y” have already been explained. |
|||
As handling of each web tag is coded individually, the number of decimal places output by default in any web tag might vary slightly from the above default. As Cumulus has been developed, people have commented that these defaults do not reflect the precision of their instrumentation (weather stations used with Cumulus tend not to have the accuracy of those used by meteorologists, or are not recalibrated as often). |
|||
The "mono-complete" is the package we want. |
|||
This section (and its subsections) only applies to tag names that output real numbers (with integer and decimal parts). You can't change anything that is output as an integer, or is text with these parameters, nor can you change the decimal places for any time element. |
|||
:Please note that if you just specify “mono”, you will get ‘’’mono-devel’’’ (the developer edition) that does not include all the components required by each of the Cumulus executables. |
|||
Consequently, gradually Cumulus has allowed more and more of its output to take an output format modifier that allows people to control number of decimal places shown. |
|||
Please note that a particular MX build might specify it needs a particular version of Mono. Hence, although normally you can upgrade a cumulus package without upgrading Mono, sometimes you will need to install Mono again. |
|||
===Two Output (format modifier) parameters for decimal places=== |
|||
The latest release of Mono can always be downloaded from [https://www.mono-project.com/download/stable/#download-lin], follow step 1 there, but in step 2 replace ‘’’mono-devel‘’’ by ‘’’mono-complete’’’ |
|||
From release 3.10.5 (which did a big rewrite of web tag handling), you can modify real number output for individual tag names, using output modification parameters in either of the following formats: |
|||
=Cumulus packages= |
|||
* <tt><#tag_name dp=i></tt> and |
|||
* <tt><#tag_name tc=y></tt> |
|||
These can be applied to any tag names that represent real numbers (with integer and decimal parts). |
|||
====Rounding to a specific number of decimal places==== |
|||
Note use of plural in section name above, the following sub-sections will install various packages produced by Developer Mark Crossley. If you are using the [[Software#Cumulus_MX|pre-built disc image]], then (unless the MX release version included in your image is an old one) you should skip the instructions for "CumulusMX". |
|||
<tt>dp=i</tt> is used for both Cumulus 1 and MX. |
|||
==Handling zip files== |
|||
*The value '''i''' following the attribute '''dp''' is an integer, it represents how many decimal places you want for the output you see. |
|||
This functionality was trialled in the original Cumulus, but has been properly implemented in MX. |
|||
Each release is presented as a zip. |
|||
If you are using the legacy Cumulus (1.9.4), only <tt><#latitude dp=i></tt> and <tt><#longitude dp=i></tt> were able to be output with "i" denoting number of decimal places, e.g. <#latitude dp=5> gives "59.24250". |
|||
The download and unzip procedure is exactly same on your Linux computer, and on a Windows PC. So if you have two devices available, you can download on either device, and if it is not the computer you want to install on, you can use a file transfer package to move the files between devices, or use a drive (or even a memory card) with a partition formatted so that you can read it on both devices. Windows and Linux partitions are formatted in different ways. While it is likely that Linux can read a Microsoft formatted partition, Microsoft Windows can never read a Linux formatted partition. |
|||
If you are not using latest MX release, you may find this is not available for particular web tag names |
|||
When your browser saves the zip it might be into a folder called “downloads” on your computer, or you may be able to save into another folder that you prefer (perhaps on a different partition). Your browser might even remember the folder you used before for files of type zip. |
|||
# From beta releases (3.0.0) onwards, <tt><#latitude dp=i></tt> and <tt><#longitude dp=i></tt> were able to be output with "i" decimal places |
|||
#* But this output modification parameter could not be applied to any other tags in the MX beta. |
|||
# MX when it came out of beta, added this output modification parameter usage in the moon tags <#MoonPercent> and <#MoonPercentAbs>). |
|||
#* Specifically, <#MoonAge> gives "11" but <#MoonAge dp=3> gives "11.234" |
|||
====Truncation of unwanted decimal places==== |
|||
This output format modifier is only available in MX. |
|||
When the download has completed, whatever computer type this is on, mouse click (it might need a right click or a double click depending on settings) on the download file and it should unzip (it may create a folder whose name is taken from the zip file name in the same folder by default, or it may ask you where you want to unzip to). If you are unable to use a mouse, there should be a keyboard code to use. If you are using a file manager, with a graphical interface, there may be a different way to select the file and unzip it. |
|||
<tt>tc=y</tt> is the truncation parameter, the attribute '''tc''' takes the value 'y' to remove decimal places by truncation. e.g. <#MoonAge tc=y>. |
|||
Whilst many people want Cumulus to round output as done by the previous parameters, there are circumstances when rounding down (or truncation) gives the result desired. |
|||
==Where to install all packages?== |
|||
* If you are using an early release of MX, you will need to research whether this is available for particular tag names |
|||
For simplicity on this page EXISTING PATH (the contents of this will start with a slash “/”, but not end with a slash) is used to represent any location in the Linux file structure where you decide to install all the Cumulus packages. |
|||
* Later releases of MX implement this for any tag that by default outputs decimal places. |
|||
Note, truncation by MX converts real numbers to integers. There is no option to truncate to one decimal place, Airports are expected to report air field level (QFE), and sea level (QNH), pressures truncated to one decimal place rather than rounded. |
|||
The phrase “EXISTING PATH” is used, because it is most likely you want to create the sub-folder called “/CumulusMX” (note where capital letters must be used) in a part of the Linux file structure that already exists. |
|||
== Multiple Output Format Modifier parameters for times and dates == |
|||
It is important to minimise the length of the path name, because this path name has to be passed between various different software languages (and longer paths risk truncation). |
|||
These are highly complicated, and so have been left until after the simpler ones! |
|||
* You can create sub-folder called “/CumulusMX” as you unzip a MX release, or you can type <code>sudo mkdir EXISTING PATH/CumulusMX</code> first (note that EXISTING PATH is explained above and always starts with a slash “/”). |
|||
* By using the phrase EXISTING PATH this advice avoids telling you to install Cumulus where you do not want it: |
|||
*# Many people with a Raspberry Pi, and a little technical understanding, add an external drive to reduce wear on the internal micro-SD card, and keep their Cumulus files away from the drive that holds the operating system. |
|||
*#* This page is not going to get technical by telling you how to create, or mount, Linux partitions on your external drive. If your drive was bought from a Raspberry Pi reseller, they might help you. |
|||
*# Other people using a Raspberry Pi without that technical expertise, might use ‘’’/home/pi’’’ for EXISTING PATH as that is the default folder for the default user (Pi) and can be referenced as "~" in file path instructions they issue (although Cumulus will not understand that shorthand) |
|||
*#* Within that ‘’’/home/pi’’’ folder, the default user has full permissions automatically. |
|||
*# The developer suggests you use ‘’’/opt’’’ for EXISTING PATH (which should be available on any Linux computer). |
|||
*#* By default, the code Mark provides for installing Cumulus as a service, will run that service as a root user, and the root user has full permissions in /opt (and everywhere else) |
|||
*#* If you do choose a EXISTING PATH outside your home folder, you might want to change the ownership of the "CumulusMX" sub-folder, to the default user (Pi), if so, type <code>sudo chown -R pi: EXISTING PATH/CumulusMX</code>. The advantages of that command is you no longer need "sudo" to access the files (however, if you are running MX as a service, you also need to edit the user in the script provided to create the service, so MX does not create files with root ownership - this will be covered later) |
|||
To start with a simple example, suppose you want date/time in ISO 8601 format: |
|||
==Packages to install== |
|||
# This means, something like ''2019-02-28 06:59:05''. |
|||
# Take the tag name (from tables on [[Webtags]] page) |
|||
# Next check in [[#Which tag names take date/time output formatting modifiers]] to see if that tag accepts both time and date modifiers |
|||
# If our tag name does accept both date and time modifiers, simply modify the web tag as shown here <code><#tag_name format="yyyy-MM-dd HH:mm:ss"></code> where tag_name is set from step 1, but all the rest is typed as shown. |
|||
# To explain each element in that format value, look in [[#Year formats]], [[#Month formats]], [[#Day formats]], [[#Use of spaces]], [[#Time formats]]. |
|||
Should you want a different date/time format, then the sub-sections just referenced should help you to select a different arrangement, although there are some more options in [[#Date formats]]. |
|||
<big>We shall install the Cumulus software listed on [[Software]] page</big>: |
|||
# '''CumulusMX’’’: |
|||
#* '''CumulusMX.exe’’’ is written in C# |
|||
#* Download '''CumulusMX zip file’’’ from [[Software#Latest_build_distribution_download]] |
|||
# [[Software#Create_Missing|'''Create Missing''']]: |
|||
#* '''CreateMissing.exe''' is another C# package |
|||
#* Using '''CreateMissing.exe''' is fully documented at [[Calculate_Missing_Values#CreateMissing.exe]] in this Wiki (it will populate missing fields in [[standard log files]] and/or missing lines in [[dayfile.txt]]), |
|||
#* Simple Instructions for using this executable are on the github page where they are found, you can find the link for that at [[Software#Create_Missing]] in this Wiki. |
|||
# '''ExportToMySQL''' |
|||
#* '''ExportToMySQL.exe''' is also written in C# |
|||
#* Download '''ExportToMySQL.exe''' package from [[Software#ExportToMySQL]] |
|||
#* '''ExportToMySQL.exe''' is not (at the time this was written) documented in this Wiki although [[MX_Administrative_Interface#MySQL_settings]] does describe a similar utility (written by Steve Loft) that was actually included in early MX release downloads. |
|||
===Which tag names take date/time output formatting modifiers=== |
|||
As at 9 March 2020, there is another utility, '''CreateRecord''', initialised in the Github areas managed by the developer where Cumulus is worked on. This will, if my understanding is correct, read [[dayfile.txt]] and use that to update the various [[:Category:Ini Files|extreme record files]]. However, at the time of writing this, it is nothing more than a concept that needs to be coded, and (as far as I know) there has been no progress on that utility for at least 4 months. |
|||
There are nearly a thousand different tag names. |
|||
===Alternative download link for older MX releases=== |
|||
There are a few time-related tag names labelled as being fixed format, that means any time/date output modifiers you might try would be ignored. |
|||
Skip this sub-section if either you have installed the "pre-built disc image", or the current MX release is stable (it has been available for a while and nobody has reported any bugs). |
|||
Some tag names, although it can be hard to tell which, report durations. You can use time modifiers to change how these are reported. Examples include '''<#daylength format=H:mm:ss>''' and '''<#MonthDailyRainHD format=H:mm>'''. |
|||
Check if posts in the [https://cumulus.hosiene.co.uk/viewforum.php?f=40 Cumulus Support Forum] tell you that the current release of MX has one or more bug(s) that affects one or more aspect(s) of MX that you intend to use. |
|||
Time modifiers can also be used to change the way that clock times are reported, you might only want the hour, or you might (if resolution is available) want to also see seconds. The [[webtags]] page has columns headed "Time" to clearly identify all tag names that report clock times. |
|||
Remember, it is impossible for the developer to check all the ways in which versatile MX can be used: |
|||
* Different weather station types (the developer only has a Davis), |
|||
* Different computer types (development is mostly on Microsoft Windows), |
|||
* Plus a whole host of optional features, and different external upload sites, (typically each of these optional features are only used by a sub-set of Cumulus users). |
|||
There are some tag names (e.g. moon rise) that relate to an event that does not happen each Earth day, so those tags have to be able to report "--:--", and you cannot modify their output. |
|||
Anyway, '''you can download any earlier build, without the bug''', from [https://github.com/cumulusmx/CumulusMX/releases CumulusMX/releases]. |
|||
There are some tags (e.g. highest temperature range in month/year), for which Cumulus has been coded to report "--" for value, and "--:--" for time, on the first day of that period (because there is only a partial day to consider you might not yet have experienced a true maximum and a true minimum), so modifying the time output can only be done on subsequent days. |
|||
You need to ensure that you use the right version of "CreateMissing.exe" and "ExportToMySQL.exe" utilities for the MX release you are running, so if you are using an old MX release, you will need to go directly to the [https://github.com/cumulusmx Cumulus MX github] page, and navigate to the utility of interest, to download an older version of these utilities that matches your older MX. |
|||
It is not practical to indicate which time/date modifiers are accepted on a tag by tag basis. It would involve a lot of repetition. Instead, the following table, explains much more simply, which web tags will accept time and/or date output modifiers: |
|||
==Upgrading a Cumulus package== |
|||
{| class="wikitable" border="1" |
|||
|- |
|||
!style="width:100px" | Cross-reference to table on web tag names page |
|||
!style="width:300px" | Tag names that accept only time output modifiers |
|||
!style="width:300px" | Tag names that accept only date output modifiers |
|||
!style="width:300px" | Tag names that accept both time and date output modifiers |
|||
|- |
|||
|- |
|||
! scope="row"| Any tag names that don't report times nor dates |
|||
| None |
|||
| None |
|||
| None |
|||
|- |
|||
! scope="row"| [[Webtags#No_Commas]] |
|||
| None |
|||
| None |
|||
| None |
|||
|- |
|||
! scope="row"| [[Webtags#Date_.26_Time]], [[Webtags#Day/Night/Sun/Moon]] |
|||
| Only <#timehhmmss>, <#minute>, <#hour>, <#sunrise>, <#sunset>, <#dawn>, <#dusk> |
|||
| Only <#LatestErrorDate>, <#date> (but no others) |
|||
| Only <#LastDataReadT>, <#time>, <#metdate>, <#metdateyesterday>, <#update>, <#LastDataReadT> |
|||
|- |
|||
! scope="row"| [[Webtags#Today]], [[Webtags#Yesterday]] |
|||
| Any tag name in "Time" column of linked table |
|||
| None |
|||
| None |
|||
|- |
|||
! scope="row"| [[Webtags#Monthly]], [[Webtags#Yearly]] |
|||
| Any tag name in "Time" column of linked table in first column |
|||
| Any tag name in "Date" column of linked table in first column |
|||
| None of the tag names. For explanation see the ^ below this table |
|||
|- |
|||
! scope="row"| [[Webtags#All_Time]], [[Webtags#Monthly_All_Time_Records]] |
|||
| None (all tag names combine both time and date) |
|||
| None (all tag names combine both time and date) |
|||
| Any tag name in "Date/Time" column of linked table |
|||
|- |
|||
! scope="row"| [[Webtags#Davis]] |
|||
| None |
|||
| <#StormRainStart> only |
|||
| None |
|||
|} |
|||
^ For the monthly and yearly web tags, the date and time are in separate tag names. It is not possible to get both time and date out of either tag name. |
|||
Note: There are some monthly/yearly web tags (e.g. wettest day) where a date tag is available (i.e. <#MonthDailyRainHD>), but there is no time tag. As explained before, in that wettest day example '''<#MonthDailyRainHD format=H:mm>''' returns the duration in hours and minutes since rollover for which rain continued to increase on that date, not the clock time. For rainfall, only '''<#LastRainTip>''' can have output modifiers added to report a clock time. |
|||
Upgrading to a new MX release is explained [[Updating_MX_to_new_version|here]], but basically follow instructions above, and install over your existing files. The alternative is to install in a new folder (or rename the old one), and copy across files not in the release from old location to new location. |
|||
===Locales=== |
|||
== Report and data files to copy across from any previous Cumulus location == |
|||
The default format for many tag names reporting date and/or time is dependent on the locale you are using for running Cumulus (1 or MX). |
|||
All the (optional) files in the [[Reports folder]] can be copied across from a previous installation. If your previous installation was not on Linux, see [[#Line terminators in .txt files]] |
|||
The effect of some output format modifiers is also dependent on locale. |
|||
All the files in the [[data folder]] can also be copied across. If your previous installation was not on Linux, see [[#Line terminators in .txt files]] |
|||
For MX running on most operating systems (and therefore using Mono), type <code>locale</code> to see the default locale that will be adopted when mono-complete is installed as MX will, by default, take locale setting from Mono. When you start MX, you can ask it to use a different locale to that picked up by Mono, by adding the parameter "-lang locale-code", see examples at [[MX_on_Linux#Parameter_for_changing_Locale]]. For example, the Australian English language with UTF-8 encoding locale is defined as: en_AU.UTF-8. |
|||
The available locales on your computer in Linux are listed by <code>locale -a</code>. For example, the Russian locale would be selected as the one your computer uses ''for the current session only'' by using <code>LANG=ru_RU.utf8</code> either typed into a terminal session before you start MX, or used as a parameter (preceded by "-") as you start MX interactively. |
|||
If your previous Cumulus installation was version 1.9.4, or earlier, then you need to do a lot of reading: |
|||
* [[Amending dayfile]] tells you about how MX is far more fussy about the content in [[dayfile.txt]] |
|||
* [[:Category:Ini Files|.ini files]] explains how time-stamps are formatted differently in the extreme tracking files |
|||
* [[Migrating from Cumulus 1 to MX]] gives some advice about differences in settings, but be aware that the way MX handles settings varies by release, and information on the linked page may be out of date |
|||
For permanently changing the locale used by your system, the instructions vary considerably according to the kernel used in your operating system, so you need to look up the instructions for yourself. However, if you have a graphical user interface, such as the full Raspberry Pi Operating System provides, you might have a configuration command in terminal mode and a configuration app accessed (within ''Preferences'') from the "Raspberry" key on the official keyboard. For the Raspberry Pi, please read [[Raspberry Pi computer page]] for more details. |
|||
==Configuration Files to copy across from any previous Cumulus installation== |
|||
For Microsoft Windows Operating Systems, a Language is defined within the "Region" page of the Settings app. That should be sufficient for the legacy software that uses Delphi. |
|||
There are two configuration files that are not included in any MX release: |
|||
*[[strings.ini]] (note all lower case) – optional file to customise output |
|||
*[[Cumulus.ini]] (note initial capital, then lower case) – main configuration file |
|||
However for MX date and time formats within Windows Operating System, you must use the older '''Control Panel''' (go to "Clock and Region" screen, choose "Change date, time or number formats", choose "Language preferences") because it is only there that you can adjust all the defaults used by .NET. |
|||
If your old installation was for a relatively recent release, then just copy these files to new installation and optionally skip the next 2 sub-sections. |
|||
===Time zones=== |
|||
If you are upgrading from an older release, please read the next 2 sub-sections for advice. |
|||
Before I explain what time/date output modifiers can do, something they can't do. |
|||
===strings.ini=== |
|||
All web tag outputs are in local time, except '''<#timeUTC>'''. |
|||
'''This is an optional file'''. Its [[strings.ini|purpose]] is to allow customisation of some of the outputs from Cumulus. You might want to use customisation to abbreviate (or extend) some outputs, or to change those outputs into another language. |
|||
Although Cumulus 2 internally stored all date/times in UTC, no flavour of Cumulus is currently able to output the time-stamp for any weather extreme in UTC, if your current time is not in UTC. |
|||
You create a “strings.ini” file by selecting some of the parameters from the [[samplestrings.ini]] file that is included in each MX release, and modifying the value for the listed attributes as you type them (under the same group titles - these are enclosed in [ ] as before). |
|||
However, for MX only, you can use a script to convert a time to UTC. This is not the place to tell you how to write the script, but taking time of highest pressure today as an example, you would use <#TpressTH format=Hh:mm> and <#TpressTH format=zzz>, the first gives hours and minutes in your local time, and the second gives the offset that needs to be applied to that time to convert it to UTC. |
|||
The sections that appear in '''samplestrings.ini''', and the parameters that appear within a section, changed drastically between Cumulus 1.9.4 and MX. So be cautious if you try to use a "strings.ini" file originally created by the legacy software, check whether the parameters you used before are still available in the latest "samplestrings.ini". |
|||
===Time resolution=== |
|||
The content of "samplestrings.ini" is changing as MX is developed. Therefore, your existing “strings.ini” might need to be modified. There is no automatic way to check your “strings.ini” file, if MX does not understand any parameter in this file, it ignores it. Instead, you need to manually check each parameter you have in your “strings.ini” file to see if that parameter is in “samplestring.ini” included in the release you have installed. You may also find new parameters in “samplestring.ini” that you wish to add to your “strings.ini” file to tailor new functionality to your preferences. |
|||
For the legacy software, there may be no point in asking for seconds, as Cumulus 1 did some actions at one minute intervals. |
|||
===Cumulus.ini=== |
|||
If Cumulus obtained archive data, as part of the catch-up process it can do when it restarts, any time-stamps for that period can only be the time of a particular archive record, so that might be every half an hour, but not aligned precisely with hour changes. |
|||
If your old release was 3.8.0 or later, then copy the [[Cumulus.ini]] file used in that old installation into your new one. The file is growing with lots of new parameters, and the tables on the page I have just linked indicated when parameters were introduced, and where those settings may be changed to make it simple for you to ensure all settings are right for your new release. |
|||
===Dependency on Cumulus flavour=== |
|||
If your old release was older that 3.8.0, then you will see [[:Category:Configuration Files|the Configuration Files page]] shows different links for documentation on older "cumulus.ini" files. Because of those differences, many people prefer to rename their existing “Cumulus.ini” file when upgrading from such an old release, or making an install on a new device. To create a new file, they work through all the settings manually, so that MX can create a fresh file, with them having confidence every setting reflects their preference. However, you do need to be aware that such older releases included a lot of "read-only" parameters that had to be set manually in the file, you may find some of those parameters are still needed by you, so you will want to edit the new file, with MX stopped, and copy any of those old "read-only" parameters that might not yet be settings you configure within the MX interface (although the number of these is diminishing with each new release). |
|||
You cannot,in general, use the same date/time formatting for both the original (legacy) Cumulus and MX. |
|||
If you previously used an older release of Cumulus, but in this new installation will be using the latest release (latest is what is normally best, unless it has bugs), you may want to read up on all the changes between your old release and the current release, not just changes that affect the configuration file. |
|||
All the tables explaining what is available, attempt to show what is used in each flavour for each type of output, both by including separate columns for each flavour, and by giving examples in each flavour. |
|||
==Moving from Microsoft Windows to Linux== |
|||
=== |
====For the legacy software==== |
||
I deal with this first, just because it is simple! |
|||
If you are a novice to computers, skip this sub-section and the next, go directly to [[#File Names & Paths]]. |
|||
From version 1.9.1, most web-tags that report any form of time or date will accept an optional 'output format' parameter (we have already seen whether this can only affect time, only affect date, or both). |
|||
You need to have some technical understanding to do an action that might encounter the issues discussed here. For normal MX usage, line terminators do not matter. |
|||
The legacy Cumulus uses Delphi to interpret the output modifiers: |
|||
If you are moving from Microsoft Windows to Linux, be aware that Microsoft ends each line with two characters (Carriage Return and Line Feed) while Unix/Linux ends each line with a single character (Line Feed). Cumulus can cope with both approaches for existing files, but will create new files correctly for Linux. |
|||
*For most modifiers, a particular character produces the same output regardless whether the output modification specifier is in capitals or lower-case |
|||
**There is an exception, the case you use for any am/pm output format modifiers determines the case that is output. |
|||
*In general, the context of a modifier does not affect the output it produces |
|||
**Again, there is an exception, "m" or "M" has two different meanings (minutes or month) depending on context. |
|||
====The complications with MX==== |
|||
If you run your Linux computer in a headless mode, accessing its files by a remote terminal session, be aware that the line terminator used by the remote computer may be applied to files affected by whatever command you do remotely. Equally, running a Cumulus executable (MX or one of the utilities) may create new files with the wrong end of line terminator. The latest releases have been amended to match existing files, when they create a new file to replace an old file (or because that file is missing/corrupted). |
|||
Cumulus MX works '''internally''' with dates specified in either a day before month before year format, or ISO 8601 date format where year comes first (yyyy-MM-dd) depending on context. Compatibility with the legacy software has so far meant while the [[:Category:Ini Files|*.ini Files]] have adopted the year first approach, the [[:Category:MX txt Files|*.txt Files]] have stuck to date formats as used in the legacy definitions. |
|||
If you try to edit a file outside MX, the tool you choose to use might be able to detect that it is getting Microsoft files, and discard the extra end of line character. |
|||
For Cumulus MX output formatting, the date and time modifiers are complicated by the fact that the same character can have 4 different meanings depending on its case (capital letter or lower-case letter), and depending on whether it is on its own (standard format) or with another modifer (custom format). '''Sounds confusing?''' Well it is complicated. |
|||
However, if you are reading a comma separated value file (such as MX uses for various files) in a script, your script might not detect the end of line encoding: |
|||
* If the script expects the Linus LF, and finds CR LF, then the final field of each CSV line has an invalid character in it, so your script will not be able to understand that field as a numerical value (or time-stamp). |
|||
* If the script expects CR only, and finds CR LF, then the first field of the each line presented to the script (except the first line) starts with a “LF” and the script will not recognise it as a date. |
|||
* If the script expects CR only, but just finds LF, the script will believe the whole file is just one line, and the fields before and after the LF will be treated as a single field so your script will not be able to understand that field as a numerical value (or time-stamp). |
|||
* If the script was written for a Microsoft Windows environment, it will expect CR LF, but might be confused if the end of line is different |
|||
Consider context first: |
|||
*<tt><#tag_name format=x></tt> |
|||
**If the '''x''' in the above general syntax is a single character, it represents a standard format code |
|||
**The standard characters for dates and times are defined at [https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings standard-date-and-time-format-strings] |
|||
*<tt><#tag_name format=xyz></tt> |
|||
**If the '''xyz''' in the above general syntax is replaced by two or more characters, it becomes a custom format code (combinations of characters, or single characters prefixed by %) |
|||
**The custom characters for dates and times are defined at [https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings custom-date-and-time-format-strings] |
|||
Consider case next: |
|||
===Changing line terminators=== |
|||
*Cumulus MX (when running on Windows) uses the '''.NET''' software which is provided as standard by Microsoft Windows. |
|||
**".NET" was originally operating system independent, later only Microsoft Windows specific components were included, but since November 2020 ".Net" is used for an operating system independent version that originally Microsoft issued under another name! |
|||
**(actually it is possible to install and run "Mono" in Windows Operating Systems). |
|||
*If Cumulus MX is running on any Linux distribution (including Raspberry Pi Operating Systems) or Mac OS X, or any other device that uses an UNIX derived operating system, then MX uses '''Mono''' software for same purposes. (MONO is a operating system independent version of .NET, although they are developed independently, they have common origins). |
|||
===Use of spaces=== |
|||
Many editors designed for programmers (they might be described as providing a programming development environment) can change the line ending of every line (either while file is being edited or when file is saved). |
|||
There are multiple symbols for specifying dates and times, and you might want spaces to appear between symbols in that output format. |
|||
‘’’Geany’’’ is a programming development editor provided on some Linux systems including Raspberry Pi, that can do this ('''Document''' menu, -->> '''Select Line Endings'''). |
|||
You need to add quotation marks to the output format specifier if spaces are present. |
|||
Notepad++ is another editor available for multiple operating systems ('''Edit''' menu -->> '''EOL conversion'''). |
|||
The first complication is that the parser that interprets time/date characters has two ways of interpreting a space character, depending on what immediately follows. In the tables, below, I have used a "%" in various places. In any of those places, a space is not a gap between characters, but an alternative to "%". I discuss this later in [[#Migrating from legacy Cumulus 1 to MX]] section. |
|||
Both have capabilities to make such changes on either the single file that has focus, or all loaded files. |
|||
For a space character to be interpreted as a gap between symbols, the symbol that follows the space must include at least two characters. The syntax <code><#tag_name format="x y z"></code> works if the y and z in it are representing multi-character symbols. To explain this, an example is '''<#TpressTH format="h:mm tt">''' as both ''h:mm'' and ''tt'' are multi-character symbols, we have inserted a space after the minutes. |
|||
If we have single character specifiers, then a space has to be enclosed in single quotes to mark it as a literal, not a modification of the subsequent single character. To explain this, a simple example is '''<#MonthPressHD format=" d' 'M">''', here the month number is a single character "M", so to insert the space we have to treat it as a literal by enclosing the space character in single quotes and the whole specifier in double quotes. |
|||
===File Names & Paths=== |
|||
Literals are discussed fully in the [[#Including literals in format parameters]] sub-section later. If we want to include other characters not to be interpreted by the date time parameter parser, and spaces, then both double and single quotes must be used, and the spaces must be within the single quotes. An example, that shows all the options that MX allows, with literals is <code> <#TpressH format="\a't 'h:mm' ' tt' <nowiki><small>on 'd/M/yyyy' </small></nowiki>'"> </code>. |
|||
Another issue that may be encountered when moving from Windows to Linux is the difference in File Names & Paths. |
|||
Linux file names are Case Sensitive, and the separator is "/" Vs "\". |
|||
Finally, the use of literals can cause you ''a problem if you want to use a date/time specification in a script'' because the script wants literal delimiters outside any web tags, so that delimiters remain when the web tag itself has been processed into a string by Cumulus. This means the type of quotes (single or double) used outside the web tag, cannot be used within the web tag. The complicated sounding (but actually simple solution) is to avoid placing literals, and/or spaces, within any output format specifier, instead put single quotes round the whole content. What you thought of putting as literals within any web tag is instead typed outside with separate web tags for the part of the specification before and after each literal. An example to make this clearer is <code>$MXDateTime = '<#date format=yyyy-MM-dd>' . 'T' . '<#time format=hh:mm:ss>';</code>, which is written in PHP Hypertext preprocessor format, the literal 'T' has been inserted between two separate web tags. |
|||
This could be applicable if you are using Extra Web files. |
|||
===Year formats=== |
|||
Here is an example changing the case and the separators: ''Web\extrapageT.htm'' in Windows, changed to read '''web/extrapageT.htm''' in Linux. |
|||
These are the simplest output format modifiers. We choose from 2 options, and because both involve more than one character their context does not matter. Although the legacy Cumulus will accept upper case as meaning same as lower case, it is simplest if we just show the lower case options needed for MX: |
|||
=Running MX on Linux= |
|||
{| class="wikitable" border="1" |
|||
This section explores the optional parameters, and then covers 2 ways to run MX: |
|||
|- |
|||
# as a service and |
|||
!style="width:150px" | Specifier |
|||
# interactively with terminal window left open. |
|||
!style="width:600px" | Displays |
|||
!style="width:600px" | Example |
|||
|- |
|||
|yy |
|||
|Displays the year as a two-digit number (00-99). |
|||
|19 produced by <#LastDataReadT format=yy> |
|||
|- |
|||
|yyyy |
|||
|Displays the year as a four-digit number (2000-9999). |
|||
|2009 produced by <#LastDataReadT format=yyyy> |
|||
|} |
|||
====Month formats==== |
|||
== Optional parameters to add to the instruction to run the MX engine == |
|||
All locales offer both numerical and alphabetical formats for representing months. |
|||
This list of parameters covers every parameter, if you are using the latest release skip the historic 3.0.0 sub-sections. |
|||
*In the following table "MMM" is shown as producing short month name. |
|||
**What language is used, and what characters appear, depend on what is set up for your language in your settings (by default or by you changing your settings) |
|||
**In British English (UK) locale this will be the appropriate 3 letter abbreviation that starts with "Jan" and runs to "Dec" |
|||
**It appears that language settings in many locales (not "en-gb"), add a full stop to any abbreviations |
|||
and in that case the 3-letter "MMM" is turned into a 4-letter output (e.g. Australia settings default would output from "Jan." to "Dec.") |
|||
*** MX has been coded to remove that full stop in various places (like in standard log file naming and NOAA report naming), but at the time this section was edited, "MMM" still reports the full stop in a web tag output if your locale uses it |
|||
*In the following table "MMMM" is shown as producing the full name for a month |
|||
**The output you get will depend on the language defined in your locale |
|||
**In English locales, the output will be in the range "January" - "December" |
|||
{| class="wikitable" border="1" |
|||
|- |
|||
!style="width:150px" | [[File:Badge v1.png]]Delphi Specifier for Cumulus 1.9.x |
|||
!style="width:150px" | [[File:Badge vMx.png]]Mono/.NET Specifier for Cumulus MX |
|||
!style="width:600px" | Displays |
|||
!style="width:600px" | Example |
|||
|- |
|||
|M (or ''m'') |
|||
|%M |
|||
|Displays the month as a number without a leading zero (1-12). |
|||
* [[File:Badge v1.png]]Cumulus 1.x.y:If the 'M' or 'm' specifier immediately follows an h, hh, HH, or H specifier, the minute rather than the month is displayed. |
|||
*[[File:Badge vMx.png]]Cumulus MX: Note that including a ' ' (space) or '%' before the M makes it a custom modifier, so different from the '''format=M''' included in previous table. |
|||
|2 |
|||
|- |
|||
|MM (or ''mm'') |
|||
|MM |
|||
|Displays the month as a number with a leading zero (01-12). |
|||
* [[File:Badge v1.png]]Cumulus 1.x.y:If the 'm' or 'M' specifier immediately follows an h, H, HH, or hh specifier, the minute rather than the month is displayed. |
|||
|'03' produced by <#LastDataReadT format=MM> or <#metdate format="MM"> |
|||
|- |
|||
|MMM (or ''mmm'') |
|||
|MMM |
|||
|Displays the month using the strings defined for '''short month name''' in the Locale. |
|||
|'Jun' produced by <#metdate format="MMM"> (English locale) |
|||
|- |
|||
|MMMM (or ''mmmm'') |
|||
|MMMM |
|||
|Displays the month as a full name using the strings appropriate to the Locale. |
|||
|'June' produced by <#metdate format="MMMM"> (English locale) |
|||
|} |
|||
====Day formats==== |
|||
IMPORTANT: The "sudo" prefix shown in code examples for the various parameters can be omitted if the user that is running MX owns the folder "CumulusMX" and all its contents. In the [[#Where to install all packages?|installation notes earlier]] possible locations and ownership issues were mentioned. That earlier section also defined EXISTING PATH, if that is not mentioned in the code examples, it is assumed you have already issued a <code>cd EXISTING PATH</code> to be in the right folder for issuing the command. |
|||
All locales offer both numerical and alphabetical formats for representing a day. |
|||
Note that you ''may'' need to supply your root password after typing any 'sudo ...' command line if the instruction changes something set by another package (e.g. changing the locale for MX from the locale set by mono). The system will prompt you for this if it is needed. |
|||
The table below relates just to the day part of any date specifications. |
|||
=== Parameter for changing Port === |
|||
{| class="wikitable" border="1" |
|||
|- |
|||
!style="width:150px" | [[File:Badge v1.png]]}Delphi Specifier for Cumulus 1.9.x |
|||
!style="width:150px" | [[File:Badge vMx.png]]Mono/.NET Specifier for Cumulus MX |
|||
!style="width:600px" | Displays |
|||
!style="width:600px" | Example |
|||
|- |
|||
| d (single character) |
|||
| %d |
|||
|Displays the day as a number without a leading zero (1-31). |
|||
[[File:Badge vMx.png]]Note that Cumulus MX requires a ' ' (space), '%' or another modifier to be included, as 'd' on its own is inconsistent - see [[#Date formats]] table). |
|||
When Cumulus starts, it will display the URL of the user interface. It runs on port 8998 by default; if this is not suitable for some reason you can over-ride it using the '-port' parameter on the command line, e.g. to use port 9999 instead: |
|||
| 27 produced by: |
|||
<pre>sudo mono CumulusMX.exe -port 9999</pre> |
|||
* [[File:Badge v1.png]]<#metdate format="d"> |
|||
* [[File:Badge vMx.png]]<#metdate format="%d"> |
|||
|- |
|||
|dd (2 characters long) |
|||
|dd |
|||
|Displays the day as a number with a leading zero (01-31). |
|||
|07 produced by <#metdate format="dd"> |
|||
|- |
|||
|ddd (3 characters long) |
|||
|ddd |
|||
|Displays the day as an abbreviation (in UK English will output Sun-Sat) using the strings appropriate to the Locale. |
|||
As for month above, the short day names that are generated depend on your locale, so you might see additional punctuation defined for abbreviated names in some locales. |
|||
=== Parameter for changing Locale === |
|||
|'Wed' produced by <#metdate format="ddd"> (English locale) |
|||
|- |
|||
|dddd (4 characters long) |
|||
|dddd |
|||
|Displays the day as a full name (Sunday-Saturday) using the strings appropriate to the Locale. |
|||
|'Friday' produced by <#metdate format="dddd"> (English locale) |
|||
|} |
|||
====Date formats==== |
|||
On Linux and (in particular) OS X, Cumulus MX may not be given the correct locale to use, and you may get the default US locale even if that is not your locale. It will output the local it is using when it starts; if it is not correct, close it down and start it again, this time specifying your locale on the command line, using the -lang parameter . For example, in the UK, on a non-Windows device type: |
|||
:<code>sudo mono CumulusMX.exe -lang en-GB</code> |
|||
The [[#Year formats]], [[#Month formats]], and [[#Day formats]] listed above can be combined to make up a date output modifier, but there are some other modifiers available that can produce whole dates. |
|||
Other locale examples: '''CumulusMX.exe Current culture: English (United States)''', '''CumulusMX.exe -lang de-DE''', '''CumulusMX.exe -lang el-GR''' (this is one of the locales that reads numbers with '''integer,decimal''' format), '''CumulusMX.exe -lang nl-NL'''. |
|||
[[#Locales]] will define a '''Short Date Format''' and a '''Long Date Format'''. You will see references to those in the table below explaining available output format modifiers, for example the single character output format modifier ('''G''' or '''c''') listed at the start of the table below. |
|||
If you are not sure what value you need to supply for the -lang parameter, there is a list here - http://msdn.microsoft.com/en-gb/library/ee825488%28v=cs.20%29.aspx. You need to supply the code in the first column ("Language Culture Name") in that list. |
|||
If you are in the USA, Cumulus will not use your month first date internally or in any files in the [[Data folder|'''data''' sub-folder]], but you can see your preferred format asan output from web tags, as you can can combine the month specifier, with the day specifier, in that order, to get an output where the month appears first (see example in table below). |
|||
Note that this does not affect the language used by Cumulus MX (although it may in the future), it affects the decimal separator and the list separator. |
|||
<big>Please could an American contributor please check if the "M" modifier works for their locale as shown and update the table below</big>. |
|||
=== Parameter for running as service === |
|||
{| class="wikitable" border="1" |
|||
|- |
|||
!style="width:150px" | [[File:Badge v1.png]]Delphi Specifier for Cumulus 1.9.x |
|||
!style="width:150px" | [[File:Badge vMx.png]]Mono/.NET Specifier for Cumulus MX |
|||
!style="width:600px" | Displays |
|||
!style="width:600px" | Example |
|||
|- |
|||
|c |
|||
|G (as single character format) |
|||
|Displays the date using the format given by the Short Date format, followed by the time using the format given by the Long Time format. The time is not displayed in Cumulus 1 if the date-time value indicates midnight precisely. |
|||
|'22/03/2019 09:47:25' produced by [[File:Badge v1.png]]<#time format=c>[[File:Badge vMx.png]]<#time format=G> |
|||
|- |
|||
|ddddd (5 characters long) |
|||
|d (as single character format) |
|||
| Flavour issues: |
|||
* [[File:Badge v1.png]]Cumulus 1.x.y: 'ddddd' will output the date using the format given by the Short Date format. |
|||
* [[File:Badge vMx.png]]This MX parameter (when on its own, without space or '%' prefix) displays inconsistent behaviour as its effect depends on the tag name (sorry, there is no definitive list from the MX author specifying effect by individual tag name) with which it is used (you will need to experiment for yourself and compare with the two examples). |
|||
| [[File:Badge vMx.png]] '22' returned by e.g. <#yesterday=d> |
|||
Short date format e.g. '22/03/2019' (British Locale) produced by: |
|||
The parameter syntax is <code>sudo mono CumulusMX.exe -service</code> |
|||
* [[File:Badge v1.png]]<#metdate format=ddddd> |
|||
* [[File:Badge vMx.png]]<#metdateyesterday format=d> |
|||
|- |
|||
|dddddd (6 characters long) |
|||
|D (as single character format) |
|||
|Displays the date using the format given by the Long Date format. |
|||
[[File:Badge vMx.png]]The MX 'D' parameter '''cannot be combined''' with any other parameters. |
|||
You don't use this parameter in a terminal or interactive instruction for running MX. Instead it appears within a file that we use to set up for running MX as a service. |
|||
|e.g. '22 March 2020' (British Locale) |
|||
|- |
|||
For the latest release, (see [https://cumulus.hosiene.co.uk/viewtopic.php?p=146473#p146473 this later release announcement]: |
|||
|"D MMMM YYYY" |
|||
#There is a task to do just once to configure the service |
|||
|D |
|||
#Find the '''EXISTING PATH/CumulusMX/MXutils/linux/''' sub-folder, that might be in home directory and therefore found using "~/CumulusMX/MXutils/linux" as explained elsewhere on this page |
|||
|Long date format |
|||
#* At time of typing this, the sub-folder only contains one file, the one we need to edit |
|||
|e.g.4 December 2009 |
|||
# As described later there is a choice of editors, but you can use <code>sudo nano cumulusmx.service</code> to edit the service configuration file |
|||
|- |
|||
# Within the provided file you should find a [Service] section: |
|||
|"D MMMM" |
|||
<pre>[Service] |
|||
|M |
|||
User=root |
|||
|Day of month followed by Month name (except USA locales). |
|||
Group=root |
|||
ExecStart=/usr/bin/mono-service -d:/home/install/CumulusMX CumulusMX.exe -service |
|||
Type=forking |
|||
ExecStopPost=/bin/rm /tmp/CumulusMX.exe.lock</pre> |
|||
Compared with next table where '''format=%M''' used, '''format=M''' on its own returns both Month and Day according to local format |
|||
There are some edits needed to that section: |
|||
| e.g. 22 July (English Locale) |
|||
# Replace '''User=root''' if you want the service to run as a different user |
|||
|- |
|||
# Edit the line that begins with '''ExecStart=''' |
|||
|"MMMM D" |
|||
#* The mandatory change is to replace '''/home/install''' by what you have selected for EXISTING PATH |
|||
|"MMMM d" if M alone does not work |
|||
#* An optional change is to add additional parameters after the '''-service''' (select from '''-debug''', -locale, -port) as described in sub-sections above |
|||
| USA format of month before day of month |
|||
#save file with a new name '''cumulusmx_mine.service''' (using a new name stops it being overwritten when we upgrade MX |
|||
| e.g. July 4 (USA format) |
|||
#now copy file to where it is needed to run the service: |
|||
|- |
|||
:<code>sudo cp EXISTING_PATH/CumulusMX/MXutils/linux/cumulusmx_mine.service /etc/systemd/system/cumulusmx.service</code> |
|||
|TT |
|||
|T (as single character format) |
|||
|Displays the time using the '''Long Time format'''. |
|||
[[File:Badge vMx.png]] Note that this is a full time specifier and "T" is on its own as we are using a single character format. |
|||
Here is how the file might look after the changes: |
|||
|'09:47:56' (might not use colon in your locale) produced by |
|||
<pre>[Unit] |
|||
* [[File:Badge v1.png]]<#LastDataReadT format=TT> |
|||
Description=CumulusMX service |
|||
*[[File:Badge vMx.png]]<#LastDataReadT format=T> |
|||
Documentation=https://cumuluswiki.org/a/Main_Page |
|||
|} |
|||
After=network-online.target |
|||
[Service] |
|||
User=pi |
|||
Group=pi |
|||
ExecStart=/usr/bin/mono-service -d:/opt/CumulusMX CumulusMX.exe -service -debug |
|||
Type=forking |
|||
ExecStopPost=/bin/rm /tmp/CumulusMX.exe.lock |
|||
===Time formats=== |
|||
[Install] |
|||
WantedBy=multi-user.target</pre> |
|||
Here context matters, so both standard (single character) and custom (two or more characters) formats are shown in the following table. As explained earlier, time formats can be used with durations and clock times. |
|||
== Setting up as a service in release 3.8.0 == |
|||
In some rows of this table, square brackets [] indicate optional items, they are included just to make it clearer how items can be combined in a single output parameter. If you want to include what is shown in square brackets you don't type the square brackets e.g. <tt><#LastDataReadT format="h:nn am/pm"></tt> |
|||
Skip this sub-section for latest release. |
|||
{| class="wikitable" border="1" |
|||
|- |
|||
!style="width:150px" | [[File:Badge v1.png]]Delphi Specifier for Cumulus 1.9.x |
|||
!style="width:150px" | [[File:Badge vMx.png]]Mono/.NET Specifier for Cumulus MX |
|||
!style="width:600px" | Displays |
|||
!style="width:600px" | Example |
|||
|- |
|||
|h |
|||
|%h |
|||
|Displays the hour (12 hour clock) without a leading zero (1-12) |
|||
| 7 |
|||
|- |
|||
|h ''AM/PM'' |
|||
|h ''tt'' |
|||
|Displays the hour (12 hour clock) without a leading zero (1-12) in combination with AM/PM. |
|||
[[File:Badge v1.png]]For Cumulus 1 the formats for am/pm depend on the case in which you type the parameter as shown later in this table |
|||
For historic reasons, note the original instructions in the 3.8.0 [https://cumulus.hosiene.co.uk/viewtopic.php?p=145048#p145048 release announcement]: |
|||
# Ensure you are in the folder containing CumulusMX.exe |
|||
# Type <code> mono-service -l:/var/run/cmx.pid CumulusMX.exe -service</code> |
|||
# (to verify) note this does not allow you to add -port, -debug, -locale parameters |
|||
[[File:Badge vMx.png]]What "tt" produces depends on locale settings for your device, it might be capitals or it might be lower case (in Windows use Control Panel, not Settings app, to get to these regional additional settings). |
|||
=== Parameter for adding debugging === |
|||
| [[File:Badge v1.png]]7 PM |
|||
|- |
|||
|h:nn [''AM/PM''] |
|||
|h:mm [''tt''] |
|||
|Displays the hour (using 12 hour clock) without a leading zero (1-12) followed by 2 digit minutes [optionally in combination with AM/PM whose case varies as explained in previous entry]. |
|||
[[File:Badge v1.png]]For Cumulus 1, the minutes can be represented by 'mm' (instead of "nn") only when appearing in combination with 'h' |
|||
MX has a default level of logging that stores in the [[MXdiags_folder]] folder a log file that shows some of the interaction with the weather station and some of the output actions done as MX runs. A new log is started each time MX is restarted. |
|||
|'10:27 am' produced by [[File:Badge v1.png]] <#LastDataReadT format="h:nn am/pm">[[File:Badge vMx.png]] <#LastDataReadT format="h:mm tt"> |
|||
|- |
|||
|H (or ''H'') |
|||
|%H |
|||
| Displays the hour part of any duration or clock time, without a leading zero (0-23). |
|||
[[File:Badge vMx.png]]Note that '%' before the "H", this makes it a custom modifier, needed because H is on its own. |
|||
If there is a problem, then there is a great benefit in actually increasing the level of detail in these logs; and that is done either within the settings (on recent MX releases this is on '''Program Settings''' page of admin interface - please see [[MXdiags_folder]] page for details) or by adding a parameter: |
|||
|7 produced by |
|||
:<code>sudo mono CumulusMX.exe -debug</code> |
|||
* [[File:Badge v1.png]]<#daylength format=H> |
|||
*[[File:Badge vMx.png]]<#daylength format=%H> |
|||
|- |
|||
|H:mm (or ''H:nn'') |
|||
|H:mm |
|||
| Displays the hour part of any duration or clock time, without a leading zero (0-23) followed by 2 digit minutes for that duration or clock time. |
|||
[[File:Badge vMx.png]]Note that %, of previous example, is not needed as the H is not on its own. |
|||
=== Parameters only applicable to Version 3.0.0 Beta builds of MX === |
|||
|'6:27' or '17:49' produced by <#LastDataReadT format="H:mm"> |
|||
|- |
|||
|HH (or ''hh'') |
|||
|HH |
|||
| Displays the hour part of any duration or clock time, using 24 hour clock with a leading zero (00-23). |
|||
|'06' or '17' produced by <#LastDataReadT format=HH> |
|||
|- |
|||
|hh [''am/pm''] |
|||
|hh [''tt''] |
|||
| Displays the hour part of any duration or clock time, (12 hour clock) with a leading zero (01-12) [optionally, if it is a clock time, in combination with am/pm]. |
|||
[[File:Badge v1.png]]For Cumulus 1 the case output for the optional 'am/pm' depends on the case used for that parameter as shown later in this table |
|||
The following two parameters cannot be used with MX since it came out of 3.0.0 beta. |
|||
[[File:Badge vMx.png]] For MX, the optional 'tt' displays the contents of the device locale setting for AM string for midnight until any hour before noon, and the contents of the PM string for noon or any hour after noon but before midnight |
|||
==== web sockets ==== |
|||
|'07 am' produced by |
|||
* [[File:Badge v1.png]] <#LastDataReadT format="hh am/pm"> |
|||
*[[File:Badge vMx.png]] <#LastDataReadT format="hh tt"> if locale specifies lower case |
|||
|- |
|||
|hh:mm (or ''hh:nn'' or 'HH:NN') [''am/pm''] |
|||
|hh:mm [''tt''] |
|||
| Displays the hour part of any duration or clock time, (12 hour clock) with a leading zero (01-12) followed by 2 digit minutes [optionally, if it is a clock time, in combination with am/pm]. |
|||
* [[File:Badge v1.png]]For Cumulus 1, the minutes can be represented by 'mm' only when in combination with 'h', in other contexts 'mm' is interpreted as month number, and the case output for am/pm depends on the case used for that parameter as shown later in this table. As Cumulus 1 is case insensitive there are variants with capital letters available. |
|||
*[[File:Badge vMx.png]] For MX, the optional 'tt' displays the contents of the device locale setting for AM string for midnight until any hour before noon, and the contents of the PM string for noon or any hour after noon before midnight |
|||
|'8:27 am' produced by |
|||
* [[File:Badge v1.png]] <#LastDataReadT format="h:nn am/pm"> |
|||
*[[File:Badge vMx.png]] <#LastDataReadT format="h:mm tt"> |
|||
|- |
|||
|n |
|||
|%m |
|||
|Displays the minutes of any duration or clock time, without a leading zero (0-59). |
|||
[[File:Badge vMx.png]] As other examples show, the % is only needed when "m" is on its own. |
|||
Beta builds in MX version 3.0.0 had an optional parameter <code>sudo mono EXISTING PATH/CumulusMX/CumulusMX.exe -wsport nnnn</code> that determined which port (represented by a 4 digit number ''nnnn'') was used for '''Web Sockets'''. |
|||
| 7 produced as a duration in minutes by |
|||
* [[File:Badge v1.png]]<#daylength format=n> |
|||
*[[File:Badge vMx.png]]<#daylength format=m> |
|||
|- |
|||
|nn |
|||
|mm |
|||
|Displays the minutes of any duration or clock time, with a leading zero (00-59). |
|||
|'07' produced as a duration in minutes by |
|||
* [[File:Badge v1.png]]<#daylength format=nn> |
|||
*[[File:Badge vMx.png]]<#daylength format=mm> |
|||
|- |
|||
|s |
|||
|%s |
|||
|Displays the seconds for any duration or clock time, that has resolution to less than a minute, without a leading zero (0-59). |
|||
[[File:Badge vMx.png]] As other examples show, the % is recommended when "s" is on its own, although I have not found any alternative meaning for "s" on its own. |
|||
That parameter [https://cumulus.hosiene.co.uk/viewtopic.php?f=40&t=17887&p=138815&hilit=sockets#p138815 is now deprecated as Web Sockets in all builds since 3045] use the same port for web sockets as for the HTTP port of the [[MX_Administrative_Interface#The_API_interface|Admin Interface]], see -port parameter described earlier. |
|||
| 9 produced by <#metdate format=s> |
|||
|- |
|||
|ss |
|||
|ss |
|||
|Displays the second with a leading zero (00-59). |
|||
|'06' or 19 produced by <#LastDataReadT format=ss> |
|||
|- |
|||
|z |
|||
|FFF |
|||
|Displays the millisecond without a leading zero (Cumulus 1: displays 0-999, Cumulus MX: displays either nothing, or displays 1-999, so don't write any code that assumes the MX output is numeric). |
|||
Note that the system clock (before Windows 10 64-bit systems) only has precision to 15 ms, so don't use this modifier if your Cumulus is running on an old version of Windows. |
|||
==== Debugging of data flow between station and MX==== |
|||
| |
|||
|- |
|||
|(not available) |
|||
|ff (or ''f'') |
|||
|Displays hundredths of a second (or tenths) with leading zero(s) |
|||
| |
|||
|- |
|||
|zzz |
|||
|fff |
|||
|Displays the millisecond with a leading zero (000-999). |
|||
Note that the system clock (before Windows 10 64-bit systems) only has precision to 15 ms, so don't use this modifier if your Cumulus is running on an old version of Windows. |
|||
Use '''sudo mono CumulusMX.exe -Logging=1''' (for the station to MX transfers to have increased debugging logging). |
|||
[[File:Badge vMx.png]]The 'fff' modifier in MX can actually be extended to 'ffffff' for output to a millionth of a second! |
|||
Note use of this parameter is now deprecated. |
|||
| 09:47:25.000' produced by |
|||
* [[File:Badge v1.png]]<#time format=hh:nn:ss.zzz> |
|||
*[[File:Badge vMx.png]]<#time format=hh:mm:ss.fff> |
|||
|- |
|||
|(not available) |
|||
| zzz |
|||
|Displays the offset of any time from UTC in hours and minutes |
|||
| e.g.-07:00 |
|||
|- |
|||
|(not available) |
|||
|"h:mm K" |
|||
|Effectively another way of including time zone after a time, but it can only be used for times not in UTC (if I understand correctly) |
|||
|(no examples supplied yet) |
|||
|- |
|||
|t |
|||
|%t |
|||
|Displays the time using the Short Time format. [[File:Badge vMx.png]]Remember that 't' combined with other specifiers (or preceded by space or '%') has a different meaning - see below. |
|||
| '09:47' produced by <#LastDataReadT format=t> (might not use colon in your locale) for both flavours of Cumulus |
|||
|- |
|||
|am/pm or Am/Pm or AM/PM |
|||
|tt |
|||
| [[File:Badge v1.png]]Uses the 12-hour clock for the preceding h or H specifier, and displays 'am' for any (clock time) hour from midnight until just before noon, and 'pm' for any hour from noon onwards. The am/pm specifier for Cumulus 1 can use lower, upper, or mixed case, and the result is displayed accordingly. |
|||
[[File:Badge vMx.png]] For MX, 'tt' displays the contents of the device locale setting for AM string for midnight until any hour before noon, and the contents of the PM string for noon or any hour after noon before midnight, so whether it displays in capitals or lower case is determined by the locale settings, not the case of "tt". |
|||
Although this is not mentioned in any release announcements, it appears that on all recent MX releases this effect is incorporated into the '''-debug''' parameter described earlier. Perhaps someone could confirm whether this is true. |
|||
| {Version badge 1}} 'am' produced by <#LastDataReadT format=am/pm>, 'AM' produced by <#LastDataReadT format=AM/PM> |
|||
|- |
|||
|h a/p |
|||
|h t |
|||
|Uses the 12-hour clock for the preceding h or H (clock time) specifier, and displays 'a' for any hour from midnight until before noon, and 'p' for noon or any hour after noon. |
|||
[[File:Badge v1.png]]The a/p specifier can use lower, upper, or mixed case, and the result is displayed accordingly. |
|||
[[File:Badge vMx.png]]whether it displays the "a" or "p" in capitals or lower case is determined by the locale settings, not the case of "t". |
|||
==Running as a service== |
|||
| see previous example |
|||
|- |
|||
|ampm |
|||
|(see above for 12 hour formats) |
|||
|This displays the contents of the device locale setting for AM string for midnight until any hour before noon, and the contents of the PM string for noon or any hour after noon before midnight. |
|||
{{Version badge 1}Uses the 12-hour clock for the preceding h or H specifier |
|||
| see previous examples |
|||
|- |
|||
|/ |
|||
|/ |
|||
|Displays the date separator character given by the Date Separator. It might not display a slash. |
|||
| '/' for typical British locale |
|||
|- |
|||
|: |
|||
|: |
|||
|Displays the time separator character given by the Time Separator. With Cumulus 1, this might not display a colon. |
|||
[[File:Badge vMx.png]]Note that by default Cumulus MX expects a locale to use ":" for any time separator. |
|||
The instructions to set up the ability to run MX as a service [[#Parameter for running as service| were given earlier]]. If you want MX to automatically start when your Linux computer is booted, just type <code>sudo systemctl enable cumulusmx</code> once, and it will be activated on each reboot. |
|||
|':' for British locale |
|||
|} |
|||
The full set of commands to use with this service are at [[Raspberry_Pi_Image#systemctl_commands|systemctl_commands]],they are not duplicated here, so there is only one place to do any update. |
|||
=Some Extra Information= |
|||
In the [[#Parameter for running as service|earlier instructions]] it was suggested you change the user for the service, if you have done that you can omit the "sudo" in <code>sudo systemctl start cumulusmx</code> which manually restarts the service. Equally, you can omit "sudo" from any command that accesses Cumulus files created by the service. |
|||
Having covered the basics of both date and time modifiers above, it is time to talk about incorporating other information in an output modifying date/time format specification. |
|||
== Running any MX executable with a terminal session left open == |
|||
Basically, we can include literal characters, and we can include HyperText Manipulation Language tags, in our specifiers. |
|||
This is alternative to the running as service as described above. |
|||
Finally, there will be a section on migrating from the legacy Cumulus to MX and how to modify the web tags in your templates to keep them working. |
|||
The simplest instruction to run Cumulus MX is <code>cd EXISTING PATH/CumulusMX && sudo mono CumulusMX.exe</code>. |
|||
* This is two commands issued together, the first changes the working folder, the second actually starts the main executable |
|||
** To run "Create Missing" or '''ExportToMySQL''', just edit what appears after "mono" to the correct executable name |
|||
* If you have followed advice at [[#Where to install all packages?]], the user you are using will own the "EXISTING PATH/CumulusMX" folder and you can omit the "sudo". |
|||
* You can add parameters after "CumulusMX.exe" (select from '''-debug''', -locale, -port) as described in sub-sections above |
|||
==Including literals in format parameters== |
|||
Just in case it is not obvious .... if you start any executable using this command in a terminal window on your Pi, you must leave that session running, or that executable will stop running. |
|||
[[#Use of spaces]] explained how double quotes were needed for date/time output specifiers containing spaces. It briefly talked about including literals, and we will expand on that now. |
|||
You can start it off directly on your Pi, and then |
|||
*optionally disconnect the keyboard, |
|||
*switch off monitor or TV attached to your Pi, |
|||
*Just ensure you leave Pi on (with that window minimised) so that terminal session continues running. |
|||
Consequently, you cannot include double quote characters in any other position (see [[Php_webtags#Web_tag_Complications| here for work-around]]). |
|||
Use <code>'''ps -ef | grep -i cumulus | grep -v grep'''</code> to see if Cumulus is running or not. |
|||
You should put anything that is additional, to the defined format modifier specification below, into single quotation marks to prevent it being interpreted as a date or time format modifier. In MX, such single quotation marks should include the spaces round the additional literal text. |
|||
= Operating a web site with uploads from MX engine = |
|||
#For example, the word "on" contains the character "n", which for Cumulus versions 1.9.1 to 1.9.4 will be interpreted as a time format modifier unless you put it into single quotation marks. Example of valid Cumulus 1 syntax: <#TtempH format="'at' hh: mm 'on' dd / mm / yyyy">. |
|||
== The standard web pages == |
|||
#You can include HTML tags (but they cannot have any attributes because both single and double quote characters have defined meanings) and special characters as quoted text within the 'format' parameter.<br> Example of valid syntax: <#TapptempH format="'at 'h:nn' 'am/pm '<small>on' d/m/yyyy'</small>'">. |
|||
#* See next sub-section for more information on incorporating HTML if you are using MX. |
|||
=== From release 3.10.1 === |
|||
[[File:Badge vMx.png]]Note for MX - you can use single quotation marks round spaces and text (e.g. ' on '), but you can also use '\' as escape character (e.g. for 'on' use '''\o\n'''). However for '''at''' the only alternative is '''\a't'''' because the character t has another meaning and escape followed by a "t" i.e. "\t" becomes a tab! |
|||
The web pages are a one-off upload from '''CumulusMX/webfiles'''. The data to be shown on these web pages are uploaded from [[:Category:JSON_Files|.json]] files in the [[web_folder]]. |
|||
Please read [[New_Default_Web_Site_Information|this page]] for more information about styling options and other details. |
|||
{| class="wikitable" border="1" |
|||
=== Until release 3.9.7 === |
|||
|- |
|||
!style="width:150px" | {{Version badge 1}}Delphi Specifier for Cumulus 1.9.x |
|||
!style="width:150px" | [[File:Badge vMx.png]]Mono/.NET Specifier for Cumulus MX |
|||
!style="width:600px" | Displays |
|||
!style="width:600px" | Example |
|||
|- |
|||
|'xy' |
|||
|'xy' or ''\x\y'' |
|||
|Characters enclosed in single quotation marks are displayed as such, and do not affect formatting. |
|||
[[File:Badge vMx.png]]In MX each character to be displayed as it was typed can be prefixed by a backslash. Also remember that any spaces in a MX modifier might need to be within single quotes as space is also used to change what a modifier represents. I told you MX modifiers were more complicated! |
|||
The styling and library files were a one-off upload from '''CumulusMX/webfiles'''. These release use [[Cumulus_template_file|template files]], these are [[Customised_templates#What_is_meant_by_.27Cumulus_processes_templates.27|processed by MX to add the variable data]], and this will create web pages that are uploaded to your web site. |
|||
|Hyphens are added in this PHP language example '<#LastDataReadT format=yyyy>'.'-'.'<#LastDataReadT format=MM>'.'-'.'<#LastDataReadT format="dd">' |
|||
|} |
|||
Please read [[Customised_templates]] for further information about the various pages originally provided, and how you could customise them to suit you. |
|||
=== Comparison with legacy Cumulus 1 web pages === |
|||
* Note that any web files, designed for Cumulus 1, cannot be used with MX, for multiple reasons |
|||
** so if moving from Cumulus 1 to MX, delete all your Cumulus 1 files from the "web" and "webfiles" sub-folders, and all files from your web server; then upload files from the new "webfiles" folder. |
|||
* The standard gauges are rather like the stand alone [[SteelSeries Gauges|SteelSeries gauges]] you could optionally add to Cumulus 1, but the MX ones are different. |
|||
** The new default gauges page does not display a graph when you hover over a gauge (Cumulus 1 generated some images that the stand alone Steel Series gauges page could use) |
|||
* The various charts pages for MX rely on MX to generate files with time and value pairs, these are stored in json format, the various web pages use a library package (Highstocks) to draw graphs from those data pairs. |
|||
** (The Trends page provided as standard in Cumulus 1 simply displayed images of graphs uploaded to the web server) |
|||
== Alternative ways to obtain web pages == |
|||
You can choose to use some of the alternative web pages available from third parties and described [[:Category:User Contributions|on User Contributions page]]. |
|||
== Using your own web pages == |
|||
* Of course you can use your own web pages, instead of the standard ones. Assuming they need to include figures that are available as web tags, there are three alternative ways to implement this: |
|||
*# MX can process template files with a HTML structure and those web tags in the structure where values are required just as it does with the standard templates, and MX can upload the resulting web pages at either the real-time interval, the standard interval, or after end of day. All of this is covered on the [[Customised_templates|Customised templates]] page in this Wiki. |
|||
*# MX can process a file with a string of web tags mirroring the realtime.txt option in MX, and upload the resulting file so your web pages can use JavaScript for a one-off insert of the values or an Ajax routine to update the web page at a fixed interval. |
|||
*# Alternatively, you can use template scripts processed locally by MX that don't create web pages, but are uploaded by MX at either the real-time interval, the standard interval, or after end of day. These scripts simply initialise script variables with values obtained from web tags. You then independently have a set of web pages resident only on your web server (they don't exist where you run MX) using a combination of HTML and script content that bring in the script(s) with the variables by the appropriate syntax. All of this is covered on the [[Php_webtags|PHP web tags]] page in this wiki. As it suggests there, you might therefore have several files processed by Cumulus MX at these different intervals, converting the web tags into script variables, and then use AJAX (JavaScript that may use json format to bring in the variables) or PHP (using <tt>'require_once 'filename';</tt> syntax) to put those variables into a web page. |
|||
You may find [[PHP|this wiki page]] useful for understanding more about the different script languages. |
|||
=That is enough folks= |
|||
If you have read up to here, you now know the basics for using MX on Linux. |
|||
The remaining sections are more technical and so you can skip them. |
|||
=Technical Extra= |
|||
PLEASE SKIP ALL SUBSEQUENT SUB-SECTIONS IF YOU WANT TO AVOID TECHNICAL EXPLANATIONS. |
|||
== A very quick introduction to Linux == |
|||
This article is not the place to teach you Linux, you can find books and on-line articles for yourself, but I list here enough for you to understand the instructions used elsewhere in this article. |
|||
If you have a Raspberry Pi with a monitor attached, you will see a raspberry icon that you can click to get Graphical User Interface access to many features, including shutdown options. |
|||
=== su and sudo === |
|||
There is a command <code>su</code> that allows a terminal session to become a super user session with root privileges. If you use that command, without a '''sudo''' command in front, you need to type in the password (we changed earlier) when prompted. if you type <code>sudo su</code>, then you get root privileges without being asked to quote password. All subsequent lines in this terminal session will have a prompt that reminds you that you have root access and do not need to prefix subsequent commands with "sudo". |
|||
Normally, all terminal sessions will use the default "pi" user, and for individual commands, you will use a "sudo" prefix each time that command needs administrative rights, as this allows a standard Pi user to do tasks that otherwise only work for the root user. |
|||
You might use a "sudo" prefix if you need to access a part of the file structure that your user does not have any access to, or where the standard user does not have write (or execute) access. |
|||
There are also some commands (like displaying mounted storage) that are not available to a standard user. Here are 3 system commands that in terminal mode will only ever work with this prefix (although if you have installed the version of the Raspberry Pi Operating System that supports a graphical user interface you can also select these actions from a menu): |
|||
*'''sudo halt''' = stops any cpu functions, but leaves Pi running; used when you have reached the end of commands you want to do for now |
|||
*'''sudo poweroff''' = makes pi do a tidy shutdown and turn off its power; used when you will not be using your Pi for a while |
|||
*'''sudo reboot''' (or "sudo reboot -verbose" for diagnostic output during shutdown and reboot) = makes your Pi close down and then reboot; used when you change settings, and after you install new software, to ensure Pi starts with all applications running using the latest settings and latest already installed software |
|||
=== ~ and / === |
|||
The tilde symbol '''~''' denotes the home directory for the current user. Sub-directories within the current user's folder can be identified by '''~/documents''' or similar notation. |
|||
To reference a folder in root or any other area, the prefix is always '''/'''. |
|||
If you are using the RPi OS GUI, it provides a file manager that displays folders and files, and if you have a mouse you can click on an object to see what actions are available. The file manager has "Home" and "Root" as bookmarks by default, you can bookmark others. Typically, any new partitions created can also be accessed from bookmarks. Depending on options you select, there may be icons on the GUI desktop to link to particular folders and clicking on these offers various options including opening them in file manager. |
|||
In a terminal environment, to see what files and folders are in the current directory, type <code>dir</code> for just names or <code>ls</code> for details. |
|||
=== folder commands === |
|||
To make a new folder in the current directory, type <code>sudo mkdir folder_name</code>. |
|||
To remove a folder, that has no files in it, type in a particular path, type <code>sudo rmdir /path/directory</code>. |
|||
To remove a folder that does have files, and/or sub-folders within it, type tt>sudo rm -r /path/directory</code>, but remember the contents are gone for ever, so be absolutely sure you have specified the right folder! |
|||
To copy folders/files from one directory to another use something like <code>cp -R --update --preserve /home/pi/CumulusMX/backup/daily /media/pi/data/CumulusMX/archive</code> |
|||
Sometimes, you have a folder or file in just one place in the file system, but want to be able to access it at a different place (because something expects it in the second place), the syntax is <code>ln -s /path/elsewhere path/pointer_location</code>. |
|||
An example might be '''ln -s /var/lib/phpliteadmin/diary.db ~/CumulusMX/data/diary.db''' (phplite admin can only update databases in one folder /var/lib/phpliteadmin, or in older releases in /usr/share/phpliteadmin; while MX expects the file to be in its data folder but is happy with a logical pointer to another folder). |
|||
=== chmod === |
|||
When you are attempting any of the actions listed in this article that involve reading, creating, editing, exeduting, or moving, files; you might see an error message generally because of a lack of write (or execute) permissions on an existing file or folder. Whilst <code>rm filename</code> will remove a file even if it is write protected, for nano you need to change the file permissions with <code>sudo chmod -R ugo+rw ~/CumulusMX</code> for modify access to all files in your Cumulus installation (see the syntax below if you want to restrict access). |
|||
*'''chmod''' command to modify permissions |
|||
* the '''-R''' indicates recursive action (i.e. including not just the named folder, but all files within it and all sub-folders, and all files within sub-folders) |
|||
*letters indicating whose permission is being modified |
|||
** '''u''' = Owning user (sometimes the owner is the user root, sometimes the owner is the user Pi, for our web pages later we change ownership) |
|||
** '''g''' = Group (by default the owning user is also a group, but a group can be defined if you want to give multiple users (with different passwords) the same rights of access) |
|||
** '''o''' = Other users (write permission here is needed if for example you are using FTP to move a file from a PC to your Pi, or vice versa) |
|||
* sign for add or remove permissions |
|||
* '''+''' = add permission |
|||
* '''-''' = remove permission |
|||
*letters indicating what permission is being changed |
|||
** '''r''' = read [4] |
|||
** '''w''' = write [2] |
|||
** '''x''' = execute [1] |
|||
Note that as an alternative shorter syntax you can use numbers e.g. '''666''' is equivalent to '''ugo+rw'''. The first digit in the number relates to ''u'', the second to ''g'' and the last to ''o''. The values in [] brackets in list of permissions above are added to derive each digit. So if you are reading the Cumulus support forum and you see a reference to permissions which includes a string of 3 digits, now you can understand what is meant. |
|||
=== editing files === |
|||
*Do remember that file names are case sensitive. |
|||
*If you use the wrong case in a path/file name, it will be treated as a different "new" file. |
|||
*If a file editor does not display content you were expecting, look in case "new file" message appears because you have made a typo in the path/file name. |
|||
There are various text editors available on a Pi, |
|||
*if you have a mouse and click on a file, you should see "text editor" listed, that loads '''Mousepad''' which has a menubar at the top of its "Windows" like interface. |
|||
*in terminal mode '''nano''' is a text editor that by default lists the actions available making it easier for a novice to use. |
|||
*in both the GUI and terminal mode, Geary is a programmer's editor with lots of useful funtionality |
|||
All editors can create a file when a file does not exist and edit (subject to file permissions) an existing file. Use prefix of 'sudo' to give you access to any file irrespective of ownership, '''sudo''' does not change the actual file permissions, so you might find you can read a file, but not save it after you have done your edit. |
|||
====nano==== |
|||
The full syntax is <code>sudo nano -B Path_file_name</code> where the '''-B''' means it will create a backup of how the file was before (this can be enabled while in the editor by pressing the control key down and typing B). Alternatively use '''-C''' which stores each version in a back-up directory. If you want to edit from a particular line and column you can use '''+line.column''', and also optionally use '''-l''' (lower-case "L") to display line numbers which might be useful when trying to correct a problem with a log file like [[dayfile.txt]]. If you don't specify a file name, then nano will create a new file and you will need to specify where to save it before exit. |
|||
== Using HTML tags within format parameters (available in MX only) == |
|||
After typing the nano command you need to specify a filename (it might include a path, see earlier sub-section for use of '''/''' and '''~''') and there are examples later in this article, but if you decide to ''host a web site on your Pi'' then you might want to edit its home page with (.html or .php) name like <code>sudo nano /var/www/html/index.php</code>. |
|||
'''Example using a class to change the look of part of the output''' |
|||
After you have made an alteration to the current contents of the file, various options are shown at the bottom. Here are two key ones: |
|||
*First is '''^O''' which is used to save the file whilst staying in the editor, to do this press the control key down and type O. Next it shows the current file name, if you press '''Enter''' then that file will be overwritten. |
|||
**it allows you to type over the file name shown. If you choose to save as another file, you will be asked if the new name is correct (type '''Y''' to continue saving). |
|||
*Another is '''^X''' which means if you press the control key down and type X you get the exit dialogue. If you have not made any edits, or have already saved the file, this just exits the editor. If you have not used control and O to save the file, it asks whether you want to save the edited file (type '''Y'''), typing just the Y key lets save continue (any other key stroke exits without saving), then it shows the current file name, if you press '''Enter''' then that file will be overwritten. |
|||
<pre><#TapptempH format="dd' 'MMM' 'yyyy'<span class=\'xx\'> at 'HH:mm'</span>'"></pre> |
|||
You might find it useful to type <code>sudo nano /etc/nanorc</code> as this puts you into the configuration file for nano where you can set back-up, line-numbering, and other options. |
|||
the output from this will look like ''04 Dec 2018<span class='xx'> at 10:12</span>'' |
|||
'''Note where the quotes are, and where you need to use '\' escape characters'''. |
|||
====Geany==== |
|||
'''Example using HTML tags''' |
|||
This uses a GUI, you can set preferences and do all other actions using either menu selections (use mouse or keyboard) or control sequences (on keyboard). Once it knows what type of programming language, it can colour up the code; it can show you how many times variable identifiers are used; it can match opening and closing quotes, tags, and brackets; and it can ensure encoding and line terminators are correct. |
|||
<pre><#RecentTS d=2 format="h:mm' 'tt'<small>on' d/M/yyyy'</small>'"></pre> |
|||
Line-numbering is an option, so it can be used to edit MX log files, and (as BOM is an encoding option) you can be sure it won't add unwanted encoding. |
|||
This puts the date in a smaller font than the time |
|||
== removing an unwanted file == |
|||
You can remove a file with various commands, including <code>sudo rm filename</code>. |
|||
== Migrating from legacy Cumulus 1 to MX== |
|||
=== external storage === |
|||
If you have created any legacy cumulus template files, then in each template, you will need to do some editing. Everywhere a web tag appears with an output modifiers that is used to specify a date and/or time format, has to be edited before that template will work for MX. |
|||
Generally, if you attach USB storage (a disc or a stick), Linux OS distributions will detect any existing partitions (yes a technical term) and allow you to read files stored in them. This applies whether the partition is formatted for Linux or for Microsoft Windows. |
|||
Here are the main reasons: |
|||
However, you may have a brand new, unformatted, drive, or you may want to delete, or add partitions, or to format them as Linux partitions (as these make the input/output significantly more efficient). |
|||
* the reserved characters are different in C1 and MX (affecting use of literals like "on" and "at" that appear in many English time-stamps) |
|||
* the Delphi in legacy Cumulus is case insensitive, so for example "H" and "h" have the same meaning |
|||
* MX is case sensitive, and symbols mostly have different meanings when one symbol is used to when that symbol is used with others, so for example "H" and "h" have different meanings, and if not used with other symbols will need to be preceded with a "%" to have same meaning as they have in combination with other symbols |
|||
* In the legacy cumulus, a symbol like "d" has the same meaning for any tag |
|||
* MX is inconsistent, a symbol like "d" changes its meaning depending on the tag it is used with (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) |
|||
* the symbols used for representing such modifiers as minutes, month, am/pm, are different between C1 and MX. |
|||
* 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) |
|||
* In the legacy Cumulus, a space is a gap between characters |
|||
* In MX, a space must be within a literal, as a space before a symbol has the same effect as "%", (it changes the interpretation of a modifier character). |
|||
'''Confused even more now?''' I'm not surprised, but maybe some examples will help. |
|||
You can install software that uses a GUI to make this easy, e.g. '''gparted''' [https://gparted.org/ partition editor]. |
|||
=== Examples === |
|||
*Examples related to case selection |
|||
Alternatively, you can use a terminal session, and lots of commands: |
|||
*#[[File:badge v1.png]] In Delphi, "nn" means "minutes" for Cumulus 1, [[File:Badge vMx.png]]but "minutes" is "mm" for .NET or MONO in Cumulus MX. |
|||
#connect your external storage |
|||
*# The hour in 24-hour format with leading zero, in non case sensitive Delphi (Cumulus 1) 'HH' or 'hh' would be treated as same, but in .NET or MONO it must be "HH" (Cumulus MX). |
|||
#type '''su''' to gain administrative access |
|||
*# The hour in 24-hour format without leading zero, in non case sensitive Delphi (Cumulus 1) 'H' or 'h' would be treated as same, but in .NET or MONO it must be "%H" (Cumulus MX). |
|||
#enter your RPi password |
|||
*# For 12-hour specifiers, please see the table, as this is far more complicated. |
|||
#type '''fdisk -l''' (this is only available to root user) to see names for all storage your Linux computer can see |
|||
*[[File:Badge vMx.png]]You might be put off by references within .NET and MONO (Cumulus MX) to single/standard characters and custom modifiers, the following 3 examples may add clarity: |
|||
#an external drive will be named something like ''/dev/sd''''a''''' although that "a" might be "b" or a subsequent letter in alphabet depending on what has already been assigned |
|||
*#For example, ''<#MonthTempHD format="d">'' is a single character format modifier, therefore the 'd' acts as a standard modifier, and causes for a date of 22 July 2014 for the highest temperature in the month to be returned in the standard short date format e.g. '22/07/2014' (exact contents for any one date vary by locale). |
|||
# if "sda" and "sdb" appear, or any others up to "sdz", the last one will relate to the most recently connected storage |
|||
*#Similarly, ''<#MonthTempHD format="M">'' is a single character format modifier and therefore the 'M' acts as a standard modifier and causes the date for the highest temperature in the month to be returned in the standard day and month format e.g. '22 July' (exact contents for any one date vary by locale). |
|||
#if your drive has partitions, then you will see further entries like '''/dev/sda1''' and ''/dev/sda2''. |
|||
*#Whilst ''<#metdate format="d M">'' is not a single character format modifier and therefore both the 'd' and the 'M' are interpreted as custom modifiers and cause the current date to be returned as a digit(s) for the day and a digit(s) month (in a without leading zeroes format) e.g. '6 7' would be returned for 6 July. |
|||
#type '''df''' to see whether your drive is currently mounted (being used by computer system) |
|||
*#Alternatively, ''<#MonthTempHD format="%d">'' is NOT a single character format modifier, therefore the 'd' acts as a custom modifier, and causes a date of 22 July 2014 for the highest temperature in the month to be returned as the day of the month only '22' in all locales. |
|||
#if it is mounted, the command to use next is (type this accurately, there is a temptation to type an English word that adds an extra "n"!) <code>umount /dev/sda</code>, obviously replace the "a" by the appropriate letter seen in the earlier command |
|||
*#Similarly, ''<#MonthTempHD format="%M">'' is NOT a single character format modifier and therefore the 'M' acts as a custom modifier and causes the same date for the highest temperature in the month to be returned as the month number '7'. |
|||
#if the drive does not have a partition, create one using <code>fdisk /dev/sda</code>, again changing the "a" into whatever letter was seen in response to the first "fdisk" command |
|||
#*"fdisk" is a utility, it will wait for further instructions, follow each with pressing "Enter" |
|||
#*type '''n''' as instruction to create a new partition |
|||
#*type '''p''' to make this the primary partition on this drive |
|||
#* type '''1''' to make this the first partition |
|||
#*accept default offered for first cylinder |
|||
#*accept default offered for last cylinder, if this is only partition, as that ensures the whole disk (apart from partition table) is available for your data |
|||
#*for simplicity, this guidance will not cover the possibility of multiple partitions |
|||
#*type '''t''' to say you are specifying the way you want this partition to be specified in partition table |
|||
#*optionally type '''L''' to see what file system types are available for the partition table |
|||
#*to select a "Linux" partition, type '''83''' |
|||
#*type '''w''' to create the partition you have now specified for Linux. |
|||
#Now we have a partition table and a partition on our drive, we can repeat '''fdisk -l''' to see the entry now added, it might be '''/dev/sda1''', where again the "a" might be a different letter |
|||
#To format this partition for Linux, we specify "ext4" as the way to format it using <code>mkfs.ext4 /dev/sda1</code>, again replacing the "a" as required. |
|||
#we need to create a folder within |
|||
#*"/media" for Linux in general |
|||
#*"/media/pi" for Raspberry PI OS |
|||
# As we will learn later, the relevant command (in RPi OS) is '''mkdir /media/pi/my_short_name''', where "my_short_name" is selected by you |
|||
#To mount our partition, we type <code>mount /dev/sda1 /media/pi/my_short_name</code>, where "sda1" is replaced by "sdb1" or whatever we saw in '''fdisk -l''', and "pi/my_short_name" is replaced by whatever we used in our make directory command. |
|||
#To (optionally) get our partition mounted at boot, we can use an editor (see later) to change the boot instructions, by typing <code>nano /etx/fstab</code> |
|||
#*In the editor, use the down arrow on your keyboard to move to last line, and then type '''/dev/sda1''' (change the "a" as necessary), then press "tab", then type '''/media/pi/my_short_name''' (change "pi/my_short_name" to whatever we used in our make directory command), then press "tab", then type '''ext4''' (again matching the format type we selected earlier), then press "tab", then type '''defaults''', then press "tab", then type '''1''', then press "tab", then finally type '''2''' |
|||
#*save the file (as described later in nano sub-section), hold down control key and press '''o'' letter key. Press "enter" again to confirm same file name. |
|||
#* exit nano by holding control key and pressing "x" key. |
|||
In both Cumulus 1 and MX if you want a space character within your output, the output specifiers must be enclosed in double quotes. If that space character is next to a non modifier (e.g. around word "at") then the single quote needing to surround the at should be widened to include the spaces in MX, but Cumulus 1 does not care if single quotes excluded spaces. However, with MX, single quotes enclose multiple characters, but there is an alternative way to deal with some single verbatim characters to cover next. |
|||
So let us compare these two alternative ways that MONO and .NET escape any characters that are not being used as format specifiers. |
|||
== Package Manager – a brief technical aside== |
|||
* In [[File:badge v1.png]]Delphi you can put the 'verbatim' characters inside single quotes (Cumulus 1); this is often used to (in English) include words like ' on ' and ' at ' in the formatted output. |
|||
*in [[File:Badge vMx.png]].NET or MONO you can still use single quotes (as mentioned above extended to include adjacent spaces), |
|||
** but alternatively you can escape each verbatim character with a backslash as prefix (Cumulus MX). |
|||
* You may need to use both single quotes and back slashes in some format specifiers, depending whether the characters you want to include can be interpreted as control characters (yes, backslash is also used to escape control characters, so backslash will NOT work for some characters such as those in "on" and "at" [\n will produce new line not the letter n, \t will produce a tab not the letter t]), consequently for some characters you must use the literal approach to include them in your format. |
|||
== Past history for this page== |
|||
Linux operating systems install software by looking in repositories, and checking a register showing dependencies. When you ask Linux to install a particular package using “apt”, it also checks if all dependencies of the selected package are already present, and installs any that are missing. |
|||
This page is a complete redesign of how to present information that was previously on the [[Webtags]] page, so look there for past content by selecting "history" tab. |
|||
If you look up on-line how to install any software in Linux, it may use “apt-get”, that is an earlier package manager, in general you can use “apt” instead now. |
|||
Trying to make the old design made for the original Cumulus software, work for MX which is now very different, made the old page unwieldy. |
|||
The full differences between “apt” and “apt-get” depends on your Linux flavour, so this technical aside now splits further discussion by Linux flavour. |
|||
===Debian as used by Raspberry Pi=== |
|||
== Forum reference == |
|||
“Debian Linux” (and its derivatives such as “Raspberry Pi Operating System”) uses “apt” to mean a ‘’’Package Manager’’’ that can install, update, and remove packages from these computer systems. |
|||
Steve Loft published a table showing comparison between output date modifiers for Cumulus 1 and MX at [https://cumulus.hosiene.co.uk/viewtopic.php?f=39&t=17888 Cumulus MX forum]. The table there was based on the table that appeared in this Wiki when only the original Cumulus existed, so it was designed to help people migrate to his MX beta, it was not intended as a definitive list of what modifiers were available for MX (Steve instructed people to look them up on some Microsoft sites). |
|||
For Debian Linux, “apt” is directed at the end-user (it has user friendly features like a staus bar showing progress on a long install or long upgrade, and can produce prompts about what it is doing and can give choices about whether to do individual actions). |
|||
The subsequent comments in the forum suggested his layout got people confused. Most of that confusion came in two circumstances: |
|||
There is an alternative “apt-get” which is more powerful, but directed at system level users (those who don’t want to be watching progress and possibly responding to prompts). |
|||
*When someone wanted to use one date or time modifier on its own |
|||
*When someone who had been using Cumulus 1 swapped to MX and wanted to replace a combination of output modifier characters that was not explicitly shown in his table. |
|||
That all comes from the fact that when a MX modifier consists of a single character it can mean something different to when it appears with other characters. |
|||
As “apt-get” is updated less frequently than “apt”, it may be it will not work with new packages. Put another way “apt-get” may never change what it can do, but “apt” may get modified to do more than it did before. |
|||
In Cumulus 1, "m" or "M" had two meanings depending whether it was combined with "H" or "h" (when it represented minutes), or on its own or with any other code (when it represented month). But for Cumulus 1, there is no other case where it matters what context a modifier is put in by the use of other modifiers, and no other modifier takes more than one meaning. |
|||
===Ubuntu=== |
|||
In MX it is much more complicated, to take a few examples "D", "H", "M" represent different items on their own to what they represent when combined with other characters. That other character can be as simple as using a space or a "%" to modify the meaning of the character. |
|||
For Ubuntu only “apt-get” was available up to 2014, when “apt” was added. Both work as described above for Debian. Again “apt” is best to use. |
|||
Looking at the tables, now included above, you can see "G" is used on its own because it represents a full date-time specifier. "D" is similarly used on its own represents the long date format. If we only want the day of month number we must use "%d" to avoid the meaning of short date format that "d" on its own represents. |
|||
===Mint=== |
|||
If we want the typical Cumulus date-stamp of day of month number and month, then we have two choices, because both "d M" and "M" will work. This illustrates how "M" has a different meaning on its own and with another modifier. |
|||
Linux Mint has a different variation. Its “apt” calls its “apt-get” and adds extra features. So both effectively do the same, but (as with previous flavours) “apt” is best to use. |
|||
Hopefully, the way that information is now presented on this page makes any use of parameters for web tags much easier now. |
|||
It is likely that other Linux variants will also vary how these alternative commands differ. |
|||
Revision as of 22:42, 13 December 2021
![]()
This Wiki page applies to both flavours of Cumulus currently available.
Introduction
This page is about parameters used for modifying Cumulus web tags.
A Cumulus Template File is the name given by Steve Loft to any files that contain web tags. Each of those files need to be processed before they actually include values:
- MX avoids using these template files, the code itself internally generates most of the data files that are sent externally.
- The legacy Cumulus 1 software, and MX releases up to release 3.9.7 - build 3107, used lots of template files (see Customised templates.
For Cumulus MX, there is still one Cumulus template file, the web tags that supply values to the various tables in the Default Web Site are stored in websitedataT.json file. Most of those web tags use the default output format, but a few use some of the #Output modification parameters listed below. To customise the default web site, you might want to edit websitedataT.json, by using information found on this page.
To set context, let us learn the terminology with cross-references to where those features are explained further.
What is a web tag?
Put simply, a web tag is included in a Cumulus template file to indicate where Cumulus should insert values when it processes that template and produces an output file.
The output file can be:
- a web page,
- a JavaScript Object Notation (.json) file
- a JavaScript file,
- a PHP script file, or
- a eXtensible Mark-up Language (XML) file.
General Format for Web Tags
In the position in the template file where Cumulus is to insert the relevant data, place a web tag in the general format specified here:
<#tag_name [optional input selection parameters] [optional output modification parameters]>
Case sensitivity for tag names
The tag_name in the general format above is case sensitive, so please type the tag name exactly as shown in the tag name columns in the tables on the tag names page.
What is a web tag parameter?
Now we get to the terminology for what this Wiki page will document.
The parameters shown in the general format above are of two kinds:
- Input modifying
- Output modifying
You can include both optional input modification, and optional output modification parameters
- As the general format above shows, you separate them with spaces, e.g. <#ByMonthTempHT mon=7 format=hh:nn>.
- In that example, the time only is returned for the highest ever temperature in July, after processing by Cumulus of the time-stamp web tag.
Case sensitivity for parameters
The optional input modification parameters always use lower case, so please type them exactly as shown in the section below.
The content of optional output parameters are only case insensitive when used in Cumulus 1.
For Cumulus 2 and later, so this includes MX, the output parameters are case sensitive and also dependent on what other output formatters are being used if any, so please read the sections on output parameters and study the examples in the tables carefully.
Input modification Parameters
Most web tags do not require any input parameters. Luckily, where they are needed, it is quite simple to use them, see table below.
- An input parameter is used where the same web tag can represent a value for a number of different past time instants.
- Each of those past time instants is represented by a different value for the input parameter.
- So a combination of web tag name and input modification parameter lets Cumulus select the value you want to see.
- The web tags that can use input modification parameters will depend on which Cumulus release you are using
| Tag names | Values Available | Input Modification Parameters | Introduced | Examples | Description |
|---|---|---|---|---|---|
| Tag names listed at Table of Recent History tag names available (see Recent history page for explanation) | One value for each minute in last 7 days | d specifies number of days ago,
h specifies number of hours ago, and m specifies number of minutes ago.
|
Cumulus 1.9.3 beta build 1033 (remain available in MX) | Examples for outside temperature:
|
All values supplied for parameters must be whole numbers.
|
| monthly all-time extreme records | These exist for all occurrences of the current month, and for all occurrences of each month | mon=N
where N is the index of the month of the year that you want the value for (1 =January, and so on, to 12 =December) |
Cumulus 1.9.3 beta build 1033 (remain available in MX) | <#ByMonthDewPointH mon=3> is highest monthly dew point for any March and <#ByMonthDewPointHT mon=3> is the related time and date.
<#ByMonthTempH mon=3> gives highest temperature in any March, <#ByMonthTempHT mon=3> gives the date and time for that highest temperature |
Only one input parameter applies:
Use without an input parameter applies if you want to write a template that will always supply values for the current month and don't want to process a script, to calculate the correct input parameter, before Cumulus processes the template. |
| Only <#SunshineHoursMonth> and Only <#SunshineHoursYear> | Values available for current month/year, and for past month/year | Listed web tags take: r=-ww (note minus sign and up to 2 digits)
Omit input modification parameter to get value for current month/year |
MX release 3.12.0 | Monthly examples:
Yearly examples:
|
Returns the sunshine hours total in selected period
(You need a sensor to be monitoring this throughout selected period) |
Output modification parameters
This page does not tell you which web tags fall into each of these 3 types:
- A few web tags always need an output format specifier
- Some web tags ignore any output format specifier as they have a fixed output format
- The majority of web tags have a default output if there is no output format modifier, but accept an output format parameter, so you can change what they output.
To make life more complicated, the availability of output format parameters for particular web tags is dependent on which Cumulus release you are running. There is a general discussion about applicability, but that needs updating as it does not specify dependencies for individual web tags.
If you are using MX:
- if your locale specifies that integer and decimal parts of real numbers are separated by a comma, there is an output parameter to replace that decimal comma by a decimal point for any script that does not recognise decimal commas
- there are two output modifiers for changing number of decimal places
- there are multiple output modifiers for changing date and/or time format
If you are using the legacy Cumulus (or a very early MX release), please skip to #Two Output (format modifier) parameters for decimal places as the changing decimal comma into decimal point parameter is not available to you.
Each of these will be explained in turn.
Output Modification Parameter for changing any decimal comma into a decimal point
General format: <#tag_name rc=y>
This only applies:
- if the web tag name represents a real number with integer and decimal parts
- if you are using MX
- From beta release 3.0.0, build 3047 (3 February 2019), up to and including release 3.5.3, only implemented on a few new web tags (#MoonPercent, #MoonPercentAbs, #MoonAge)
- From release 3.6.6 onwards (1 June 2020), it was extended to other web tags that output real numbers.
- From release 3.10.5 onwards (29 March 2021), the use of <#tag_name rc=n> became also possible, to ensure decimal comma shown when locale specifies it
This output modification format parameter can be used to replace all commas in the output by a full stop (don't worry, MX does not use a comma for separating off thousands, so it is the decimal comma that becomes a decimal full stop like character when this remove comma specifier is used).
| Parameter | Explanation | Example |
|---|---|---|
| rc=n | This is the default, so does not need to be specified. The output from the web tag will use either decimal comma or decimal point as specified by the locale in which MX is running
For more information about how the computer determines whether decimal commas is your default, see #Locale section later. |
Both <#tempYH> and <#tempYH rc=n> will return yesterday's highest temperature using what is specified by locale to separate integer and decimal parts |
| rc=y | the attribute rc takes the value 'y' to replace any commas defined by the locale with full stops to separate integer and decimal parts of the output value. | <#tempYH rc=y> will return yesterday's highest temperature as integer part then full stop then decimal part, regardless of local |
Why would you want to remove decimal commas? Well because the JavaScript language cannot understand decimal commas, and MX has several scripts written in this language, equally some third party alternative web pages rely on ajax to update them (and Ajax uses JavaScript).
Controlling the number of decimal places
Internally, Cumulus stores numbers in binary. You cannot represent base 10 decimal places exactly in base 2.
Therefore, Cumulus stores to a precision that would generally give about 24 significant figures when expressed in base 10.
Cumulus is written to assign particular numbers of decimal places to any outputs it makes, and in any logging of current, or extreme values (for day or longer periods). It determines these precisions, by reference to the units chosen for outputs.
From release 3.12.0, you can set the default number of decimal places to output for all derivatives of temperature, pressure, etc. by advanced settings. Those settings can force output as integers, stopping these modification parameters from working.
As handling of each web tag is coded individually, the number of decimal places output by default in any web tag might vary slightly from the above default. As Cumulus has been developed, people have commented that these defaults do not reflect the precision of their instrumentation (weather stations used with Cumulus tend not to have the accuracy of those used by meteorologists, or are not recalibrated as often).
This section (and its subsections) only applies to tag names that output real numbers (with integer and decimal parts). You can't change anything that is output as an integer, or is text with these parameters, nor can you change the decimal places for any time element.
Consequently, gradually Cumulus has allowed more and more of its output to take an output format modifier that allows people to control number of decimal places shown.
Two Output (format modifier) parameters for decimal places
From release 3.10.5 (which did a big rewrite of web tag handling), you can modify real number output for individual tag names, using output modification parameters in either of the following formats:
- <#tag_name dp=i> and
- <#tag_name tc=y>
These can be applied to any tag names that represent real numbers (with integer and decimal parts).
Rounding to a specific number of decimal places
dp=i is used for both Cumulus 1 and MX.
- The value i following the attribute dp is an integer, it represents how many decimal places you want for the output you see.
This functionality was trialled in the original Cumulus, but has been properly implemented in MX.
If you are using the legacy Cumulus (1.9.4), only <#latitude dp=i> and <#longitude dp=i> were able to be output with "i" denoting number of decimal places, e.g. <#latitude dp=5> gives "59.24250".
If you are not using latest MX release, you may find this is not available for particular web tag names
- From beta releases (3.0.0) onwards, <#latitude dp=i> and <#longitude dp=i> were able to be output with "i" decimal places
- But this output modification parameter could not be applied to any other tags in the MX beta.
- MX when it came out of beta, added this output modification parameter usage in the moon tags <#MoonPercent> and <#MoonPercentAbs>).
- Specifically, <#MoonAge> gives "11" but <#MoonAge dp=3> gives "11.234"
Truncation of unwanted decimal places
This output format modifier is only available in MX.
tc=y is the truncation parameter, the attribute tc takes the value 'y' to remove decimal places by truncation. e.g. <#MoonAge tc=y>.
Whilst many people want Cumulus to round output as done by the previous parameters, there are circumstances when rounding down (or truncation) gives the result desired.
- If you are using an early release of MX, you will need to research whether this is available for particular tag names
- Later releases of MX implement this for any tag that by default outputs decimal places.
Note, truncation by MX converts real numbers to integers. There is no option to truncate to one decimal place, Airports are expected to report air field level (QFE), and sea level (QNH), pressures truncated to one decimal place rather than rounded.
Multiple Output Format Modifier parameters for times and dates
These are highly complicated, and so have been left until after the simpler ones!
To start with a simple example, suppose you want date/time in ISO 8601 format:
- This means, something like 2019-02-28 06:59:05.
- Take the tag name (from tables on Webtags page)
- Next check in #Which tag names take date/time output formatting modifiers to see if that tag accepts both time and date modifiers
- If our tag name does accept both date and time modifiers, simply modify the web tag as shown here
<#tag_name format="yyyy-MM-dd HH:mm:ss">where tag_name is set from step 1, but all the rest is typed as shown. - To explain each element in that format value, look in #Year formats, #Month formats, #Day formats, #Use of spaces, #Time formats.
Should you want a different date/time format, then the sub-sections just referenced should help you to select a different arrangement, although there are some more options in #Date formats.
Which tag names take date/time output formatting modifiers
There are nearly a thousand different tag names.
There are a few time-related tag names labelled as being fixed format, that means any time/date output modifiers you might try would be ignored.
Some tag names, although it can be hard to tell which, report durations. You can use time modifiers to change how these are reported. Examples include <#daylength format=H:mm:ss> and <#MonthDailyRainHD format=H:mm>.
Time modifiers can also be used to change the way that clock times are reported, you might only want the hour, or you might (if resolution is available) want to also see seconds. The webtags page has columns headed "Time" to clearly identify all tag names that report clock times.
There are some tag names (e.g. moon rise) that relate to an event that does not happen each Earth day, so those tags have to be able to report "--:--", and you cannot modify their output.
There are some tags (e.g. highest temperature range in month/year), for which Cumulus has been coded to report "--" for value, and "--:--" for time, on the first day of that period (because there is only a partial day to consider you might not yet have experienced a true maximum and a true minimum), so modifying the time output can only be done on subsequent days.
It is not practical to indicate which time/date modifiers are accepted on a tag by tag basis. It would involve a lot of repetition. Instead, the following table, explains much more simply, which web tags will accept time and/or date output modifiers:
| Cross-reference to table on web tag names page | Tag names that accept only time output modifiers | Tag names that accept only date output modifiers | Tag names that accept both time and date output modifiers |
|---|---|---|---|
| Any tag names that don't report times nor dates | None | None | None |
| Webtags#No_Commas | None | None | None |
| Webtags#Date_.26_Time, Webtags#Day/Night/Sun/Moon | Only <#timehhmmss>, <#minute>, <#hour>, <#sunrise>, <#sunset>, <#dawn>, <#dusk> | Only <#LatestErrorDate>, <#date> (but no others) | Only <#LastDataReadT>, <#time>, <#metdate>, <#metdateyesterday>, <#update>, <#LastDataReadT> |
| Webtags#Today, Webtags#Yesterday | Any tag name in "Time" column of linked table | None | None |
| Webtags#Monthly, Webtags#Yearly | Any tag name in "Time" column of linked table in first column | Any tag name in "Date" column of linked table in first column | None of the tag names. For explanation see the ^ below this table |
| Webtags#All_Time, Webtags#Monthly_All_Time_Records | None (all tag names combine both time and date) | None (all tag names combine both time and date) | Any tag name in "Date/Time" column of linked table |
| Webtags#Davis | None | <#StormRainStart> only | None |
^ For the monthly and yearly web tags, the date and time are in separate tag names. It is not possible to get both time and date out of either tag name.
Note: There are some monthly/yearly web tags (e.g. wettest day) where a date tag is available (i.e. <#MonthDailyRainHD>), but there is no time tag. As explained before, in that wettest day example <#MonthDailyRainHD format=H:mm> returns the duration in hours and minutes since rollover for which rain continued to increase on that date, not the clock time. For rainfall, only <#LastRainTip> can have output modifiers added to report a clock time.
Locales
The default format for many tag names reporting date and/or time is dependent on the locale you are using for running Cumulus (1 or MX).
The effect of some output format modifiers is also dependent on locale.
For MX running on most operating systems (and therefore using Mono), type locale to see the default locale that will be adopted when mono-complete is installed as MX will, by default, take locale setting from Mono. When you start MX, you can ask it to use a different locale to that picked up by Mono, by adding the parameter "-lang locale-code", see examples at MX_on_Linux#Parameter_for_changing_Locale. For example, the Australian English language with UTF-8 encoding locale is defined as: en_AU.UTF-8.
The available locales on your computer in Linux are listed by locale -a. For example, the Russian locale would be selected as the one your computer uses for the current session only by using LANG=ru_RU.utf8 either typed into a terminal session before you start MX, or used as a parameter (preceded by "-") as you start MX interactively.
For permanently changing the locale used by your system, the instructions vary considerably according to the kernel used in your operating system, so you need to look up the instructions for yourself. However, if you have a graphical user interface, such as the full Raspberry Pi Operating System provides, you might have a configuration command in terminal mode and a configuration app accessed (within Preferences) from the "Raspberry" key on the official keyboard. For the Raspberry Pi, please read Raspberry Pi computer page for more details.
For Microsoft Windows Operating Systems, a Language is defined within the "Region" page of the Settings app. That should be sufficient for the legacy software that uses Delphi.
However for MX date and time formats within Windows Operating System, you must use the older Control Panel (go to "Clock and Region" screen, choose "Change date, time or number formats", choose "Language preferences") because it is only there that you can adjust all the defaults used by .NET.
Time zones
Before I explain what time/date output modifiers can do, something they can't do.
All web tag outputs are in local time, except <#timeUTC>.
Although Cumulus 2 internally stored all date/times in UTC, no flavour of Cumulus is currently able to output the time-stamp for any weather extreme in UTC, if your current time is not in UTC.
However, for MX only, you can use a script to convert a time to UTC. This is not the place to tell you how to write the script, but taking time of highest pressure today as an example, you would use <#TpressTH format=Hh:mm> and <#TpressTH format=zzz>, the first gives hours and minutes in your local time, and the second gives the offset that needs to be applied to that time to convert it to UTC.
Time resolution
For the legacy software, there may be no point in asking for seconds, as Cumulus 1 did some actions at one minute intervals.
If Cumulus obtained archive data, as part of the catch-up process it can do when it restarts, any time-stamps for that period can only be the time of a particular archive record, so that might be every half an hour, but not aligned precisely with hour changes.
Dependency on Cumulus flavour
You cannot,in general, use the same date/time formatting for both the original (legacy) Cumulus and MX.
All the tables explaining what is available, attempt to show what is used in each flavour for each type of output, both by including separate columns for each flavour, and by giving examples in each flavour.
For the legacy software
I deal with this first, just because it is simple!
From version 1.9.1, most web-tags that report any form of time or date will accept an optional 'output format' parameter (we have already seen whether this can only affect time, only affect date, or both).
The legacy Cumulus uses Delphi to interpret the output modifiers:
- For most modifiers, a particular character produces the same output regardless whether the output modification specifier is in capitals or lower-case
- There is an exception, the case you use for any am/pm output format modifiers determines the case that is output.
- In general, the context of a modifier does not affect the output it produces
- Again, there is an exception, "m" or "M" has two different meanings (minutes or month) depending on context.
The complications with MX
Cumulus MX works internally with dates specified in either a day before month before year format, or ISO 8601 date format where year comes first (yyyy-MM-dd) depending on context. Compatibility with the legacy software has so far meant while the *.ini Files have adopted the year first approach, the *.txt Files have stuck to date formats as used in the legacy definitions.
For Cumulus MX output formatting, the date and time modifiers are complicated by the fact that the same character can have 4 different meanings depending on its case (capital letter or lower-case letter), and depending on whether it is on its own (standard format) or with another modifer (custom format). Sounds confusing? Well it is complicated.
Consider context first:
- <#tag_name format=x>
- If the x in the above general syntax is a single character, it represents a standard format code
- The standard characters for dates and times are defined at standard-date-and-time-format-strings
- <#tag_name format=xyz>
- If the xyz in the above general syntax is replaced by two or more characters, it becomes a custom format code (combinations of characters, or single characters prefixed by %)
- The custom characters for dates and times are defined at custom-date-and-time-format-strings
Consider case next:
- Cumulus MX (when running on Windows) uses the .NET software which is provided as standard by Microsoft Windows.
- ".NET" was originally operating system independent, later only Microsoft Windows specific components were included, but since November 2020 ".Net" is used for an operating system independent version that originally Microsoft issued under another name!
- (actually it is possible to install and run "Mono" in Windows Operating Systems).
- If Cumulus MX is running on any Linux distribution (including Raspberry Pi Operating Systems) or Mac OS X, or any other device that uses an UNIX derived operating system, then MX uses Mono software for same purposes. (MONO is a operating system independent version of .NET, although they are developed independently, they have common origins).
Use of spaces
There are multiple symbols for specifying dates and times, and you might want spaces to appear between symbols in that output format.
You need to add quotation marks to the output format specifier if spaces are present.
The first complication is that the parser that interprets time/date characters has two ways of interpreting a space character, depending on what immediately follows. In the tables, below, I have used a "%" in various places. In any of those places, a space is not a gap between characters, but an alternative to "%". I discuss this later in #Migrating from legacy Cumulus 1 to MX section.
For a space character to be interpreted as a gap between symbols, the symbol that follows the space must include at least two characters. The syntax <#tag_name format="x y z"> works if the y and z in it are representing multi-character symbols. To explain this, an example is <#TpressTH format="h:mm tt"> as both h:mm and tt are multi-character symbols, we have inserted a space after the minutes.
If we have single character specifiers, then a space has to be enclosed in single quotes to mark it as a literal, not a modification of the subsequent single character. To explain this, a simple example is <#MonthPressHD format=" d' 'M">, here the month number is a single character "M", so to insert the space we have to treat it as a literal by enclosing the space character in single quotes and the whole specifier in double quotes.
Literals are discussed fully in the #Including literals in format parameters sub-section later. If we want to include other characters not to be interpreted by the date time parameter parser, and spaces, then both double and single quotes must be used, and the spaces must be within the single quotes. An example, that shows all the options that MX allows, with literals is <#TpressH format="\a't 'h:mm' ' tt' <small>on 'd/M/yyyy' </small>'"> .
Finally, the use of literals can cause you a problem if you want to use a date/time specification in a script because the script wants literal delimiters outside any web tags, so that delimiters remain when the web tag itself has been processed into a string by Cumulus. This means the type of quotes (single or double) used outside the web tag, cannot be used within the web tag. The complicated sounding (but actually simple solution) is to avoid placing literals, and/or spaces, within any output format specifier, instead put single quotes round the whole content. What you thought of putting as literals within any web tag is instead typed outside with separate web tags for the part of the specification before and after each literal. An example to make this clearer is $MXDateTime = '<#date format=yyyy-MM-dd>' . 'T' . '<#time format=hh:mm:ss>';, which is written in PHP Hypertext preprocessor format, the literal 'T' has been inserted between two separate web tags.
Year formats
These are the simplest output format modifiers. We choose from 2 options, and because both involve more than one character their context does not matter. Although the legacy Cumulus will accept upper case as meaning same as lower case, it is simplest if we just show the lower case options needed for MX:
| Specifier | Displays | Example |
|---|---|---|
| yy | Displays the year as a two-digit number (00-99). | 19 produced by <#LastDataReadT format=yy> |
| yyyy | Displays the year as a four-digit number (2000-9999). | 2009 produced by <#LastDataReadT format=yyyy> |
Month formats
All locales offer both numerical and alphabetical formats for representing months.
- In the following table "MMM" is shown as producing short month name.
- What language is used, and what characters appear, depend on what is set up for your language in your settings (by default or by you changing your settings)
- In British English (UK) locale this will be the appropriate 3 letter abbreviation that starts with "Jan" and runs to "Dec"
- It appears that language settings in many locales (not "en-gb"), add a full stop to any abbreviations
and in that case the 3-letter "MMM" is turned into a 4-letter output (e.g. Australia settings default would output from "Jan." to "Dec.")
- MX has been coded to remove that full stop in various places (like in standard log file naming and NOAA report naming), but at the time this section was edited, "MMM" still reports the full stop in a web tag output if your locale uses it
- In the following table "MMMM" is shown as producing the full name for a month
- The output you get will depend on the language defined in your locale
- In English locales, the output will be in the range "January" - "December"
Day formats
All locales offer both numerical and alphabetical formats for representing a day.
The table below relates just to the day part of any date specifications.
| Displays | Example | ||
|---|---|---|---|
| d (single character) | %d | Displays the day as a number without a leading zero (1-31).
|
27 produced by: |
| dd (2 characters long) | dd | Displays the day as a number with a leading zero (01-31). | 07 produced by <#metdate format="dd"> |
| ddd (3 characters long) | ddd | Displays the day as an abbreviation (in UK English will output Sun-Sat) using the strings appropriate to the Locale.
As for month above, the short day names that are generated depend on your locale, so you might see additional punctuation defined for abbreviated names in some locales. |
'Wed' produced by <#metdate format="ddd"> (English locale) |
| dddd (4 characters long) | dddd | Displays the day as a full name (Sunday-Saturday) using the strings appropriate to the Locale. | 'Friday' produced by <#metdate format="dddd"> (English locale) |
Date formats
The #Year formats, #Month formats, and #Day formats listed above can be combined to make up a date output modifier, but there are some other modifiers available that can produce whole dates.
#Locales will define a Short Date Format and a Long Date Format. You will see references to those in the table below explaining available output format modifiers, for example the single character output format modifier (G or c) listed at the start of the table below.
If you are in the USA, Cumulus will not use your month first date internally or in any files in the data sub-folder, but you can see your preferred format asan output from web tags, as you can can combine the month specifier, with the day specifier, in that order, to get an output where the month appears first (see example in table below).
Please could an American contributor please check if the "M" modifier works for their locale as shown and update the table below.
Time formats
Here context matters, so both standard (single character) and custom (two or more characters) formats are shown in the following table. As explained earlier, time formats can be used with durations and clock times.
In some rows of this table, square brackets [] indicate optional items, they are included just to make it clearer how items can be combined in a single output parameter. If you want to include what is shown in square brackets you don't type the square brackets e.g. <#LastDataReadT format="h:nn am/pm">
Some Extra Information
Having covered the basics of both date and time modifiers above, it is time to talk about incorporating other information in an output modifying date/time format specification.
Basically, we can include literal characters, and we can include HyperText Manipulation Language tags, in our specifiers.
Finally, there will be a section on migrating from the legacy Cumulus to MX and how to modify the web tags in your templates to keep them working.
Including literals in format parameters
#Use of spaces explained how double quotes were needed for date/time output specifiers containing spaces. It briefly talked about including literals, and we will expand on that now.
Consequently, you cannot include double quote characters in any other position (see here for work-around).
You should put anything that is additional, to the defined format modifier specification below, into single quotation marks to prevent it being interpreted as a date or time format modifier. In MX, such single quotation marks should include the spaces round the additional literal text.
- For example, the word "on" contains the character "n", which for Cumulus versions 1.9.1 to 1.9.4 will be interpreted as a time format modifier unless you put it into single quotation marks. Example of valid Cumulus 1 syntax: <#TtempH format="'at' hh: mm 'on' dd / mm / yyyy">.
- You can include HTML tags (but they cannot have any attributes because both single and double quote characters have defined meanings) and special characters as quoted text within the 'format' parameter.
Example of valid syntax: <#TapptempH format="'at 'h:nn' 'am/pm '<small>on' d/m/yyyy'</small>'">.- See next sub-section for more information on incorporating HTML if you are using MX.
Note for MX - you can use single quotation marks round spaces and text (e.g. ' on '), but you can also use '\' as escape character (e.g. for 'on' use \o\n). However for at the only alternative is \a't' because the character t has another meaning and escape followed by a "t" i.e. "\t" becomes a tab!
Using HTML tags within format parameters (available in MX only)
Example using a class to change the look of part of the output
<#TapptempH format="dd' 'MMM' 'yyyy'<span class=\'xx\'> at 'HH:mm'</span>'">
the output from this will look like 04 Dec 2018 at 10:12
Note where the quotes are, and where you need to use '\' escape characters.
Example using HTML tags
<#RecentTS d=2 format="h:mm' 'tt'<small>on' d/M/yyyy'</small>'">
This puts the date in a smaller font than the time
Migrating from legacy Cumulus 1 to MX
If you have created any legacy cumulus template files, then in each template, you will need to do some editing. Everywhere a web tag appears with an output modifiers that is used to specify a date and/or time format, has to be edited before that template will work for MX.
Here are the main reasons:
- the reserved characters are different in C1 and MX (affecting use of literals like "on" and "at" that appear in many English time-stamps)
- the Delphi in legacy Cumulus is case insensitive, so for example "H" and "h" have the same meaning
- MX is case sensitive, and symbols mostly have different meanings when one symbol is used to when that symbol is used with others, so for example "H" and "h" have different meanings, and if not used with other symbols will need to be preceded with a "%" to have same meaning as they have in combination with other symbols
- In the legacy cumulus, a symbol like "d" has the same meaning for any tag
- MX is inconsistent, a symbol like "d" changes its meaning depending on the tag it is used with (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)
- the symbols used for representing such modifiers as minutes, month, am/pm, are different between C1 and MX.
- 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)
- In the legacy Cumulus, a space is a gap between characters
- In MX, a space must be within a literal, as a space before a symbol has the same effect as "%", (it changes the interpretation of a modifier character).
Confused even more now? I'm not surprised, but maybe some examples will help.
Examples
- Examples related to case selection
In Delphi, "nn" means "minutes" for Cumulus 1,
but "minutes" is "mm" for .NET or MONO in Cumulus MX.- The hour in 24-hour format with leading zero, in non case sensitive Delphi (Cumulus 1) 'HH' or 'hh' would be treated as same, but in .NET or MONO it must be "HH" (Cumulus MX).
- The hour in 24-hour format without leading zero, in non case sensitive Delphi (Cumulus 1) 'H' or 'h' would be treated as same, but in .NET or MONO it must be "%H" (Cumulus MX).
- For 12-hour specifiers, please see the table, as this is far more complicated.
You might be put off by references within .NET and MONO (Cumulus MX) to single/standard characters and custom modifiers, the following 3 examples may add clarity:
- For example, <#MonthTempHD format="d"> is a single character format modifier, therefore the 'd' acts as a standard modifier, and causes for a date of 22 July 2014 for the highest temperature in the month to be returned in the standard short date format e.g. '22/07/2014' (exact contents for any one date vary by locale).
- Similarly, <#MonthTempHD format="M"> is a single character format modifier and therefore the 'M' acts as a standard modifier and causes the date for the highest temperature in the month to be returned in the standard day and month format e.g. '22 July' (exact contents for any one date vary by locale).
- Whilst <#metdate format="d M"> is not a single character format modifier and therefore both the 'd' and the 'M' are interpreted as custom modifiers and cause the current date to be returned as a digit(s) for the day and a digit(s) month (in a without leading zeroes format) e.g. '6 7' would be returned for 6 July.
- Alternatively, <#MonthTempHD format="%d"> is NOT a single character format modifier, therefore the 'd' acts as a custom modifier, and causes a date of 22 July 2014 for the highest temperature in the month to be returned as the day of the month only '22' in all locales.
- Similarly, <#MonthTempHD format="%M"> is NOT a single character format modifier and therefore the 'M' acts as a custom modifier and causes the same date for the highest temperature in the month to be returned as the month number '7'.
In both Cumulus 1 and MX if you want a space character within your output, the output specifiers must be enclosed in double quotes. If that space character is next to a non modifier (e.g. around word "at") then the single quote needing to surround the at should be widened to include the spaces in MX, but Cumulus 1 does not care if single quotes excluded spaces. However, with MX, single quotes enclose multiple characters, but there is an alternative way to deal with some single verbatim characters to cover next.
So let us compare these two alternative ways that MONO and .NET escape any characters that are not being used as format specifiers.
- In
Delphi you can put the 'verbatim' characters inside single quotes (Cumulus 1); this is often used to (in English) include words like ' on ' and ' at ' in the formatted output. - in
.NET or MONO you can still use single quotes (as mentioned above extended to include adjacent spaces),
- but alternatively you can escape each verbatim character with a backslash as prefix (Cumulus MX).
- You may need to use both single quotes and back slashes in some format specifiers, depending whether the characters you want to include can be interpreted as control characters (yes, backslash is also used to escape control characters, so backslash will NOT work for some characters such as those in "on" and "at" [\n will produce new line not the letter n, \t will produce a tab not the letter t]), consequently for some characters you must use the literal approach to include them in your format.
Past history for this page
This page is a complete redesign of how to present information that was previously on the Webtags page, so look there for past content by selecting "history" tab.
Trying to make the old design made for the original Cumulus software, work for MX which is now very different, made the old page unwieldy.
Forum reference
Steve Loft published a table showing comparison between output date modifiers for Cumulus 1 and MX at Cumulus MX forum. The table there was based on the table that appeared in this Wiki when only the original Cumulus existed, so it was designed to help people migrate to his MX beta, it was not intended as a definitive list of what modifiers were available for MX (Steve instructed people to look them up on some Microsoft sites).
The subsequent comments in the forum suggested his layout got people confused. Most of that confusion came in two circumstances:
- When someone wanted to use one date or time modifier on its own
- When someone who had been using Cumulus 1 swapped to MX and wanted to replace a combination of output modifier characters that was not explicitly shown in his table.
That all comes from the fact that when a MX modifier consists of a single character it can mean something different to when it appears with other characters.
In Cumulus 1, "m" or "M" had two meanings depending whether it was combined with "H" or "h" (when it represented minutes), or on its own or with any other code (when it represented month). But for Cumulus 1, there is no other case where it matters what context a modifier is put in by the use of other modifiers, and no other modifier takes more than one meaning.
In MX it is much more complicated, to take a few examples "D", "H", "M" represent different items on their own to what they represent when combined with other characters. That other character can be as simple as using a space or a "%" to modify the meaning of the character.
Looking at the tables, now included above, you can see "G" is used on its own because it represents a full date-time specifier. "D" is similarly used on its own represents the long date format. If we only want the day of month number we must use "%d" to avoid the meaning of short date format that "d" on its own represents.
If we want the typical Cumulus date-stamp of day of month number and month, then we have two choices, because both "d M" and "M" will work. This illustrates how "M" has a different meaning on its own and with another modifier.
Hopefully, the way that information is now presented on this page makes any use of parameters for web tags much easier now.