Category:Cumulus MX: Difference between revisions

From Cumulus Wiki
Jump to navigationJump to search
4,136 bytes removed ,  07:33, 3 September 2020
m
(43 intermediate revisions by 2 users not shown)
Line 3: Line 3:
{{TOCright}}
{{TOCright}}
= Introduction =
= Introduction =
If you have been using Cumulus 1, and now wonder whether to try using MX, be aware that:
*Currently, more people are still using Cumulus 1 than are using MX; but during 2020, many have experimented with MX, then successfully moved to MX, just a few have gone back!
*Cumulus 1 is a stable release, it has functionality that is not available in MX:
**Select a graph
**View period
**provided you are happy to keep running Cumulus 1 on a Windows pc, and use a weather station that is compatible with Cumulus 1, then you don't have to change over
*Cumulus MX is still under development, a change in a particular release may introduce bugs
*MX does however have additional features not available in Cumulus 1
**it can run on Unix-derived (Mac, Linux, Raspberry Pi operating systems) devices as well as Windows devices
**it can work with newer weather stations and newer sensors
**it reports feels like, Canadian Humidity Index
**it has built in updating of database tables
**it can output to more external sites
**it has MQTT, HTTP, and other extras, built in
Please see [[Moving from Cumulus 1 to MX]] for more information.


== What does Cumulus MX do? ==
== What does Cumulus MX do? ==


That is covered elsewhere, in [[About Cumulus|the article that introduces Cumulus]].  
If you are new to Cumulus, then you will be wondering what benefits Cumulus MX has over other weather recording software. In that case start by reading [[About Cumulus|the article that introduces Cumulus]].  


You may want to read that article first, that that will explain what Cumulus software can do and perhaps help you to:
You may want to read that article first, that that will explain what Cumulus software can do and perhaps help you to:
Line 16: Line 33:
== This article ==
== This article ==


