Welcome to the Cumulus Support forum.

Latest Cumulus MX release v3.0.0 build 3050 - 1 May 2019.
Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014

See the Wiki for downloading either version.

Another Top10 approach

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

Post Reply
User avatar
HansR
Posts: 91
Joined: Sat 20 Oct 2012 6:53 am
Weather Station: Davis Vantage Pro 2+
Operating System: Raspbian GNU/Linux 9 (stretch)
Location: Wagenborgen (NL)
Contact:

Another Top10 approach

Post by HansR » Sat 10 Aug 2019 1:47 pm

An example for this top10 approach you will find on my site.

Recently I saw some Top10 pages on different sites and I discussed it with a meteo enthusiast close by, who pointed me to the site top10 page and PHP/SQL function serving it, made by Mark Crossley. I appreciate the result but while studying the PHP and SQL code, I could not help noticing that the query's are fetched every time the page is loaded (apart maybe for some caching advantage). Beside that, this type of PHP/SQL combination brings a complexity to displaying of data which I increasingly see on websites, but which I personally do not really like. As Cumulus itself has a very clean text database and as such the handling of the data is not complex and straightforward, I took another approach, described below. PHP/SQL, I think, is a bit of overkill.

I wrote a small program (in C) which reads dayfile.txt once per day just after midnight and for all measurements it creates a sorted top10-list. From that list it creates a HTML-table and writes that to a text-file. That file can be included by the user on a website wherever he wants simply by a PHP-include (which is the easy way to include I think).

You will find attached, the program compiled for the Raspberry 3B+ in a zip-archive, for other environments it needs to be recompiled (which I think can be done without modifications). I submitted the code to github in a private repository. Please note: the initial name top10 has been changed to add2cumulus because there will be more functionality than only the top10. Current functions implemented (linked to example) are:

1) top10
2) systeminfo

Let me know if you are interested, have a problem or question.
-----
How to use (for a daily new version of the table):
  1. Copy the executable to the CumulusMX executable directory, the data-directory is assumed one directory below. If not, it fails;
  2. In "CumulusMX->InternetSettings->External programs->Daily program" fill in: "./add2cumulus";
  3. In Daily Program Parameters use values for the commandline parameters "-NrOfColumns 2 -bgcHdr Red -bgcTbl yellow -txtHdr purple -accTbl " (any value you want);
  4. In "Extra webfiles" create two new entries for "top10TableStyle.txt" and "top10Table.txt"; Set these for FTP, if you want to debug and have quick result: set realtime and run the program by hand, otherwise just FTP is enough.
  5. Make a page for your website to display the table.This is done by including the txt files in respectively the <HEAD> and the <BODY> section. A likely method could be e.g. PHP: "<?php include('top10TableStyle.txt');?>"
For the systeminfo I use the command entry for the webupdateinterval and the commandline parameter "-system yes"

Please check the readme for the commandline parameters and modifications.
You do not have the required permissions to view the files attached to this post.
Last edited by HansR on Sat 17 Aug 2019 8:32 am, edited 1 time in total.
Hans Rottier

Davis Vantage Pro 2+
Raspbian GNU/Linux 9 (stretch) on Raspberry 3B+
Cumulus MX v.3.0.0 build 3050
https://meteo-wagenborgen.nl

Phil23
Posts: 192
Joined: Sat 16 Jul 2016 11:59 pm
Weather Station: Davis Vantage Pro2 Plus
Operating System: Win7 Pro
Location: Australia

Re: Another Top10 approach

Post by Phil23 » Thu 15 Aug 2019 9:58 pm

Can anyone contribute a Win compile for this for us Dummies that don't have that skill on the radar?

A simple example htm would be good too, just to get the understanding on how it embeds.

Looks like an interesting addition to have available on a site.

Cheers.
Image

User avatar
HansR
Posts: 91
Joined: Sat 20 Oct 2012 6:53 am
Weather Station: Davis Vantage Pro 2+
Operating System: Raspbian GNU/Linux 9 (stretch)
Location: Wagenborgen (NL)
Contact:

Re: Another Top10 approach

Post by HansR » Fri 16 Aug 2019 5:42 pm

I can supply my table and style results so you can check the layout (and modify the style file if you wish), you'll find them attached.
For compiling you need just a C-compiler so, not a complete development environment for cumulus is needed.

Best,
You do not have the required permissions to view the files attached to this post.
Hans Rottier

Davis Vantage Pro 2+
Raspbian GNU/Linux 9 (stretch) on Raspberry 3B+
Cumulus MX v.3.0.0 build 3050
https://meteo-wagenborgen.nl

User avatar
HansR
Posts: 91
Joined: Sat 20 Oct 2012 6:53 am
Weather Station: Davis Vantage Pro 2+
Operating System: Raspbian GNU/Linux 9 (stretch)
Location: Wagenborgen (NL)
Contact:

Re: Another Top10 approach

Post by HansR » Sat 17 Aug 2019 8:34 am

Please note the change in name and functionality (see first message of this thread).
Any subsequent change will be reflected in the first message.

Best,
Hans Rottier

Davis Vantage Pro 2+
Raspbian GNU/Linux 9 (stretch) on Raspberry 3B+
Cumulus MX v.3.0.0 build 3050
https://meteo-wagenborgen.nl

Post Reply