CumulusUtils: Difference between revisions

From Cumulus Wiki
Jump to navigationJump to search
m
 
(22 intermediate revisions by the same user not shown)
This paragraph describes what is required to use CumuluUtils (To be modified/extended by user experience).
#A working CumulusMX environment on Windows, Linux (RPi) or MacOS
##On Linux (and probably MacOS too) Mono 6 and up is required. Thethe user must verify whether [[SysInfo#Introduction|the application ''lshw'' has been installed]].
##NOTE: no experience by the author on MacOS exists so be prepared to communicate
#For the ''[[Charts_-_Misc_charts|Miscellaneous Charts]]'' more data - a year starting on jan 1 - is required to make these useful
#At least 32 days of data
#From CMX4 and CMX5 change in the handling of datetime in the logs. Corresponding CUtils versions are available. It is advised to upgrade to the last version of CMX/CUtils as fast as possible because of support.
#For the ''[[Charts_-_Misc_charts|Miscellaneous Charts]]'' more data is required
#For longer data series check your locale creates consistent logfile entries and it will be usefulluseful to run the [[Software#Create_Missing|CMX supporting application ''CreateMissing.exe'']] beforehand.
#For the logfiles:
##A consistent date format, mixed date formats in logfiles are not accepted by CumulusUtils
##Consistent data and separator use
##If a legal date format in a logfile is used which is not implemented, just request it
#For longer data series check your locale creates consistent logfile entries and it will be usefull to run the [[Software#Create_Missing|CMX supporting application ''CreateMissing.exe'']] beforehand
 
== Goals ==
The goal of ''CumulusUtils'' (abbr: ''Cutils'' or ''CUtils'') is to facilitate website creation for users of CumulusMX without exposure to coding in e.g. PHP or javascript. Having a meteo-website should not be privileged to users with great IT-skills. Making charts should not be demanding for programming skills in SQL or making it otherwise impossible to create charts without diving deep into the technique involved in CumulusMX (which actually is also the case with SQL). Note that this does not mean you can't use IT skills: the ''user configurable menu'' offers an opening to expand as far as you wish.
 
''CumulusUtils'' positions itself as a configurable application for which the understanding of how to run it and how to configure it is the most important thing to know. For configuration ''CumulusUtils'' uses [[Cumulusutils.ini|''cumulusutils.ini'']] file which resides in the CumulusMX directory. If that file does not exist, it will be created. The same holds for the CUstringsXX.ini file (containing your translations for CUtils text strings). All other files related to ''CumulusUtils'' arereside in the utils directory.
 