This Wiki article was originally exactly what Steve Loft said in the [https://cumulus.hosiene.co.uk/viewforum.php?f=39 MX early builds support forum] when he first started experimenting with Cumulus MX and access was restricted to those willing to experiment with his tests.
This Wiki article was originally created by Mark Crossley and contained exactly what Steve Loft said in the [https://cumulus.hosiene.co.uk/viewforum.php?f=39 MX early builds support forum] when he first started experimenting with Cumulus MX and access was restricted to those willing to experiment with his tests.


In this rewrite, I am adding more as I explore more of the functionality of MX; and as I learn more from posts in the forum.  
In this rewrite, somebody who used to use Cumulus 1, and experimented with MX, before moving over to MX first on a Windows PC and then on a Raspeberry Pi, has attempted to ensure this article contains everything I learnt from my experience as I explore more of the functionality of MX; and as I learn more from posts in the forum.  


If you can correct anything I write, add anything I have not yet covered, or know something that I might not know, then please remember, anyone can update this article, I don't have any special access in the Wiki and any page I edit can be edited/corrected by anyone else.  
If you can correct any mistakes I make, have a suggestion as to how to make it clearer, can add anything I have not yet covered, or know something that I might not know, then please remember, anyone can update this article, I don't have any special access in the Wiki and any page I edit can be edited/corrected by anyone else.  


During a period of my time in employment I was responsible for approving documentation on a large computerisation project, and later for supplying updated information for a public faced web site, and in both cases there were house style, and I probably continue to use that style.
During a period of my time in employment I was responsible for approving documentation on a large computerisation project, and later for supplying updated information for a public faced web site, and in both cases there were house style, and I probably continue to use that style. You might be afraid to add your contribution because my style is not the same as your natural one. Don't worry; as long as you use short paragraphs or bullet points, with lots of headings, then your contribution can blend in.


You might be afraid to add your contribution because my style is not the same as your natural one. Don't worry; as long as you use short paragraphs or bullet points, with lots of headings, then your contribution can blend in.
As this article has grown, I have been able to shorten it by moving material to new articles, hence you will see a lot of cross-references below. You may have suggestions for what else can be moved out of this article into separate articles?


This article was originally comparatively short, as it gets longer I have moved some parts out. You may have suggestions for what else can be moved out of this article into separate articles? When in doubt to apply changes, please use the discussion page first.
If you have some ideas, but are unsure whether to apply changes, please use the discussion page first. If you have ideas, but want someone else to add them here, please write your suggestion in the support forum for wiki suggestions at https://cumulus.hosiene.co.uk/viewforum.php?f=38


= Cumulus flavours =
= Cumulus flavours =
Line 112: Line 129:
== Documentation for MX ==
== Documentation for MX ==


=== Cross reference to article on [[Moving from Cumulus 1 to MX]] (includes general issues regarding running on Windows) ===
Whether you have been using Cumulus 1, or are new to Cumulus, you may be tempted to install MX on a PC, or other device, running Windows Operating System; the article linked in the heading will help you.
You may be reading this article on MX as a Cumulus 1 user considering moving to MX, if so then it explains all issues when moving from Cumulus 1 to MX, including what functionality you will gain and what you will lose by moving to MX. The article will help you to decide whether to stick with Cumulus 1's stable release as many MX releases have bugs as the developer tries revising the code, to simplify it, as well as to introduce new features.


=== Cross-reference to [[What to do when I have a problem with MX]] ===
As a new Cumulus user, using MX on Windows (but with no experience of Cumulus 1), the separate article linked from the heading to this section will still interest you as it is a definitive guide to installing Cumulus MX on Windows.


The text that was here has been moved to a separate article, that makes it more accessible, please see [[What to do when I have a problem with MX|What to do when I have a problem with MX article]]
=== Cross reference to article on [[Setting up Raspberry Pi]] for Cumulus ===
Whether you have been using Cumulus 1, or are new to Cumulus, you may be tempted to install MX on a Raspberry Pi. A Raspberry Pi (and similar devices from other manufacturers) is much simpler than a normal computer, but it can still run various operating systems that allow you to use it perhaps for both running MX and a web server. Find out more in the article linked in the heading.


=== Cross reference to issues relating to Cumulus on devices running Windows, including [[Moving from Cumulus 1 to MX]] ===
=== Cross reference to article on [[Updating MX to new version]] ===


This has also been moved to a separate article, so those not interested don't need to read it.
Whether you have not updated for a long time, or simply wonder whether you are updating the easiest way, follow the link in the heading for this section, to an article that focusses on all to do with updating from one MX version to another.


Please note that the same article [[Moving from Cumulus 1 to MX|Issues re Cumulus 1 and MX]], covers a lot of information about installing Cumulus MX on Windows; as well as issues when moving from Cumulus 1 to MX.
Critically, this linked article contains advice '''both''' for those updating each time there is a new release available '''and''' for those using an old version (perhaps when MX was still in beta) wishing to update to a new version skipping some in-between versions and need advice on whether to do it in multiple steps.


=== Cross reference to [[Cumulus MX FAQ]] ===
=== Cross reference to [[Cumulus MX FAQ]] ===


A new FAQ for MX has been started at [[Cumulus_MX_FAQ|another page]].
A new FAQ for MX has been started at [[Cumulus_MX_FAQ|another page]]. As I add the link here, the Cumulus MX FAQ is in a mess, but hopefully someone will have time to sort it out.


Many MX specific questions, such as those related to installation are now covered by the updated text on this "Cumulus MX" page.
Meanwhile most MX specific questions are now covered by the updating of text on this "Cumulus MX" page.


=== Cross reference to [[MX Issues]] ===
=== Cross reference to [[MX Issues]] ===


The [[MX Issues|Cumulus MX Known Issues]] article is based on [https://cumulus.hosiene.co.uk/viewtopic.php?f=39&t=12943 Steve Loft's forum post], but there has been an attempt to update the contents. Anyone willing to check it and do a further update?
The [[MX Issues|Cumulus MX Known Issues]] article was based on [https://cumulus.hosiene.co.uk/viewtopic.php?f=39&t=12943 Steve Loft's forum post] so based on an early beta version of MX, and there has been minimal attempt to update the contents as MX has been developed further and come out of the original beta. <big>Anyone willing to check the linked article and do a further update?</big>
 
 
=== Cross-reference to [[What to do when I have a problem with MX]] ===
 
The text that was here has been moved to a separate article, that makes it more accessible, please see [[What to do when I have a problem with MX|What to do when I have a problem with MX article]]


=== Cross reference to [[MX Administrative Interface|Administrative Interface]] ===
=== Cross reference to [[MX Administrative Interface|Administrative Interface]] ===
Line 137: Line 166:
This requires a whole topic to itself, and indeed it has an article to itself, reached from link in heading for this section.
This requires a whole topic to itself, and indeed it has an article to itself, reached from link in heading for this section.


=== Cross reference to article on [[Updating MX to new version]] ===


Because If you are doing an update you don't want to read a long article, this topic has an article to itself, reached from link in heading for this section.
=== Message from Steve Loft about documentation ===
 
''The following was written by Steve Loft when he first made his MX beta available to Cumulus users. Although somewhat outdated it is preserved here.''


=== Message from Steve Loft about documentation ===
There's quite a lot to read before you start - please do read all of this page and all the references it mentions, most of it is very important.  
There's quite a lot to read before you start - please do read all of this page and all the references it mentions, most of it is very important.  


Line 156: Line 185:
In writing this update, I have drawn on my own experience of moving from Cumulus 1 to MX, and thus my knowledge of Cumulus is from over a decade of experience with this software and what it can do.
In writing this update, I have drawn on my own experience of moving from Cumulus 1 to MX, and thus my knowledge of Cumulus is from over a decade of experience with this software and what it can do.


Before I swapped, I made a detailed study to check MX could do all I used to do with Cumulus 1 and much more.  Before I add items to this article I play around with MX experimenting with what works and what does not work, but I have saved you the pain of where I went wrong, just telling you what is correct. I do need to add, that I don't have a separate testing environment, and therefore I am not willing to attempt anything that might muck up my collecting of weather information, plus currently I only have a second-hand (ex-NHS) PC and a simple smart phone, so my technology, as well as my ineptness because I belong to that generation who did not have desktop computers, nor mobile devices, until some time into my working life. This all places restrictions on what I can test out, and therefore on the coverage of these notes.
Before I swapped, I made a detailed study to check MX could do all I used to do with Cumulus 1 and much more.  Before I add items to this article I play around with MX experimenting with what works and what does not work, but I have saved you the pain of where I went wrong, just telling you what is correct. I do need to add, that I don't have a separate testing environment, and therefore I am not willing to attempt anything that might muck up my collecting of weather information, plus my knowledge of modern technology is poor as I belong to that generation who did not have desktop computers, nor mobile devices, until some time into my working life. This all places restrictions on what I can test out, and therefore on the coverage of these notes.


'''If anyone else, can improve these notes, wants to split off more parts, or in any other way make the documentation better, then please do.  I have already made improvement that were suggested by others.'''
'''If anyone else, can improve these notes, wants to split off more parts, or in any other way make the documentation better, then please do.  This article already contains improvements that were suggested by others.'''




Line 167: Line 196:
There is no automatic installer (this may change). Cumulus MX is supplied as a zipped package on a link from [[software|Software page]].
There is no automatic installer (this may change). Cumulus MX is supplied as a zipped package on a link from [[software|Software page]].


== Executables ==
== Replacing Cumulus 1 ==
 
The MX package, at time of typing this, includes two executables:


=== CumulusMX.exe ===
See [[Moving from Cumulus 1 to MX]] article. If you wish to run MX on Windows, then you can unzip the contents of the download package over your cumulus 1 installation, i.e. so the same data and Reports folders continue to be used. But it would be best if you take a back-up copy of the Cumulus 1 installation first!


Whilst effectively MX is run by a '''CumulusMX.exe''' or '''sudo mono CumulusMX.exe''' depending on device, you actually need to ensure all the other components are loaded, so you either have a package that runs it for you, or you click a shortcut that includes the necessary path setting.  
The package contains several extra .dll files, and everything else you need, to continue to read from your weather station, to load up the admin interface (there are some settings you will need to change), and some simple web templates (that replace the standard Cumulus 1 ones).  You might want to read topics on the MX support forum to discover about other people's experiences.


=== ExportMySQL.exe ===
== Completely new MX installation ==


This second exe file has been available since the original MX package as Steve Loft developed this in April 2015, but sadly few people even notice it exists, and if they do, it is unlikely they know how to use it. Hopefully, some people will read this section and find out!
See earlier for links to other articles about installing on a Windows PC or a Raspberry Pi. Here only a brief indication of installation is covered.


Obviously it was updated when Mark Crossley added the Feels Like fields to log files.
*Create a new directory (recommended name CumulusMX) and unzip the contents of the [[Software|download package]] into it.
*See notes below for extras required in various operating systems.
*The package contains everything else you need to read from your weather station (if it is a supported model), to load up the admin interface (for settings and some simple templates used to create web pages to see on a device connected to your home network).  You might want to read topics on the MX support forum to discover about other people's experiences.


Put simply, this executable will read log files and insert (insert ignore) rows into an existing database table. Since it only does inserts, despite the name of this function, it is not just for MySQL tables, the included SQL should work with whatever database table type you have.
== Running Cumulus MX ==
 
The executable has a mandatory single parameter that tells it which log files to read, there are only 3 possible parameters ("dayfile", "monthly", or path to a file). It needs to know what locale (or culture settings) it is to use to work out what character separates each item in the log file list. It also needs to read your Cumulus.ini file, as it takes these "input parameters" from MySQL section in that:
*Host
*Port
*User
*Pass
*Database
*MonthlyTable
*DayfileTable
 
==== Daily summary log file ====
 
# Use the feature in the admin interface:
#* Settings menu
#* MySQL settings page
#* In '''Dayfile.txt upload''' section, give your database table a name, or accept default ''Dayfile''.
#* Click '''Save''' to ensure this setting is updated
# Now scroll down to '''Create database table (save settings first)'''
#* Here click '''Create Dayfile'''
# Now you have a database table ready, you can use the executable to read all lines in your '''CumulusMX/data/dayfile.txt''' log file.
# Open a terminal display (if you are using Windows then, open a Command Window, a Windows Powershell window, or a Windows Terminal window)
# Run this executable in that terminal display (or command window) by using  '''sudo mono ExportMySql.exe daily''' or <tt>ExportMySql.exe daily</tt> depending on device.
# In the terminal display (or command window) you will see '''Parameter = daily''' confirming what you entered and in the line below that a rapidly updating code that is the primary key displayed for each row it tries to insert into the table.  If that primary key already exists in the table, it will still show the key, but no insert will take place.
#If you want MX to continue adding new rows to this database table, still in the admin interface, still in MySQL settings page:
#* Return to '''Dayfile.txt upload''' section, and select '''Enable'''.
 
==== Standard Log files ====
 
# Use the feature in the admin interface:
#* Settings menu
#* MySQL settings page
#* In '''Monthly log file upload''' section, give your database table a name, or accept default ''Monthly''.
#* Click '''Save''' to ensure this setting is updated
# Now scroll down to '''Create database table (save settings first)'''
#* Here click '''Create Monthly'''
#If you want MX to continue adding new rows to this database table, still in the admin interface, still in MySQL settings page:
#* In the same '''Monthly log file upload''' section, now select '''Enable'''.
# Now you have a database table ready, you can use the executable to read all lines in either one (if path to that file is in parameter), or every (if parameter is monthly) standard log file.
#*If the parameter is "monthly" it will look in folder '''data'''  for every file it can find with a file name of datestring + "log.txt" where datestring is a 3 letter code (in your locale) for each month (1 to 12) followed by a 2 digit year (from "00" to "99") so that is how it finds every standard log file in the folder.
# Open a terminal display (if you are using Windows then, open a Command Window, a Windows Powershell window, or a Windows Terminal window)
# Run this executable in that terminal display (or command window) by using  '''sudo mono ExportMySql.exe monthly''' or <tt>ExportMySql.exe monthly</tt> depending on device.
#* Alternatively, replace '''monthly''' parameter by a full path to a single standard log file, and it will process just that log file.
# In the terminal display (or command window) you will see '''Parameter = monthly''' confirming what you entered and in the line below that a rapidly updating code that is the primary key (omitting the first two digits of the year) displayed for each row it tries to insert into the table.  If that primary key already exists in the table, it will still show the key, but no insert will take place.  So you can run this again to pick up any additions to the latest log file since the original run. Also notice that if you use the parameter "monthly" the order in which it will process different standard log files is not predicable, they probably will not be in any particular order, but as one feature of SQL databases is that the row order is not able to be determined, it does not matter if rows are not added in chronological order.
#* It is worth noting that it is safe to run this procedure while MX is also running, because this procedure only updates log entries that exist as this  procedure reads the logs, and MX only adds new entries to the log and at the same time uploads that new entry (if enabled) to the database table.
 
Please be aware that the transfer to the database table adds two columns where bearings in the original log file given in degrees are output as compass directions, and these use up to 3 letters of how the compass directions are defined in the '''strings.ini''' file. Thus the number of columns in the database table will be at least 2 more than the number of fields in the log files. It is also important to stress that whilst the database table must contain one column defined for each field (plus the extra 2) being uploaded, you can add even more columns to your table if you want and populate those some other way. For example, I have added a Canadian Humidity Index (Humidex) column which is not in the standard logs, but is calculated by Cumulus, and can be calculated from columns that are uploaded from the standard log. Humidex is not uploaded by either ExportMySQL or the normal CumulusMX process, but neither objects to extra columns being there.
 
When testing this, I had some log files produced by various old versions of Cumulus 1 in my MX data folder as well as the log files in has generated since I swapped to MX. Plus I had used a PHP script to add feels like to those log files produced before version 3.6.0 and to correct feels like for those log entries made by versions 3.6.0 to 3.6.9 inclusive because they used a different formula to the one being used from version 3.6.10.  This php script is a web page with a HTML form and can be obtained from the forum in [https://cumulus.hosiene.co.uk/viewtopic.php?f=18&t=18096 Create Missing for MX]
 
I notice that the database rows produced by those short log file lines produced by say version 1.9.0 had nulls entered for all subsequent columns, except '''Feels Like''' and this column was initialised at 0.0!
 
For those log files produced by the final version 1.9.4, all columns are populated although feels like is set to 0.0.
 
== Completely new MX installation ==


Create a new directory (recommended name CumulusMX) and unzip the contents of the download package into it. See notes below for extras required in various operating systems.
The package contains everything else you need to read from your weather station (if it is a supported model), to load up the user interface (for settings and some simple web pages to see on a device connected to your home network).  You might want to read topics on the MX support forum to discover about other people's experiences.
== Running Cumulus MX ==
# Make sure your weather station (and any extra sensors) is connected to the device on which you have installed Cumulus MX, before you try to run Cumulus MX.
# Make sure your weather station (and any extra sensors) is connected to the device on which you have installed Cumulus MX, before you try to run Cumulus MX.
# Start '''Cumulus MX engine''' (command to do this varies between operating systems, so see sub-heading for your device below
# Start '''Cumulus MX engine''' (command to do this varies between operating systems, so see sub-heading for your device below
# Start '''Admin Interface''', it runs in a browser, by default on port 8998, see [[#User_Interface|section]] below.
# Start '''Admin Interface''', it runs in a browser, by default on port 8998, see [[#User_Interface|section]] below.


If you are running MX for the first time, without a configuration file (none is included in download package), see [[Cumulus.ini#Cumulus_MX|here]] for screen shots and instructions.
If you have been running Cumulus 1 before, then [[Moving from Cumulus 1 to MX|as instructed here]] your MX installation will require various files from your Cumulus 1 installation including all files in the '''data''' and '''Reports''' folder and all [[:Category:Configuration Files|Configuration Files]] including [[Cumulus.ini#Swapping_from_Cumulus_1_to_MX|Cumulus.ini]] and follow that link for details of a few of the parameters that you may need to change.
 
If you are running MX for the first time, without a configuration file (none is included in download package), see [[Cumulus.ini#Cumulus_MX|here]] for screen shots showing what you see as the engine starts running, and what you see in the admin interface where you set your weather station type. In that link there are more instructions.


=== .NET and Mono ===
=== .NET and Mono ===


The software currently (this is early 2020) called .NET was originally for all operating systems, but Microsoft then decided to restrict it to just Windows, mostly to encourage greater dominance by Microsoft software and hardware.  
The software currently called .NET was originally for all operating systems, but Microsoft then decided to restrict it to just Windows (and that was the position while MX was being developed and is still true in early 2020 when this article was rewritten), mostly to encourage greater dominance by Microsoft software and hardware.  


Mono was then born based on .NET to work with all operating systems, Mono subsequently changed independently from .NET (although Microsoft still has a leading role).  
Mono was then born based on .NET to work with all operating systems, Mono subsequently changed independently from .NET (although Microsoft still has a leading role).  
Line 255: Line 228:
More recently,  Microsoft launched an alternative called .NET Core that took out of .NET the parts that were Windows specific, and it ceased work on further development of .NET beyond version 4.x.x.  
More recently,  Microsoft launched an alternative called .NET Core that took out of .NET the parts that were Windows specific, and it ceased work on further development of .NET beyond version 4.x.x.  


'''Perhaps confusingly, in November 2020, there will be change around of names, and the multi-operating system .NET Core product will take over the .NET name. I don't pretend to understand the technical details, but the impression I get is that the new .NET in November will be similar to Mono, so apps designed for that will still work, but apps using .NET to make code designed for windows will stop working'''
'''Perhaps confusingly, in November 2020, there will be change around of names, and the multi-operating system .NET Core product will take over the .NET name as version 5. I don't pretend to understand the technical details, but the impression I get is that the new .NET in November will be similar to Mono, so apps designed for that will still work, but apps using .NET to make code designed for windows will stop working'''. Since the Cumulus code is currently coded to behave slightly differently using .NET and using MONO, I guess it is possible old versions of MX might stop working when the new .NET is installed via Windows Update.
 


=== Requirements for running on Windows ===
=== Requirements for running on Windows ===
Line 264: Line 236:
For Windows 10 you need version 4.8 or later, this should already be installed by your windows update feature.  The .Net download for version 4.8 should be here https://dotnet.microsoft.com/download/dotnet-framework/net48.
For Windows 10 you need version 4.8 or later, this should already be installed by your windows update feature.  The .Net download for version 4.8 should be here https://dotnet.microsoft.com/download/dotnet-framework/net48.


Cumulus MX initiates a web server, to do this it may need administrative access, consequently to avoid having to run MX as an administrator you can issue a command that allows all users to bind to port 8998 which is the web server it initiates (this is used for the Cumulus MX user interface). Note that if you plan to change the interface port by using the port parameter in your launch of MX, you should change the 8998 to whatever port you are planning on using. To enter the command, first open a command window as administrator. One way to do this is to right click the windows symbol at the start of the windows task bar. The option to choose there (on windows 10) is '''Windows PowerShell (admin)''', but an option called '''Command Prompt (Administrator)''' will also work. Once that opens a new window type:
For those who downloaded the first MX Beta in January 2015, the code was only experimental and that version had to be run by a Windows Administrative User, but Steve Loft soon improved the code and now none of the code requires any elevated rights and it can be run by a normal user (or  a user with administrative rights) without needing to be started by '''Run as administrator'''.
 
However, Cumulus MX initiates a web server, which is what runs the [[MX_Administrative_Interface|Admin Interface]]. To access that, all users need to be given elevated rights to the port on which the web server runs. By default this is port 8998, so that is used in the example below of the one-off command needed to give all users access to the port. You can use a '''-port=nnnn''' parameter when starting MX to make it use another port, if you use that then the command below needs revising accordingly.
 
To enter the command, first open a command window as administrator. One way to do this is to right click the windows symbol at the start of the windows task bar. The option to choose there is dependent on some settings which determine what appears when you right click:
*the normal default on Windows 10 is '''Windows PowerShell (admin)''',
*the normal default on earlier versions of Windows is  '''Command Prompt (Administrator)'''  
*an alternative is '''Windows Terminal'''
Whichever of these you can use, the result is it opens a new window on your monitor with a prompt for typing. In that window type the command:
<pre>
<pre>
netsh http add urlacl url=http://*:8998/ user=\users
netsh http add urlacl url=http://*:8998/ user=\users
</pre>
</pre>


You only need to do that once. After than you can initiate MX from any user, you don't need to run as administrator.
You only need to do that once. If you do not issue this command, administrative rights are needed every time to access the port.


Talking about command windows, if you want to check that the port is open for listening (when MX is running, the port is used for the administrative interface) type <tt>netstat -an | findstr 8998</tt> into the command window.
Talking about command windows, if you want to check that the port is open for listening (i.e. able to access the admin interface) type <tt>netstat -an | findstr 8998</tt> into the command window.


The admin interface URL '''http://*:8998/''' needs to have that wildcard "*" replaced by a precise location if we are to access the admin interface.  The missing part of the URL depends on how your local network is set up.  If you are accessing the admin interface on the same device as that running MX (and you don't have another web server on that device) the "*" can be replaced by "localhost", i.e. '''http://localhost:8998/''' will be used to load the admin interface into your browser.  In the more general case when you want to access the admin interface from anywhere on your local wired and wireless interface, then the "*" needs to be replaced by a string of 4 numbers representing what is called a IPv4 address (w.x.y.z) of the device you have installed MX on.


After you have done this you can run CumulusMX.exe normally without Administrator rights and therefore you can create a short-cut to run MX when your PC starts (put your user name where I have put ...), the shortcut should point to T:\CumulusMX\CumulusMX.exe (where T is used here only to denote the drive on which you have installed MX as it does not need to be the same as where your operating system is):
Look at your hub or router (this should have come with instructions on how to access its settings in your browser) and on one screen it should show what devices are connected to your LAN and wifi. Look for the IPv4 address, for example 192.168.1.64, it has assigned to the device where MX is running. That is what should replace the "*". However, there is one more complication, either the Windows networking settings may change, or else your hub or router may reconfigure, both can happen at any time and both can assign a different IPv4 address to the device running MX.
C:\Users\...\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\CumulusMX.exe
 
With this you might want to right click on that shortcut, select properties, then you can set the starting position for the command window, the colours and font it will use, and even choose to start minimised, amongst many other selections.
To give your Computer a fixed address for the MX admin interface,
#first find the network card via Network and Sharing Centre (Control Panel),
#then click on Change Adapter Settings,
#then Right click on Ethernet or WiFi Adapter,
#next select Properties
# In the window that opens, right click on Internet Protocol Version 4 (TCP/IP 4),  
#Next select properties
# Onn that pop up screen tell the computer to "use the following IP address"
#Fill out the form with
#* a subnet mask of 255.255.255.0 and  
#*gateway address between 192.168.1.1 and 192.168.1.254 (depending on the address of your hub/router).


Look at your hub or router (this should have come with instructions on how to do this in your browser) and on one screen it should show what devices are connected to your LAN and wifi. Look for the IPv4 address (w.x.y.z) of the device you have installed MX on, for example 192.168.1.64. Then give your Computer a fixed address  for MX user interface by finding the network card via Network and Sharing Centre (Control Panel), click on Change Adapter Settings, then Right click on Ethernet or WiFi Adapter, select Properties and in the window that opens right click on Internet Protocol Version 4 (TCP/IP 4), and select properties and on that pop up screen tell the computer to "use the following IP address and fill it out with a subnet mask of 255.255.255.0 and gateway address between 192.168.1.1 and 192.168.1.254 (depending on the address of your hub/router).
==== Setting up for either manual or automatic running ====
==== Setting up for either manual or automatic running ====


There are 3 ways on Windows to create a way to run MX, you can't just click on the executable in file manager, because Windows needs to be told the path for loading all the related .dll files.
 
To run Cumulus MX, Windows needs to know
#which '''.exe''' you want to run
#the path where all the required '''.dll''' files are located
 
Therefore it is best to always start MX using what Windows calls a '''shortcut''', because when creating the shortcut you can enter all the required information into the properties.  If you want MX to automatically start whenever you log into your PC, then the place to store your shortcut is <tt>C:\Users\...\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\Run_CumulusMX</tt>.  Don't forget to put your Microsoft username where I have put ...
 
With this you might want to right click on that shortcut, select properties, then you can set the starting position for the command window, the colours and font it will use, and even choose to start minimised, amongst many other selections.
 
There are 3 ways on Windows to create a shortcut to run MX, as mentioned above you can't just click on the executable in file manager, because Windows needs to be told the path for loading all the related .dll files.




Line 303: Line 302:


#First '''start the engine''' in one of the 3 ways from last sub-section
#First '''start the engine''' in one of the 3 ways from last sub-section
# Next '''start the admin interface''', it does not need to run all the time, but only when you need it (when you first use MX you will need it to access the settings where you tell MX what type of station you have and what units you want to use, and set various timing options), it normally runs on port 8998 (to vary that there is a '''-port''' parameter that is followed by required port and that port parameter has to be entered every time you start MX if you are not using the default port).
# Next '''start the admin interface''', it does not need to run all the time, but only when you need it (when you first use MX you will need it to access the settings where you tell MX what type of station you have and what units you want to use, and set various timing options), it normally runs on port 8998 (to vary that there is a '''-port''' parameter that is followed by required port and that port parameter has to be entered every time you start MX if you are not using the default port). More information on admin interface [[MX Administrative Interface|in separate article]].


Try '''start /min C:\Cumulus\CumulusMX.exe''' to run MX as a minimised package (although in Windows you can change the properties of the shortcut you use to start minimised).
Try '''start /min C:\Cumulus\CumulusMX.exe''' to run MX as a minimised package (although in Windows you can change the properties of the shortcut you use to start minimised).
Line 322: Line 321:
* For OS X, you can download this here - http://www.mono-project.com/download/.  
* For OS X, you can download this here - http://www.mono-project.com/download/.  
* How you install on Linux depends on the flavour of Linux you are running. There are download links for Linux at the same URL, but it is often easier to use a package manager, which will download and install it automatically.  
* How you install on Linux depends on the flavour of Linux you are running. There are download links for Linux at the same URL, but it is often easier to use a package manager, which will download and install it automatically.  
**For example, in 'Raspbian' on the Raspberry Pi, you can install mono with these commands:
**For example, in 'Raspbian' on the Raspberry Pi, you can install mono with the following commands, but '''first you need to have set up various pre-requisites''' (see [[Setting_up_Raspberry_Pi]] article  for details):
<pre>
 
sudo apt-get update
sudo apt-get install mono-complete
</pre> or
<pre>sudo apt update && sudo apt upgrade
<pre>sudo apt update && sudo apt upgrade
sudo apt install mono-complete</pre>
sudo apt install mono-complete</pre>
Make sure that you have the '''mono-complete''' package installed.
Note that you do need to have the '''mono-complete''' package installed, not just the Mono for developers.


The "sudo" prefix gives the command 'root' privileges, that allows administrative commands like update and install to run.
The "sudo" prefix gives the command 'root' privileges, that allows administrative commands like update and install to run.
Line 340: Line 336:
There are some optional parameters you might need to use, as they also apply to windows they are covered later.
There are some optional parameters you might need to use, as they also apply to windows they are covered later.


Next start the administrative interface, basically same as described for Windows above. More information on admin interface later.
Next start the administrative interface, basically same as described for Windows above. More information on admin interface [[MX Administrative Interface|in separate article]].


==== Other issues  ====  
==== Other issues  ====  
Line 348: Line 344:
'''APPEAL''' - Please could any readers who have experience of running MX in a Linux or Mac environment please consider writing advice into this article. I want it to be a comprehensive accurate article.
'''APPEAL''' - Please could any readers who have experience of running MX in a Linux or Mac environment please consider writing advice into this article. I want it to be a comprehensive accurate article.


==== Notes by ExperiMentor (in Switzerland) ====
=== Notes by Steve Loft ===
 
''please note these notes ARE now obsolete, library routines have changed a lot since this was written in 2014''
 
'''Any volunteers to replace this section with up to date information?'''
 
 
**If you have a Raspberry Pi 2, there is a later version of Mono available, which you may find works better that the one in the standard distribution, particularly if you use decimal commas. Mono 3.2.8 (which is the default in some Linux distributions) will not work if you use commas for decimals, as in some countries.
 
**On Linux you will need library '''libudev.so.0''' which may not be installed by default. Installing '''package libudev0''' may resolve this. There may be issues if you are using a 64-bit version of Linux. I'm not sure what the resolution is at the moment, if this is the case.
 
You need to specify something like '''/dev/ttyUSB0''' for the connection for your weather station. This is set in the "station settings" and stored in the [[Cumulus.ini#station|ComportName attribute]] in Cumulus.ini configuration file.


These comprehensive notes describe how to install Cumulus MX on a Pi Zero, using a PC to do some of the work:
In some builds of MX you have to run as "root", there are ways of giving "root" like permissions when running MX as another user, see forum for details until this section has been updated.


'''Buy equipment'''
==Stopping MX==
* Raspberry Pi Zero W
** A faster Pi is NOT needed for running Cumulus. Pi Zero W has WiFi and one USB port which is all that is needed for headless running.
** Using a faster Pi might speed parts of the installation process, but are overkill for actual ‘production’ running. A faster Pi will work fine though if you have one going spare and don't mind the extra power use.
** Case if desired
* Micro SD card eg 16 GB, decent quality. Adapter if needed to put Micro SD card in PC
* OTG cable (micro USB plug to standard USB socket) to connect a USB weather station to Raspberry Pi [you may have got one free with a mobile phone or tablet] if it's a USB weather station. Not needed if you have a WiFi or ethernet weather station. An Ethernet weather station will need connected to your router, not the Pi.
* Suitable Micro USB power supply (it does not need to be a high power 2.5A version for Pi Zero W with only the weather station attached; it will be powered on 24/7, so a low power consumption ‘switched mode’ type is preferred – ie one that does not become warm when plugged in with nothing attached. You may have a suitable one from a mobile phone.
'''
Download useful PC software and install on your PC'''
These instructions are for a Windows PC. Steps would be similar on a Mac, but programs and details would differ. Should also be possible with an Android tablet.
* SD Formatter (the Windows Format facility will NOT do)
** https://www.sdcard.org/downloads/formatter_4/index.html
* balenaEtcher (for unzipping and burning images to SD cards) [Previously named 'Etcher'] <tt>https://etcher.io/</tt>
* Win32DiskImager (for backup & restore of SD card images) <tt>https://sourceforge.net/projects/win32diskimager/</tt>
* PuTTY (an SSH client for Windows) <tt>https://www.putty.org/</tt>
* FileZilla (an FTP file transfer program for Windows) <tt>https://filezilla-project.org/download.php</tt>


'''Download Raspbian Pi Operating System'''
The best way to stop MX is by sending a '''control and C''' sequence to it. There is a start stop routine discussed in the support forum, where you will also find some topics about shutdown issues.
* Save it on your PC, from https://www.raspberrypi.org/downloads/raspbian/
* "RaspBIAN Buster Lite" is probably OK, but other than small file size it offers no advantage over installing the full version of RaspBIAN Buster. These instructions are being tested using "Raspbian Buster with desktop and recommended software", the largest of all, which could allow you to do other things more easily.
* Just click on “Download Zip” (torrent might be faster if you have the ability, but not worth installing just for this)
* Do not unzip it
* These instructions have been tested with kernel version 4.14, released 18 April 2018 and with kernel version 4.14, released 13 November 2018 [March 2019] and kernel version 4.19 released 10 July 2019


'''Install Pi Operating System onto Micro SD card'''
The MX source listing suggests it also accepts ''control and break'', '''Close main window''', ''user logoff'', and '''system shutdown''' and should still attempt to stop running tidily. There are various tasks like writing final values to log files and recreating the configuration file, [[Cumulus.ini]], that it needs to do as part of the MX closing routine, and obviously early closure of the device running MX (such as that caused by a power cut) will prevent a tidy end to MX.


''Format the SD card''
* Put Micro SD card in PC (use adapter if needed)
** If re-using a previous Pi SD card, click ‘Cancel’ on the warning about needing to format the card
* Run SD Card Formatter (click Yes to ‘Allow to make changes to your device’).
** Need to use this program rather than the Format tool in File Explorer, because Pi SD cards end up with a very small ‘Windows accessible’ partition and a large partition containing Linux. SD Card Formatter allows reclaim of the large partition.
* Your SD card should automatically populate in the ‘Drive’ box. In case you have another SD card in your PC, ensure the correct card is selected!
* Click ‘Format’ and check and accept the Warning messages


'''Copy the Pi Raspbian Operating System onto the card'''
* Run '''balenaEtcher''' on your PC
* Click ‘Select Image’ and choose the ‘Raspbian Buster’ operating system zip file that was downloaded earlier
* SD card should be automatically populated. In case you have another SD card in your PC, ensure the correct card is selected!
* Click ‘Flash!’. The operating system will be copied to the card. This takes about 10 minutes, followed by another 8 minutes to ‘Verify’
* Cancel any messages about needing to Format the card - they are just indicating that Etcher has installed the partition that cannot be read by Windows
* On completion, the card is ‘ejected’ from the PC. Physically remove it and then straight away reinsert it so that the content can be viewed in File Explorer
* TWO drives will now be visible for the SD card. You will likely see a warning that one of the drives needs to be formatted before it can be used. ‘Cancel’ that warning and ignore that drive.
* View the other drive, which is named ‘boot’ in File Explorer
* On the View tab, ensure the ‘File Name extensions’ is ticked
* Right click and select ‘New’, ‘Text document’. Change its name to SSH (deleting the .txt extension; you need to make an empty file called SSH not SSH.txt). Click ‘Yes’ to ‘Are you sure you want to change the extension?’
* Right click and select ‘New’, ‘Text document’. Change its name to wpa_supplicant.conf (deleting the .txt extension; you need to make a file called wpa_supplicant.conf not wpa_supplicant.conf.txt). Click ‘Yes’ to ‘Are you sure you want to change the extension?’
* Right click on this new file and select ‘Open with Notepad’ or ‘Open with …’ then select Notepad. Enter the following content exactly as below (copy and paste) then edit your country code (if needed), WiFi network’s SSID and password: NOTE: Change GB as needed to be the code for your country. The quote marks should appear in the file, that is ssid="YourNetwork" not ssid=YourNetwork . Same for psk.
<pre>ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=GB


network={
= Executables =
    ssid="YourNetwork"
    psk="YourNetworkPassword"
    key_mgmt=WPA-PSK
}</pre>


* Not essential, but I like to keep copies of both those files for future use. They can be on the SD card with different names eg ‘SSH - Copy’ and ‘wpa_supplicant.conf - Copy’ as well as on your PC
The MX package, at time of typing this, includes two executables:
* The function of these 2 files is to connect your Raspberry Pi to your network as soon as it boots, and allows you to connect to and control it from your PC by SSH using PuTTY. This avoids needing to connect a keyboard, mouse and monitor to the Raspberry Pi. It is particularly useful for Pi Zero W (or Pi Zero) which hasn’t got enough USB connections and no Ethernet (wired network) connection. This is called ‘Headless operation’.
* Right click on the ‘boot’ SD card in left pane of File Explorer and ‘Eject’ it safely.


'''Setting up the Raspberry Pi'''
== CumulusMX.exe ==
* With nothing plugged into the Raspberry Pi, take the Micro SD card from your PC and put it in the Pi.
* In a later step, you will need to find out the Raspberry Pi’s IP address by looking at your network router’s web interface. I can’t help you with doing that. If you don’t know how to, an alternative is to connect a keyboard, mouse and monitor to the Raspberry Pi at this stage
* Plug the power supply into the Raspberry Pi. It will boot up (note flashing red and/or green LEDs depending on model).
* On your PC, log into your network router’s web interface and identify the Pi’s IP address, which will be in the form xxx.xxx.xxx.xxx, for example 192.168.1.123
** NOTE: If you will be switching from a faster “build” Raspberry Pi to a “production” Raspberry Pi Zero W, the IP address will change, so you’ll need to repeat this step later
** While in your network router for the ‘production’ Pi you will be using, set up some port forwarding that will be needed later.
** Forward port 8998 to your Pi’s IP address for TCP protocol if you want to be able to access the Cumulus web interface from the external internet (this brings potential security risk though). [Forwarding port 8002 as well was previously needed].
* Start PuTTY on your PC. In the box for ‘Host Name or IP address’, enter the Pi’s IP address from above. In the adjacent ‘Port’ box, enter 22. Connection type should be SSH. Click ‘Open’.
* A window opens. The first time you do this you will probably see a long message asking to confirm it is OK to connect to a not-previously-known device. Click ‘Yes’.
* Login to the Pi. Username is pi [lower case] and password is raspberry [lower case]
* You will see a warning that SSH is enabled but the password has not been changed, which is a security risk. We will change the password in a moment
* Type
<pre>sudo raspi-config</pre>


* Note, to copy from here (usually need to do 1 line at a time), select it then CTRL-C. To paste into the PuTTY window, right click.
Whilst effectively MX is run by a '''CumulusMX.exe''' or '''sudo mono CumulusMX.exe''' depending on device, you actually need to ensure all the other components are loaded, so you either have a package that runs it for you, or you click a shortcut that includes the necessary path setting.
* As needed, adjust the following settings:
** Change the password to something you will remember. Leaving it at raspberry is a serious security risk – exposes your whole network to hackers
** In Network Options,
**#change the name of your pi to ‘Cumulus’ or something you prefer
**# WiFi network and password have already been set by the wpa-supplicant.conf file added earlier
** In Boot Options, Desktop / CLI, select ‘Console Autologin’
** In Localisation Options,
**# change ‘Locale’ if you need something different to en_GB.UTF-8. [Changing this takes quite a while on a slow Pi]. [As of Sep/Oct 2019, there is some kind of incompatibility between RaspBIAN Buster, mono v6.0.0.314 and locales other that en_GB - so unless you NEED another locale, it would be better to leave it as en_GB. The alternative is to force load an older version of Mono, for example v5.18]
**# Change Timezone.
**# Change Keyboard Layout if needed
**# WiFi country has already been set by the wpa-supplicant.conf file added earlier
** In Interfacing options, SSH server has already been set to be enabled by the empty SSH file added earlier
** Select ‘Finish’. There is no need to reboot at this stage. But until you do, you will see messages "sudo: unable to resolve host raspberrypi", but these can be safely ignored (it's just because you renamed the Pi - will disappear after next reboot)


In the steps below, you will need to press '''y''' to agree to proceed at various times
=== Optional parameters to add to the instruction to run the MX engine ===


If you have been building the Micro SD card on a fast Pi, now is the time to switch to the 'production' Pi, for which a slower Pi Zero W is more than adequate.
Beta builds in MX version 3.0.0 had an optional parameter <tt>-wsport nnnn</tt> that determined which port (represented by a 4 digit number ''nnnn'') was used for '''WebSockets'''. That parameter is now deprecated as WebSockets in all builds since 3045 uses the same port as the rest of the [[MX_Administrative_Interface#The_API_interface|Admin Interface]]. The remaining parameters that are still available are described in subsequent sub-sections.
Shut down the Raspberry Pi safely.
<pre>sudo halt</pre>


'''Move the micro SD card to the Pi Zero W'''.
==== Parameter for changing Port ====
Power on the Pi Zero W. Your SSH (PuTTY) session will close out and you'll need to reconnect after the Pi has rebooted. Use username pi and the new password you chose earlier.


'''Add the ‘Mono’ package'''
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:
* Simplification: Mono is a package which allows programs to be written cross-platform so that they will run on Linux (including Raspberry Pi), Windows and Mac OS, similar to the Windows ‘.NET Framework’.
<pre>sudo mono CumulusMX.exe -port 9999</pre>
* The previous anomaly with the USB library not working with later versions of mono, affecting Fine Offset stations and the later Oregon Scientific stations (WMR88/100/200 etc) has been fixed (''in CumulusMX build 3044 onwards'') and these and other stations should now be fine with later/current versions of mono. I am currently using a Fine Offset with mono v5.18
* Process is to install a security certificate, add the mono server to the list of software sources [sources.list] that the Pi searches, then install the mono-complete package:
<pre>sudo apt install apt-transport-https dirmngr gnupg ca-certificates
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/debian stable-raspbianbuster main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install -y mono-complete
sudo apt autoremove</pre>


At the time of writing (''18 Sep 2019''), this gets Mono v6.0.0.334, which works with Buster (RaspBIAN 10). However, there have been reports of incompatabilities which require use of an older version of Mono. These may have now been fixed, or alternatively may be related to use of locales other than en_GB.UTF-8 . Please see other threads in Support Forum for discussions.
==== Parameter for adding debugging ====
NOTE: ''29 Feb 2020'': added '''-y''' into the line '''sudo apt-get install -y mono-complete''' . This makes the install bypass the usual 'Continue Y/n?' prompt¨which was causing strange problems for some, e.g. worked if just pressed 'Enter' to accept default 'Y', but aborted installation if pressed 'Y Enter'. Bizarre.
'''
Reboot your Raspberry Pi'''
This would be a reasonable time to reboot your Pi:
<pre>sudo reboot</pre>


Your SSH (PuTTY) session will close out and you'll need to reconnect after the Pi has rebooted. Use username pi and the new password you chose earlier.
MX has a default level of logging that stores in  the [[MXDiags]] 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.
'''
Install Cumulus MX on the Raspberry Pi'''
Download it [[Software|from here]] to your PC, unzip on your PC which makes a directory named CumulusMX. Remember where that directory is located then on PC run FileZilla
# In the ‘Host’ box, enter the Raspberry Pi’s IP address eg 192.168.1.123
# In Username, enter pi
# In Password enter your pi’s password
# In Port, enter 22
# Click ‘Quickconnect’. Raspberry Pi’s directory structure appears on the right and your PC’s directory structure is on the left.
# In the LEFT window, navigate to where you unzipped the download of Cumulus MX earlier. Ensure can see the folder name ‘CumulusMX’ in the lower left window
# In the RIGHT window, ensure that the folder /home/pi is shown (see top right window; contents in bottom right window include .cache, .config etc)
# Drag the folder ‘CumulusMX’ to an empty area in the lower right window (not onto one of the existing directories). Watch progress as this copies the whole CumulusMX folder and contents to directory ~/CumulusMX on the Pi
# Close FileZilla


'''On Raspberry Pi PuTTY window:'''
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 ('''options''' section of ''station settings'') in admin interface  while MX is running, or by adding 1 or 2 parameters when you start MX.  Obviously this log file continues to grow, the longer MX is left running, and if debugging is switched on the file will grow in size must faster. Consequently, the default is not to add the extra debugging information and the settings can be used to switch it off again if you do have it switched on. Whether you start it with a parameter or enable it within settings, stopping MX will end the extra debugging, and on restart it will default back to no debugging unless turned on again with parameter or setting.
<pre>sudo halt</pre>


Plug your USB weather station into the Raspberry Pi – USB cable into the OTG connector (probably via an adaptor lead) if using Raspberry Pi Zero W.
You can also add  '''CumulusMX.exe -debug''' (to have full debugging of actions by MX turned on as MX starts), and/or '''CumulusMX.exe -Logging=1''' (for the station to MX transfers to have increased debugging logging).  
If you have an ethernet or WiFi linked weather station then you won't need to do this - I don't have one so I don't know exact details. Steve below says you need to enter the IP address during Cumulus setup, but then also adjust a disconnect period if you are also using Weatherlink software.


'''Running Cumulus'''
<pre>sudo mono CumulusMX.exe -debug -Logging=1</pre>
On PC, run PuTTY again and log in to the Pi as before (note you can save the IP address between sessions)
<pre>cd ~/CumulusMX
sudo mono CumulusMX.exe</pre>


The next thing you will want to do is access Cumulus via its '''user interface''' from your PC, so that you can update the '''settings'''. Using the IP address for your Pi, in your internet browser, enter: 192.168.y.z:8998 (where y and z are numbers you will need to find from seeing how your router connects to your Pi. You’ll first see a dashboard page, then can access the Settings menu.
Since this parameter is applied when you start MX, it applies while MX continues to run. Obviously, it must be applied every time you start MX if you want this increased level of logging to continue every time you restart MX.


To make Cumulus run each time the Pi is rebooted (and force reboot in the early hours each day)
The comments in the MX source suggests -debug turns on both debug and data logging (see [[MX_Administrative_Interface#Options|Station_Settings#Options]] in admin interface settings), but I believe that is wrong as per example above, there are 2 separate parameters.
On the Pi, type:
<pre>sudo crontab -e</pre>


On first run select the text editor you prefer (defaults to #1, nano, the easiest)
==== Parameter for changing Locale ====
Then add the following lines at the end of the file:
<pre># Start Cumulus as background task 30s after reboot (delay to allow WiFi to startup)
@reboot (sleep 30;cd /home/pi/CumulusMX;sudo mono CumulusMX.exe) &


# Reboot each day at 0253
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:
53 02 * * * sudo reboot</pre>
<pre>
sudo mono CumulusMX.exe -lang en-GB
</pre>
Other local 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'''.


'''To stop the Pi and restart it without CumulusMX running'''
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.
(eg you need to do that if upgrading the CumulusMX version) type the following
<pre>sudo crontab -e</pre>


'''edit to put a # at the start of the line''' "@reboot..."
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.
Ctrl-X to save the change to crontab and reboot using
<pre>sudo reboot</pre>


When your pi restarts, CumulusMX will no longer be running. You can then do your version upgrade or other task.
Note that you ''may'' need to supply your administrator password after typing the 'sudo ...' command line. The system will prompt you for this if it is needed.


To revert to normal auto-running of CumulusMX, go through the same again, but this time edit crontab to remove the # from the start of the line "@reboot...". Save changes and reboot - CumulusMX will be running.
== ExportMySQL.exe ==


Updating a version of CumulusMX is easily done as follows using this:
This second exe file has been available since the original MX package as Steve Loft developed this in April 2015, but sadly few people even notice it exists, and if they do, it is unlikely they know how to use it. Hopefully, some people will read this section and find out!
1. Stop CumulusMX running (it locks files while it is running)
2. Install the updated CumulusMX version into a new directory - I call mine CumulusMX3xyz (where xyz are the last 3 digits of the build number) so that I can easily see which build it is
3. copy the following from the old CumulusMX directory to the new CumulusMX3xyz directory:


- your CumulusMX/Cumulus.ini file
Obviously it was updated when Mark Crossley added the Feels Like fields to log files.


- your CumulusMX/data directory
Put simply, this executable will read log files and insert (insert ignore) rows into an existing database table. Since it only does inserts, despite the name of this function, it is not just for MySQL tables, the included SQL should work with whatever database table type you have.


- your CumulusMX/twitter.txt file (if you have personalised it)
The executable has a mandatory single parameter that tells it which log files to read, there are only 3 possible parameters ("dayfile", "monthly", or path to a file). It needs to know what locale (or culture settings) it is to use to work out what character separates each item in the log file list. It also needs to read your Cumulus.ini file, as it takes these "input parameters" from MySQL section in that:
*Host
*Port
*User
*Pass
*Database
*MonthlyTable
*DayfileTable


- your CumulusMX/web directory (if you have personalised any web files)
=== Daily summary log file ===


4. Change your startup instruction to use the version in the new directory eg cd /home/pi/CumulusMX3050;sudo mono CumulusMX.exe
# Use the feature in the admin interface:
#* Settings menu
#* MySQL settings page
#* In '''Dayfile.txt upload''' section, give your database table a name, or accept default ''Dayfile''.
#* Click '''Save''' to ensure this setting is updated
# Now scroll down to '''Create database table (save settings first)'''
#* Here click '''Create Dayfile'''
# Now you have a database table ready, you can use the executable to read all lines in your '''CumulusMX/data/dayfile.txt''' log file.
# Open a terminal display (if you are using Windows then, open a Command Window, a Windows Powershell window, or a Windows Terminal window)
# Run this executable in that terminal display (or command window) by using  '''sudo mono ExportMySql.exe daily''' or <tt>ExportMySql.exe daily</tt> depending on device.
# In the terminal display (or command window) you will see '''Parameter = daily''' confirming what you entered and in the line below that a rapidly updating code that is the primary key displayed for each row it tries to insert into the table.  If that primary key already exists in the table, it will still show the key, but no insert will take place.
#If you want MX to continue adding new rows to this database table, still in the admin interface, still in MySQL settings page:
#* Return to '''Dayfile.txt upload''' section, and select '''Enable'''.


With that method you can easily revert back to the old version if something has gone wrong. If all is well, you can delete the old directory after a few days/weeks/months/if you need the space.
=== Standard Log files ===


'''Updating mono version'''
# Use the feature in the admin interface:
*First, stop CumulusMX as above by editing crontab.
#* Settings menu
*Then remove the present version of mono:
#* MySQL settings page
<pre>sudo apt-get purge libmono* cli-common mono-runtime
#* In '''Monthly log file upload''' section, give your database table a name, or accept default ''Monthly''.
sudo apt-get autoremove</pre>
#* Click '''Save''' to ensure this setting is updated
# Now scroll down to '''Create database table (save settings first)'''
#* Here click '''Create Monthly'''
#If you want MX to continue adding new rows to this database table, still in the admin interface, still in MySQL settings page:
#* In the same '''Monthly log file upload''' section, now select '''Enable'''.
# Now you have a database table ready, you can use the executable to read all lines in either one (if path to that file is in parameter), or every (if parameter is monthly) standard log file.
#*If the parameter is "monthly" it will look in folder '''data'''  for every file it can find with a file name of datestring + "log.txt" where datestring is a 3 letter code (in your locale) for each month (1 to 12) followed by a 2 digit year (from "00" to "99") so that is how it finds every standard log file in the folder.
# Open a terminal display (if you are using Windows then, open a Command Window, a Windows Powershell window, or a Windows Terminal window)
# Run this executable in that terminal display (or command window) by using  '''sudo mono ExportMySql.exe monthly''' or <tt>ExportMySql.exe monthly</tt> depending on device.
#* Alternatively, replace '''monthly''' parameter by a full path to a single standard log file, and it will process just that log file.
# In the terminal display (or command window) you will see '''Parameter = monthly''' confirming what you entered and in the line below that a rapidly updating code that is the primary key (omitting the first two digits of the year) displayed for each row it tries to insert into the table.  If that primary key already exists in the table, it will still show the key, but no insert will take place.  So you can run this again to pick up any additions to the latest log file since the original run. Also notice that if you use the parameter "monthly" the order in which it will process different standard log files is not predicable, they probably will not be in any particular order, but as one feature of SQL databases is that the row order is not able to be determined, it does not matter if rows are not added in chronological order.
#* It is worth noting that it is safe to run this procedure while MX is also running, because this procedure only updates log entries that exist as this  procedure reads the logs, and MX only adds new entries to the log and at the same time uploads that new entry (if enabled) to the database table.


*Then install the new version
Please be aware that the transfer to the database table adds two columns where bearings in the original log file given in degrees are output as compass directions, and these use up to 3 letters of how the compass directions are defined in the '''strings.ini''' file. Thus the number of columns in the database table will be at least 2 more than the number of fields in the log files. It is also important to stress that whilst the database table must contain one column defined for each field (plus the extra 2) being uploaded, you can add even more columns to your table if you want and populate those some other way. For example, I have added a Canadian Humidity Index (Humidex) column which is not in the standard logs, but is calculated by Cumulus, and can be calculated from columns that are uploaded from the standard log. Humidex is not uploaded by either ExportMySQL or the normal CumulusMX process, but neither objects to extra columns being there.
<pre>sudo apt-get install mono-complete</pre>


*Finally re-enable auto running by editing crontab to remove the # and finally
When testing this, I had some log files produced by various old versions of Cumulus 1 in my MX data folder as well as the log files in has generated since I swapped to MX. Plus I had used a PHP script to add feels like to those log files produced before version 3.6.0 and to correct feels like for those log entries made by versions 3.6.0 to 3.6.9 inclusive because they used a different formula to the one being used from version 3.6.10.  This php script is a web page with a HTML form and can be obtained from the forum in [https://cumulus.hosiene.co.uk/viewtopic.php?f=18&t=18096 Create Missing for MX]
<pre>sudo reboot</pre>


Above Instructions: Last edited by ExperiMentor on Sun 01 Mar 2020 8:17 am,
I notice that the database rows produced by those short log file lines produced by say version 1.9.0 had nulls entered for all subsequent columns, except '''Feels Like''' and this column was initialised at 0.0!


=== Notes by Steve Loft ===
For those log files produced by the final version 1.9.4, all columns are populated although feels like is set to 0.0.


''please note these notes ARE now obsolete, library routines have changed a lot since this was written in 2014''
= Library software =


'''Any volunteers to replace this section with up to date information?'''
For most Cumulus users, this whole section can be skipped, but I have included it for those few users who have a technical slant and might want to understand more.


Cumulus MX uses '''library''' software (i.e. software written by others and made available by the provider and often also by other content delivery nodes  or 'cdn')  for a lot of the standard functionality. The library software for the admin interface and the separate library software for the standard web pages are both mostly included in the distribution zip, although some is used via a link to a cdn.


**If you have a Raspberry Pi 2, there is a later version of Mono available, which you may find works better that the one in the standard distribution, particularly if you use decimal commas. Mono 3.2.8 (which is the default in some Linux distributions) will not work if you use commas for decimals, as in some countries.
Many of the libraries included by MX are very obsolete. However, Mark Crossley, the current developer, said the following on 30 Sept 2019:
"Chasing the latest versions of all the packages for the sake of it is a thankless task, and requires considerable effort to regression test each update. I am only updating packages when required to fix issues or for platform compatibility."


**On Linux you will need library '''libudev.so.0''' which may not be installed by default. Installing '''package libudev0''' may resolve this. There may be issues if you are using a 64-bit version of Linux. I'm not sure what the resolution is at the moment, if this is the case.
Just to mention the other side of this balance. It is difficult to code an addition to MX that works with these obsolete versions of libraries. All documentation provided by providers of the libraries relates to current versions of the packages (and what is documented to work now often will not work with obsolete versions). The documentation for the packages that are no longer supported is only available in archive sites if available at all.


You need to specify something like '''/dev/ttyUSB0''' for the connection for your weather station. This is set in the "station settings" and stored in the [[Cumulus.ini#station|ComportName attribute]] in Cumulus.ini configuration file.
==Library Software for the MX engine==


In some builds of MX you have to run as "root", there are ways of giving "root" like permissions when running MX as another user, see forum for details until this section has been updated.
The distribution zip contains various '''.dll''' files and these are the libraries used by MX itself. The exact mix of libraries included has varied at various times, the list below is a snapshot of those included at the version that was investigated when this article was extended to include this section, and may not be right for the current MX version.


= Optional parameters to add to the instruction to run the MX engine =
===Devart===


The two files used are both related to the database functionality of MX.


== Parameter for changing Port ==
===FluentFTP===


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:
As the name suggests, this is used by MX for controlling the file transfer functionality. This component was first introduced at version 3.0.0 build 3045 (adding more functionality than that available from System.Net.FtpClien, which was used at earlier MX builds), and FluentFTP.dll has been updated at some subsequent MX releases, see the announcements for details.
<pre>sudo mono CumulusMX.exe -port 9999</pre>


== Parameter for adding debugging ==
===Linq===


MX has a default level of logging that stores in the [[MXDiags]] 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.
Language INtegrated Query is used to work with sequences of items and pick the ones that are needed, putting them into output format required. MX uses two files in connection with preparing output for Twitter. There is a third Linq file for other processing.


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 ('''options''' section of ''station settings'') in admin interface  while MX is running, or by adding 1 or 2 parameters when you start MX.  Obviously this log file continues to grow, the longer MX is left running, and if debugging is switched on the file will grow in size must faster. Consequently, the default is not to add the extra debugging information and the settings can be used to switch it off again if you do have it switched on. Whether you start it with a parameter or enable it within settings, stopping MX will end the extra debugging, and on restart it will default back to no debugging unless turned on again with parameter or setting.
===MQTT===


You can also add  '''CumulusMX.exe -debug''' (to have full debugging of actions by MX turned on as MX starts), and/or '''CumulusMX.exe -Logging=1''' (for the station to MX transfers to have increased debugging logging).  
When MX added capability to talk to other devices using the MQTT protocol, it added this component for that optional functionality.


<pre>sudo mono CumulusMX.exe -debug -Logging=1</pre>
===Newtonsoft===


Since this parameter is applied when you start MX, it applies while MX continues to run. Obviously, it must be applied every time you start MX if you want this increased level of logging to continue every time you restart MX.
This component is used for processing JSON strings. It is a very popular choice for developers, and used therefore very widely. However, '''SystemText''' has superseded it, so MX is using an obsolete method.


== Parameter for changing Locale ==
===Renci SSH===


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:
This component is server connection software, it is what processes the host name, password, and so on.
<pre>
sudo mono CumulusMX.exe -lang en-GB
</pre>
Other local 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'''.


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.
===SQLite3===


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.
This is used for all interactions with the [[Weather Diary|weather diary]].


Note that you ''may'' need to supply your administrator password after typing the 'sudo ...' command line. The system will prompt you for this if it is needed.
===HTTP===


These files handle the optional HTTP functionality.


= Library software =
===Unosquare===


Cumulus MX uses library software for a lot of the standard functionality. The library software is largely included in the distribution zip.
The EmbedIO file is open-source software that handles the web-sockets functionality of MX. The Swan file is open-source software that handles JSON formatting and threading of tasks in MX.


== Library software for admin interface ==
== Library software for admin interface ==
As the following sections reveal, MX uses external libraries rather than writing its own code whenever possible.
*However, that does not mean MX is good at meeting development standards.
*MX only implements small parts of the functionality of most libraries, the minimum to make a feature work, not all the features available to make it work well
*MX does not use the latest versions of libraries
*MX does not attempt to obey guidance for good user interaction, and although validation is being added, many parts of MX do depend on user understanding what is valid
*MX does not make provision for screen readers and other accessibility aids.


===Alpaca===
===Alpaca===
Line 618: Line 540:
===Bootstrap===
===Bootstrap===


#Also known by some as ''Twitter Bootstrap'' which gives a clue as to its origins as an internal tool for those building Twitter, that company still keep making updates as it is now the most popular styling library of all those available widely.
#Also known by some as ''Twitter Bootstrap'' which gives a clue as to its developer and to its origins as an internal tool for those building Twitter, that company still keep making updates as it is now the most popular styling library of all those available widely.
*The simplest way to think about this package is as a standard set of styling promoting easy responsive (means adapts to screen dimensions) web site design.
*The simplest way to think about this package is as a standard set of styling promoting easy responsive (means adapts to screen dimensions) web site design.
*To give just a few examples, it defines a standard way to represent buttons, form components, lists, navigation, and breadcrumbs.
*To give just a few examples, it defines a standard way to represent buttons, form components, lists, navigation, and breadcrumbs.
*MX uses Bootstrap version 3.3.7 (http://getbootstrap.com), which is very restricted in what it offers
*MX uses Bootstrap version 3.3.7, which is very restricted in what it offers
** The current Bootstrap version 4.5.0 (Bootstrap 4 released as alpha in August 2015, beta in August 2017, and with fully working releases frequently from January 2018) has been very widely praised for its improved functionality, and ability to work with latest jQuery and multiple modern devices/browsers.   
**Bootstrap version 5 is available (http://getbootstrap.com), so MX is using an obsolete library
*MX does not implement colouring text according to what it represents (primary, secondary, information, warning etc.), nor does MX obey modern HTML standards as it makes no provision for screen readers and other accessibility aids.
** Bootstrap version 4.5.0 (Bootstrap 4 released as alpha in August 2015, beta in August 2017, and with fully working releases frequently from January 2018) was very widely praised for its improved functionality, and ability to work with latest jQuery and multiple modern devices/browsers.   
*MX does not implement key features of Bootstrap like colouring text according to what it represents (primary, secondary, information, warning etc.)


===dataTables===
===dataTables===
#When MX sends out multiple lines of a log file to view or edit, the application programming interface (api) that transfers the information from the MX engine sends it in dataTables format for display on the web page in the admin interface.
#When MX sends out multiple lines of a log file to view or edit, the application programming interface (api) that transfers the information from the MX engine sends it in dataTables format for display on the web page in the admin interface.
#Thus dataTables does all the work of providing the ability to move between multiple pages needed to allow MX to just send 10 lines of a log file at a time to the admin interface.
#Thus dataTables does all the work of providing the ability to present the data in a HTML table, the functionality to move between multiple pages needed (as MX sends only up to 10 lines of a log file at a time to the admin interface).
#The free version of dataTables used by MX lacks the most useful functionality that needs a subscription licence. For example, editing functionality requires a subscription.
#The free version of dataTables used by MX lacks the most useful functionality that needs a subscription licence. For example, its editing functionality requires a subscription.


===altEditor===
===altEditor===


*This is an editing tool that can read what is in dataTables, create what it calls a modal (a pop-up dialog) where rows can be added, edited or deleted individually.
*This is an editing tool that can read what is in dataTables, create what it calls a modal (a pop-up dialog) where rows can be added, edited, or deleted individually.
** MX when it added editing of log files at version 3.4.5 - Build 3069 (Friday 13 March 2020) adopted this software as it was free (although Mark Crossley said in his release notice: "The main thrust of this release is to add some log file editing capability to Cumulus MX.  It works on all three log file types, but it is fairly basic at present. You can edit or delete lines in the files.  The editing has to be done via pop-up dialog.  
** MX when it added editing of log files at version 3.4.5 - Build 3069 (Friday 13 March 2020) adopted this software as it was free (although Mark Crossley said in his release notice: '''"The main thrust of this release is to add some log file editing capability to Cumulus MX.  It works on all three log file types, but it is fairly basic at present. You can edit or delete lines in the files.  The editing has to be done via pop-up dialog.'''
**I only found two libraries that support JQuery dataTables editing, one is very comprehensive - but costs $$$ - the other is free.  The free version does not currently support in-line editing of the table which is a shame.
**'''I only found two libraries that support JQuery dataTables editing, one is very comprehensive - but costs $$$ - the other is free.  The free version does not currently support in-line editing of the table which is a shame.'''
**  If any web guru out there can come up with a better solution please post about it on the forum, or send a pull request." (By the way, it is possible to provide in-line editing and make it work with the existing api interface, but making it compatible with the obsolete software used by MX is hard).
**  '''If any web guru out there can come up with a better solution please post about it on the forum, or send a pull request."''') ''(By the way, it is possible to provide in-line editing and make it work with the existing api interface, but making it compatible with the obsolete software used by MX is hard).''
*The single line of fields that is result of an edit or deletion done on the modal is sent back via another api to the server (the MX engine in our case) and that then regenerates the dataTables in the state after whatever action was done, sending back again up to 10 lines for the same page as before.
*The single line of fields that is result of an edit or deletion done on the modal is sent back via another api to the server (the MX engine in our case) and that then regenerates the dataTables in the state after whatever action was done, sending back again up to 10 lines for the same page as before.
*As it happens there is another JQuery dataTables editing tool, but it has not been maintained since 2012. It is found at https://github.com/NicolasCARPi/jquery_jeditable, but the documentation is now only available in an archive at https://web.archive.org/web/20200615000000*/https://appelsiini.net/projects/jeditable.  It is designed for editing table cells, so it does not involve any pop-up dialog.
*As it happens there is another JQuery dataTables editing tool, but it has not been maintained since 2012. It is found at https://github.com/NicolasCARPi/jquery_jeditable, but the documentation is now only available in an archive at https://web.archive.org/web/20200615000000*/https://appelsiini.net/projects/jeditable.  It is designed for editing table cells, so it does not involve any pop-up dialog.
Line 670: Line 594:
# Consequently, the developers quickly removed it, but it remained available from Contents Delivery Nodes, which is where MX has found it.
# Consequently, the developers quickly removed it, but it remained available from Contents Delivery Nodes, which is where MX has found it.
# Not surprisingly, the authors of jQuery strongly advise all 1.9.1 users to move to a later version.
# Not surprisingly, the authors of jQuery strongly advise all 1.9.1 users to move to a later version.
#* Unfortunately, there are interdependencies between all the library code used by MX, so you cannot simply update this component.
#* Unfortunately, there are interdependencies between all the library code used by MX, so you cannot simply update this component (see next library item).


===SteelSeries===
===Jquery Template===


MX uses a hacked version of the [[SteelSeries Gauges|steel series]] library described elsewhere for all the gauges (see dashboard and gauges tabs) in MX.
* This is also obsolete, and therefore will only work with old versions of jQuery (1.4.2 to 1.11.0).
*It was originally available from jQuery downloads, but they now offer '''jsRender.js''' for this functionality.
* It basically is used to bind the contents of objects (like array elements) into particular locations within HTML.


===SteelSeries===


MX uses a modified version of the [[SteelSeries Gauges|steel series]] library made available by Mark Crossley for all the gauges (see dashboard and gauges pages of the admin interface) in MX.


===Highstocks===
===Highstocks===
5,838

edits

Navigation menu