Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080

Realtime.log for Highcharts

Discussion and questions about Cumulus weather station software version 1. This section is the main place to get help with Cumulus 1 software developed by Steve Loft that ceased development in November 2014.
Post Reply
Stuart2007
Posts: 51
Joined: Sat 22 Dec 2012 11:33 am
Weather Station: Chas Ohlson
Operating System: Windows 7
Location: United Kingdom

Realtime.log for Highcharts

Post by Stuart2007 »

Thanks to Mark and others for the realtime charts using Highcharts.

I am uploading on a data-limited 3g link. The 248 byte realtime.txt is no problem every minute, while a 30kb 120 minute log file is, so I'm uploading that every 15 mins at present. But user has a variable length datagap (upto 15 mins depending on the time they load the webpage).

http://www.oldlandwindmill.co.uk/newsit ... umulus.htm

Why not build the log file at the server to avoid resending the data 120 times?

I am trawling around trying to get my head around php etc, but in principle is there any reason one could not run a php script after each upload of txt, reading the last (say) 119 records in it, writing then to a tmp file, adding on the new record at the end of the log file, then closing/deleting the log file and renaming the temp file to .log??

I'm guessing there must be a reason this can't be done, because I'm sure it would be mentioned somewhere in the Forum history, and I can't find it. Or perhaps the answer is so obvious I've overlooked it. Probably the latter.

Stuart
User avatar
steve
Cumulus Author
Posts: 26672
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Realtime.log for Highcharts

Post by steve »

I think one of Kevin's scripts does something like that?

https://cumulus.hosiene.co.uk/viewtopic.php?f=14&t=130
Steve
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Realtime.log for Highcharts

Post by beteljuice »

Edit: Steve posted whilst I was typing - yes that article is a good guide to the basics of what you want ..
... but in principle is there any reason one could not run a php script after each upload of txt
In principle - OK

... but you would have to run a 'cron' job on the server every 15 min (or less) because you have no way of the (new) upload to trigger the log update script. ie. the script runs regardless and checks either the file timestamp or the data entry timestamps in both the realtime.txt and the log file.

A poor work-around would be to call the script from a browser with an auto-refresh (as a cosmetic - the script would o/p to browser success / fail and timestamp). This is a technique I use when grabbing other peoples data for beteljuice prototypes etc.
Image
......................Imagine, what you will KNOW tomorrow !
water01
Posts: 3670
Joined: Sat 13 Aug 2011 9:33 am
Weather Station: Ecowitt HP2551
Operating System: Windows 10/11 64bit Synology NAS
Location: Burnham-on-Sea
Contact:

Re: Realtime.log for Highcharts

Post by water01 »

Or you could use Cumulus Toolbox to run a Remote Command to run the php. I do this to update my historic graphs MySQL databse at 00:15 every night and it works well.
David
Image
Stuart2007
Posts: 51
Joined: Sat 22 Dec 2012 11:33 am
Weather Station: Chas Ohlson
Operating System: Windows 7
Location: United Kingdom

Re: Realtime.log for Highcharts

Post by Stuart2007 »

Thanks all, that will get me going.

Stuart
User avatar
mcrossley
Posts: 14388
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Realtime.log for Highcharts

Post by mcrossley »

Stuart

I have the advantage of running Cumulus on my web server, but I stuff the realtime.txt into a SQL database on the web server by running a PHP script from the command line every minute (my realtime update interval is also 1 minute). The realtime SQL table is indexed on the date/time field so duplicate entries are not recorded.

The script can be run as a command line via cron, or run remotely via a http call.
Post Reply