The charts are created using [https://www.highcharts.com/ HighCharts] using their [https://shop.highsofthighcharts.com/highsoft/form/noncommercialform nonlicense-commercialeula license"Personal Use" License]. If you want to use the charts or the [[Website Generator]] of ''CumulusUtils'', please make yourself acquainted with this license.
 
== Assumptions ==
== Installation ==
 
# ''CumulusUtils'' is available in a distribution which can be downloaded from the [https://cumulus.hosiene.co.uk/viewtopic.php?f=44&t=17998 forum]. In the CumulusMX directory the user must create a directory ''utils'' (case dependent) and must copy the files of the distribution (including the subdirectories) to that directory.
# Rename ''CutilsCharts-default-for-use.def : when used rename'' to ''CutilsCharts.def''
# Then, on the domain for the website, the user needs to make two directories in the webroot: 'lib' and 'css'. In addition the distribution directory CUicons must be copied as a whole - with contents - to the webroot.
# Updating ''CumulusUtils'' is done by completely overwriting the contents of the installation directory utils as if it were an installation. If you want to save the old installation, make a copy of the utils directory.
# The language setting of CumulusUtils is for display/language handling only and does not affect the reading of the data in any way apart for the monthly log file name.
# NOTE a seemingly important issue: the datafiles (the naming and the contents) are dependent for their format on the locale / country setting of your machine. If you install and run from scratch and do not bother CMX will take the country setting from the settings of the computer. You may also give the country setting on the commandline when starting CMX. However, it is important to know that CumulusUtils does not handle datafiles with mixed languages and produces lots of errors. When starting with a new install this is not a big deal. But if you have years of old data which you wish to analyse as well you must consider carefully which country setting of CMX is required. Note that the language setting of CumulusUtils is for display/language handling only and does not affect the reading of the data in any way apart for the monthly log file name. If you use a different locale than the one you use for CMX, the please fill in the parameter ''MonthsOfMiracleAndWonder'' (section [General]) with the abbreviated filenames of the locale you use for CMX.
# From CMX version 4, the logfiles are written as invariant and the above striked through note has become invalid.
# From CMX version 4.7 (.NET 10; later rename version 5.0) there are changes in the database which require CMX to run before CUtils 8.2.0 can run.
 
When installed you are ready to run. The first run after an install or an update MUST be without [[Thrifty - Cutils Command Qualifier|Thrifty]].
|--- lib (JavaScript libraries, uploaded by CumulusUtils during a run)
|--- css (css files, uploaded by CumulusUtils during a run)
|--- CUicons (required to be manually copied once)
 
=== Updating CumulusUtils ===
#CUserAbout-example.txt : as an example of the user about file - when used rename to ''CUserAbout.txt''
#CutilsMenu-example-for-use.def : as an example of the menu structure - when used rename to ''CutilsMenu.def''
#CutilsCharts-default-for-use.def : when used rename to ''CutilsCharts.def''
#CutilsCharts-examples.def : not intended for direct use, contains some more elaborate examples of the [[ChartsCompiler]] possibilities
 
To avoid confusion it is left to the user to edit and maintain the files for use either on the website or on the CumulusMX machine.
 
When creating website the file ''CutilsHead.def'' may have importance to you. See [[Website Generator|Website]]
 
=== Manually installing without FTP ===
NOTE: Not using the automatic upload system is disadvised. Because CumulusUtils is datadriven it requires the JSON files and the ''realtime.txt'' and ''realtimegauges.txt'' from CMX. Besides those, if you are using the ''UserAskedData'' feature of CumulusUtils there will be additional JSON files required for the server and without the upload module youryou will need a way to get them there. There is no copy feature like CMX has as CumulusUtils is designed as a website tool and an upload method is implicitelyimplicitly assumed present. However, manual handling can be done but is not advised.
 
All required installation and generated files are present in the utils directory and copied with ''FTP'' or ''PHP upload'' to the server during a run of CumulusUtils.
 
If you don't use ''FTP'' or ''PHP upload'' you will have to copy manually.
 
The PHP upload is by far preferred.
 
=== Files involved ===
| index.html || <webroot>
|-
| gaugesCUgauges.js || <webroot>/lib || Despite the same name this file is very different from the one in CMX
|-
| languageCUlanguage.js || <webroot>/lib
|-
| HighchartsDefaults.js || <webroot>/lib
| suncalc.js || <webroot>/lib
|-
| tweenCUtween.min.js || <webroot>/lib
|-
| steelseriesCUsteelseries.min.js || <webroot>/lib
|-
| RGraphCURGraph.rose.js || <webroot>/lib
|-
| RGraphCURGraph.common.core.js || <webroot>/lib
|-
| gaugesCUgauges-ss.css || <webroot>/css
|-
! Generated File !! Destination !! Remark
== Running CumulusUtils ==
 
CumulusUtils is - up to v6.x.y - a [https://www.mono-project.com/ ''mono''] executable. This is now deprecated and no longer supported.
From v7.0.0 and up it runs under [https://dotnet.microsoft.com/en-us/ ''dotnet (.NET 8)''].
 
From v7.0.0 and up it runs under .NET 8 [https://dotnetlearn.microsoft.com/en-usgb/dotnet/core/install/linux-scripted-manual#scripted-install ''dotnetFollow (.NETthis 8) link when on Linux''].
Both environments are very different and not interchangeable. However running CumulusUtils is pretty similar on both environment and mono and dotnet can co-exist on the same machine. See the CMX installation on how to install either mono or dotnet. CumulusUtils assumes the correct installation of either environment.
 
From v8.2.0 and up it runs under .NET 10 [https://learn.microsoft.com/en-gb/dotnet/core/install/linux-scripted-manual#scripted-install ''Follow this link when on Linux''] (and this has changes to the database which require CMX to run before CUtils can successfully run).
 
BothAll environments are very different and not interchangeable. However running CumulusUtils is pretty similar on bothall environmentenvironments and mono and dotnet (8 and 10) can co-exist on the same machine. See the CMX installation on how to install either mono or dotnet. CumulusUtils assumes the correct installation of either environment.
 
Mono is an open source implementation of Microsoft's .NET Framework based on the ECMA standards for C# and the Common Language Runtime.
''CumulusUtils'' runs on any operating system CumulusMX runs on and it '''MUST''' run in the CumulusMX directory (as ''working directory'').
Running ''CumulusUtils'' is done from the commandline in a command window (under any OS) or from a script.
 
''CumulusUtils'' takes one or more commandline parameters (in short: commands) and must be like (see NOTE 1 below; square brackets means ''optional'' so DON'T TYPE THEM):
 
''dotnet utils/bin/cumulusutils.exedll [command]'' (the ''mono.NET'' syntax - this''dotnet'' assumesis monoobligatory ison alreadythe activecommandline for UNIX. Note the '''dll''')
 
''dotnet utils/bin/cumulusutils.dll [command]'' (the ''.NET'' syntax - ''dotnet'' is obligatory on the commandline. Note the '''dll''')
 
BelowFor is described for ''mono'', when using .NET, please change the command as above.UNIX: Note you will have to carry this on in scripts as well. Using the dotnet command in crontab requires using the explicit path to the dotnet command or defining the PATH environment variable in the crontab script which does not know the environment (a bit awkward).
 
If no commands are given the application responds with:
[ [[pwsFWI]] ][ [[Records - Top10|Top10]] ][ [[Graphs]] ][ [[Yadr]] ][ [[Records]] ]
[ [[NOAA]] ][ [[Records - DayRecords|DayRecords]] ][ [[AirLink]] ][ [[UserAskedData]] ]
[ [[ChartsCompiler|CompileOnly]] ] [ [[Extra Sensors|ExtraSensors]] ] [ [[Custom Logs|CustomLogs]] ]
[ [[Diary|Diary ]] ] [[CumulusUtils Runtime Library|CUlib]] ]
| [ [[Thrifty - Cutils Command Qualifier|Thrifty]] ]
 
Please note that CumulusUtils requires live data from CumulusMX to display what you expect. To accomplish that you need to configure CMX as follows:
 
The things it is looking for are realtime.txt and realtimegauges.txt. Those are sent by CMX to the directory you configure in ''Settings=>Internet Settings=>Web/FTPUpload Site''.
 
In ''Settings=>Web/FTPInternet Settings=>Interval Configuration=>Normal Interval Settings'': Tick both options and set the interval time to enable realtimeinterval Upload
In ''Settings=>Web/FTPInternet Settings=>Interval SettingsConfiguration=>Standard File settings'': Disable both options (for CumulusUtils, if you have websites which use those, leave it enabled)
In ''Settings=>Web/FTPInternet Settings=>Interval SettingsConfiguration=>Graph File Settings'': Enable all (bothonly ''GenerateUpload'', anduse ''TransferCreate Local'' only when needed) except ''availabledata.json''the and ''airquality.json''following:
''availabledata.json'', ''dailyrain.json'', ''dailytemp.json'', ''sunhours.json'', ''airquality.json'', ''extra*.json'', ''soil*.json'', ''user*.json'',''co2*.json'' and ''leaf*.json''
 
In ''Settings=>Web/FTPInternet Settings=>RealtimeInterval Configuration=>Daily Graph File Settings'': TickEnable all except ''alldailydegdaydata.json'', ''alltempsumdata.json'' and ''allchillhrsdata.json''
 
In ''Settings=>Web/FTPInternet Settings=>GeneralInterval Configuration=>Real time Interval Settings'': Tick onlyboth ''UTF-8and encoding''set interval time to enable realtime Upload
In ''Settings=>Internet Settings=>Interval Configuration=>Real time Interval Settings'': Tick both ''realtime.txt'' and ''realtimegauges.txt'' for Upload, use ''Create Local'' only when needed.
 
In ''Settings=>Web/Upload Site=>General Settings'': Tick ''UTF-8 encoding''
And if you use the ''[[ChartsCompiler]]'' (or plan to use, you may be more selective later when understanding what and how):
 
In ''Settings=>Web/FTP Settings=>Interval Settings=>Daily Graph File Settings'': Enable all options except alldailydegdaydata.json and alltempsum.json
And if you useFor the ''[[ChartsCompiler]]'' (or plan to use, you may be more selective later when understanding what and how):
otherwise, disable.
 
After selecting the required tables you need to select the variables they may contain:
'''NOTE: You may disable some fields later when you are more acquainted with the system. Disabling tables and field can be especially useful when you are worried about size of transfer and provider limits.'''
 
If you start usingWith the ''[[ChartsCompiler]]'', you may need the ''[[UserAskedData]]'' command to CumulusUtils. See the [[ChartsCompiler]].
 
You may want to read about and understand the [[Website_Generator#CumulusRealTimeLocation|''CumulusRealTimeLocation'']]
Running CumulusUtils results in output which represents a static view of the data in a table or graphic format for display on your website (it may even create a complete website). The fact that the output is a static view requires the output to be regenerated when new data is available. Rerunning CumulusUtils is also required when you change anything in the configuration and can't wait to see that change reflected on the site. In general: changes in data and configuration require a rerun.
 
Reruns for changes of data are typically once per day, just after rollover time. In that sense it is like running a new query.
 
There are some exceptions to the daily rule: Sysinfo and [[UserAskedData]]
Automating the run of CumulusUtils on the Raspberry Pi is typically done through [https://man7.org/linux/man-pages/man5/crontab.5.html ''crontab'']. Below is the crontab of the author of CumulusUtils to be used as an '''example'''!
 
===== For dotnet =====
15 1 * * * cd /home/CumulusMX; utils/bin/cumulusutils.exe thrifty website
9-59/1005 *1 * * * cd /home/CumulusMX; /usr/share/dotnet/dotnet utils/bin/cumulusutils.exe sysinfodll UserAskedDatathrifty UserReportwebsite
1-51/10 * * * * cd /home/CumulusMX; /usr/share/dotnet/dotnet utils/bin/cumulusutils.dll sysinfo UserAskedData UserReports
 
==== Windows: Using the scheduler ====
(It can be a filename of choice but must have extension of .bat, if using windows notepad, underneath the File name: option, will need to set Save as type: option to All Files (*.*). This way when the File name: is set as cumulusutils.bat it will save it as that and not cumulusutils.bat.txt)
====== Batch file code of cumulusutils.bat ======
'''''For v6 and below (running under mono):'''''<br/><br/>
</br>
REM This batch file script checks for the process CumulusMX.exe is running, if yes, then runs the "cumulusutils.exe", otherwise exit</br>
REM Set the current working session to the folder C:\CumulusMX</br>
 
NOTE: The command shown here is ''Website''. The user can put any command he likes in here (with or without ''Thrifty'') depending on what he wants to achieve. Possibly he has to create multiple tasks (e.g. UserAskedData specifically runs on a higher frequency than website). These commands then require their own batch files.
 
'''''For v7 and up (running under dotnet):'''''<br/><br/>
REM This batch file script checks for the process CumulusMX.exe is running, if yes, then runs the "cumulusutils.exe", otherwise exit<br/>
REM Set the current working session to the folder C:\CumulusMX<br/>
cd\<br/>
cd C:\CumulusMX<br/>
REM Check for CumulusMX.exe is running, if yes goto :runutils, otherwise goto :end<br/>
tasklist /FI "IMAGENAME eq CumulusMX.exe" 2>NUL | find /I /N "CumulusMX.exe">NUL<br/>
if "%ERRORLEVEL%"=="0" GOTO runutils<br/>
GOTO end<br/>
REM Set as working directory C:\CumulusMX and run cumulusutils.exe in folder C:\CumulusMX\utils\bin, with the desired command or commands as per the wiki<br/>
:runutils<br/>
START /D C:\CumulusMX dotnet C:\CumulusMX\utils\bin\cumulusutils.dll Website<br/>
:end<br/>
exit<br/>
 
===== Task creation process =====
===== Customisation =====
One can also customise/fine tune the task further by exporting it, default export format is XML. Then can edit in favourite text editor and reimport when done. May be useful in particular for fine tuning the repetition times of the task.
 
==== MAC: Using crontab (advised) ====
Automating the run of CumulusUtils on the MAC is typically done through [https://share.google/aimode/CMq6jMIq3FvXLT8bn ''crontab'']. The link is a Google Gemini shortcut which offers more batch options on the MAC. The advise is to use ''crontab'' to have support available. Below is the crontab on RPi of the author of CumulusUtils to be used as an '''example'''!
 
===== For dotnet =====
1505 1 * * * cd /home/CumulusMX; /usr/share/dotnet/dotnet utils/bin/cumulusutils.exedll thrifty website
1-51/10 * * * * cd /home/CumulusMX; /usr/share/dotnet/dotnet utils/bin/cumulusutils.dll sysinfo UserAskedData UserReports
 
== Additional remarks ==
 
#(on NOT Windows) When mono is already active (as daemon or from command line in another process) you can start any mono executable without having it prepended by the mono command. As normally (if you did not uninstall it) xsp4 is running as a daemon, mono is always available so you can run mono executables as normal linux executables. You won't notice the difference. However if you don't have the x bit set, you get access refused when trying to execute. Without the x bit set you have to prepend mono as in: ''mono utils/bin/cumulusutils.exe''. Then it executes without the x bit set because then it is an argument to the mono command.
#CumulusUtils is written in C#, HTML and javascript. All HTML and javascript is embedded in the C# code and generated on execution of ''CumulusUtils''. The cumuluscharts.txt charts library was based on the cumuluscharts.js originally distributed with ''CumulusMX'', probably the version a bit before April 2020 and has been modified since. With the appearance of the [[ChartsCompiler]] the name cumuluscharts.txt has been preserved but the technique of creating the charts has been changed.
#As CumulusUtils itself runs in the Cumulus directory, the data directory (data) is one level below. CumulusUtils currently uses - a copy of - dayfile.txt, the monthly logfiles and incidentally the alltime.ini file. It also takes information from Cumulus.ini. All output is written to the utils/ subdirectory. All logs are created in the utils/utilslog/ subdirectory. It also uses the AirLink.log and the ExtraLog files in a similar way when the user has such devices.
#CumulusUtils can output for many languages. See the specific page on [[Language in CumulusUtils|language in CumulusUtils]].
#Development of CumulusUtils started in 9<sup>th</sup> of August 2019 with an initial commit of the Top10 written in C. Development changed rapidly to C# with an initial commit of Top10 on November 19 2019 of version 0.7.0. The rest of the history can be read in the [[Release Notes|release notes]].
#Users canPlease, present themselvesyourselves on the CumulusUtils [[Map - Users of CumulusUtils|usermap]]. AlthoughFor optional for moduleswebsite users, theit authoris seesautomatic itand asobligatory payment forbut the usageURL ofneeds theto tool,be sofilled pleasein putby yourself onin the mapinifile. ForWhen not a complete website, usersplease itfill isin automaticthe andURL obligatoryto the page you use CUtils for (e.g. pwsFWI).
#In case of problems there exists [[Errorlogging]].
#''CumulusUtils'' is &copy; Hans Rottier and can be used under the [https://creativecommons.org/licenses/by/4.0/ Creative Commons Attribution License]. At some point the code will be in the public domain under a different license.
 
'''NOTE''': comments to this series of articles is welcome. either by using the Talk feature of the Wiki for that page, directDirect edit of the article (request an account) oris switched byoff. contactingContacting the author of CumulusUtils [https://cumulus.hosiene.co.uk/memberlist.php?mode=viewprofile&u=9016 HansR] on the [https://cumulus.hosiene.co.uk/viewtopic.php?f=44 forum] or through PM.
 
[[Category:WebTools]][[Category:User Contributions]][[Category:CumulusUtils]]

Navigation menu