CumulusUtils: Difference between revisions

m
(10 intermediate revisions by the same user not shown)
Line 5: Line 5:
== Introduction ==
== Introduction ==
This is the first page of the CumulusUtils Wiki. From here you should be able to find everything you need to know for this tool.
This is the first page of the CumulusUtils Wiki. From here you should be able to find everything you need to know for this tool.
If needed you can always go to the CumulusUtils Category page (see bottom of this page).


== Prerequisites ==
== Prerequisites ==
Line 68: Line 70:
Beside the libraries the distribution contains:
Beside the libraries the distribution contains:
#CUserAbout-example.txt : as an example of the user about file - when used rename to ''CUserAbout.txt''
#CUserAbout-example.txt : as an example of the user about file - when used rename to ''CUserAbout.txt''
#CUsermenu-example.txt : as an example of the menu structure - when used rename to ''CUsermenu.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-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
#CutilsCharts-examples.def : not intended for direct use, contains some more elaborate examples of the [[ChartsCompiler]] possibilities
Line 77: Line 79:
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 your 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 implicitely assumed present. However, manual handling can be done but is not advised.
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 your 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 implicitely 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 to the server during a run of CumulusUtils.
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 you will have to copy manually.
If you don't use ''FTP'' or ''PHP upload'' you will have to copy manually.


=== Files involved ===
=== Files involved ===
Line 90: Line 92:
| index.html || <webroot>
| index.html || <webroot>
|-
|-
| gauges.js || <webroot>/lib || Despite the same name this file is very different from the one in CMX
| CUgauges.js || <webroot>/lib || Despite the same name this file is very different from the one in CMX
|-
|-
| language.js || <webroot>/lib
| CUlanguage.js || <webroot>/lib
|-
|-
| HighchartsDefaults.js || <webroot>/lib
| HighchartsDefaults.js || <webroot>/lib
Line 98: Line 100:
| suncalc.js || <webroot>/lib
| suncalc.js || <webroot>/lib
|-
|-
| tween.min.js || <webroot>/lib
| CUtween.min.js || <webroot>/lib
|-
|-
| steelseries.min.js || <webroot>/lib
| CUsteelseries.min.js || <webroot>/lib
|-
|-
| RGraph.rose.js || <webroot>/lib
| CURGraph.rose.js || <webroot>/lib
|-
|-
| RGraph.common.core.js || <webroot>/lib
| CURGraph.common.core.js || <webroot>/lib
|-
|-
| gauges-ss.css || <webroot>/css
| CUgauges-ss.css || <webroot>/css
|-
|-
! Generated File !! Destination !! Remark
! Generated File !! Destination !! Remark
Line 125: Line 127:
|-
|-
| extrasensorsdata.json || <webroot>
| extrasensorsdata.json || <webroot>
|-
| customlogsRecentdata.json || <webroot>
|-
| customlogsDailydata.json || <webroot>
|-
|-
| CUserdataRECENT.json || <webroot>
| CUserdataRECENT.json || <webroot>
Line 141: Line 147:
|-
|-
| extrasensorsrealtime.txt || <webroot> || When Extra Sensor devices are configured [2]
| extrasensorsrealtime.txt || <webroot> || When Extra Sensor devices are configured [2]
|-
| customlogsrealtime.txt || <webroot> || When Extra Sensor devices are configured [2]
|-
| meteocamrealtime.txt || <webroot> || When Extra Sensor devices are configured [2]
|}
|}
[1] : These files may be served by CMX in another directory (just like the CMX JSON data files). In that case the relative location is specified in the  inifile parameter ''CumulusRealTimeLocation''.<br/>
[1] : These files may be served by CMX in another directory (just like the CMX JSON data files). In that case the relative location is specified in the  inifile parameter ''CumulusRealTimeLocation''.<br/>
Line 147: Line 157:
== Running CumulusUtils ==
== Running CumulusUtils ==


CumulusUtils is a [https://www.mono-project.com/ ''mono''] executable. Mono is an open source implementation of Microsoft's .NET Framework based on the ECMA standards for C# and the Common Language Runtime.  
CumulusUtils is - up to v6.x.y - a [https://www.mono-project.com/ ''mono''] executable.  
From v7.0.0 and up it runs under [https://dotnet.microsoft.com/en-us/ ''dotnet (.NET 8)''].
 
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.
 
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'').
''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).
Running ''CumulusUtils'' is done from the commandline in a command window (under any OS).
Line 153: Line 168:
''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):
''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):


                 ''utils/bin/cumulusutils.exe [command]''
                 ''utils/bin/cumulusutils.exe [command]'' (the ''mono'' syntax - this assumes mono is already active)
 
                ''dotnet utils/bin/cumulusutils.dll [command]''  (the ''.NET'' syntax - ''dotnet'' is obligatory on the commandline. Note the '''dll''')
 
Below is described for ''mono'', when using .NET, please change the command as above. 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:
If no commands are given the application responds with:
Line 163: Line 182:
                       [ [[pwsFWI]] ][ [[Records - Top10|Top10]] ][ [[Graphs]] ][ [[Yadr]] ][ [[Records]] ]
                       [ [[pwsFWI]] ][ [[Records - Top10|Top10]] ][ [[Graphs]] ][ [[Yadr]] ][ [[Records]] ]
                       [ [[NOAA]] ][ [[Records - DayRecords|DayRecords]] ][ [[AirLink]] ][ [[UserAskedData]] ]
                       [ [[NOAA]] ][ [[Records - DayRecords|DayRecords]] ][ [[AirLink]] ][ [[UserAskedData]] ]
                       [ [[ChartsCompiler|CompileOnly]] ] [ [[Extra Sensors|ExtraSensors]] ]
                       [ [[ChartsCompiler|CompileOnly]] ] [ [[Extra Sensors|ExtraSensors]] ] [ [[Custom Logs|CustomLogs]] ]
                       | [ [[Thrifty - Cutils Command Qualifier|Thrifty]] ]  
                       | [ [[Thrifty - Cutils Command Qualifier|Thrifty]] ]  


Line 216: Line 235:
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'''!  
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 =====
  05 1 * * *  cd /home/CumulusMX; /usr/share/dotnet/dotnet utils/bin/cumulusutils.dll thrifty website
  1-51/10 * * * *  cd /home/CumulusMX; /usr/share/dotnet/dotnet utils/bin/cumulusutils.dll sysinfo UserAskedData UserReports
===== For mono =====
   15 1 * * *  cd /home/CumulusMX; utils/bin/cumulusutils.exe thrifty website
   15 1 * * *  cd /home/CumulusMX; utils/bin/cumulusutils.exe thrifty website
   9-59/10 * * * *  cd /home/CumulusMX; utils/bin/cumulusutils.exe sysinfo UserAskedData UserReport
   1-51/10 * * * *  cd /home/CumulusMX; utils/bin/cumulusutils.exe sysinfo UserAskedData UserReport


==== Windows: Using the scheduler ====
==== Windows: Using the scheduler ====
< To be filled in >
===== How to create a scheduled task =====
Prior to doing this we need to also create the script that the task will use.
Open notepad or your favourite text editor (preferred use: Notepad++).
 
You can copy paste the below and save as cumulusutils.bat
(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 ======
</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 C:\CumulusMX\utils\bin\cumulusutils.exe Website</br>
:end</br>
  exit</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.
 
===== Task creation process =====
Within the Task Scheduler Library
#Create “New Task…” (actions pane), or right click middle pane and choose “Create New Task” (not Create Basic Task).
##On the General tab of the new task (General information about the task).
##Set desired name for the Task (Example name CumulusUtils, can also set description if desired).
##Click “Change User or Group…”.
##Type in here the word system (click on “Check Names” if desired, to confirm it is correct and it should then display as SYSTEM in capitals).
##Click OK to use this user account.
##Note in Security options part of the new task creation process it should now state under. When running the task, use the following user account: NT AUTHORITY\SYSTEM <br/>(Convenient reason for this is that when the task runs, it runs is running as system account and so is not seen popping up on screen when it is running.)
##“Configure for:” not required to be changed, can be changed to version of operating system.
#On the Triggers tab of the new task (Setting when and how often the task runs).
##Click on “New”, to create a new launch time and frequency of the task.
##Begin the task: option should default to “On a schedule”, this is the desired option.
##Under the settings section choose “Daily” option.
##Start: date can be left as is, set the desired start time of the task. Set to “12:00:15 am”.</br>(Reason for this setting with 15 second delay is trying not to compete with CumulusMX upload tasks).
##In the advanced part, enable Repeat task every: and choose desired interval.</br>With the option for a duration of: default setting of “1 day” is used.
##Set Stop task if it runs longer than: to “30 minutes” (if the task runs longer than the time set, it is stopped. This applies to the individually triggered task, and not the overall routine of this scheduled task, with it’s repeating trigger times).
##Confirm that the Enabled options is ticked to make active this trigger routine.
#On the Actions tab (Setting what the task is to do).
##Click on “New…” to create a new action.
##Action: should default to “Start a program” this is correct.
##In the Program/Script: part, type the path to the program to run, or click “Browse” to navigate and select the program to run. (example C:\CumulusMX\batch_files\cumulusutils.bat).
#On the Conditions tab (setting other conditions).
##Under Power, untick Start the task only if the computer us on AC power</br>(This then enables the task to start and run even if on battery. It will automatically untick Stop if the computers switches to batter power.)
#On the Settings tab (additional other settings for the task).
##Confirm ticked for Allow task to be run on demand.
##By default Stop the task if it runs longer than: is already ticket and set as 3 days.Change to 1 hour (the behaviour here is the same as instruction 3.f.)
##Confirm ticked for If the running ask does not end when requested, for it to stop.
##Default setting of “Do not start a new instance” Is OK.
#Click on OK down the bottom to complete and commit the creation of this new task.
 
===== 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.


== Additional remarks ==
== Additional remarks ==