Welcome to the Cumulus Support forum.

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

Cumulus MX V4 beta test release 4.0.0 (build 4017) - 17 March 2024

Legacy Cumulus 1 release v1.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

PHP Dayfile issue

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

Moderator: daj

Post Reply
Mapantz
Posts: 1774
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 11 x64
Location: Dorset - UK
Contact:

PHP Dayfile issue

Post by Mapantz »

Hi folks - Hope Christmas was good? :)

Before I was sending my data to SQL, I used to upload the dayfile.txt, and most of the scripts I used would read that file. One of those scripts, was the dayfile.php - I had to stop using it, due to not being able to find an SQL version. laulau has kindly supplied me with an SQL version, which was working very well up until yesterday morning.

http://www.warehamwx.co.uk/cumulus/sdayfile.php

It suddenly stopped showing the results, despite the SQL data being fetched, which you can see here: http://www.warehamwx.co.uk/cumulus/util ... 12&yy=2016

On a couple of occasions, I have refreshed the page, and it has suddenly appeared, then I've refreshed again, and then it all disappeared again. I wondered if something had changed server-side, so i opened up a ticket with my hosting, but they've said that nothing has changed. It has left me completely stumped!

The only thing I can think of, could it be to do with this line?

Code: Select all

    data = json_decode(file_get_contents('http://www.warehamwx.co.uk/cumulus/utils/historicDfile.php?mm='.$month.'&yy='.$year), true);
But then again, why would it be working fine, then suddenly stop? :(

I'm all out of ideas!
Kind regards.
Image
User avatar
kocher
Posts: 233
Joined: Sat 19 Apr 2014 7:57 pm
Weather Station: Davis Vantage Pro2+
Operating System: Windows 10
Location: San Sebastian - Spain
Contact:

Re: PHP Dayfile issue

Post by kocher »

It's curious

Data appears (sometimes) by deleting the browser cache (I use Chrome)

On the other hand, I'm very interested in the SQL version of the script, would it be possible to get it? :)
Image
Mapantz
Posts: 1774
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 11 x64
Location: Dorset - UK
Contact:

Re: PHP Dayfile issue

Post by Mapantz »

Well, I decided to do some digging, and its quite possible that it is a caching issue, although I haven't done anything to my browser, or changed the code from the day it was working.
However, I inserted

Code: Select all

<meta http-equiv="pragma" content="no-cache" />
And did a hard-refresh, and the data is back, and works for the other months too (barring Jan & Feb - didn't have this station until March) :)

Can anybody else verify that it is showing data now?

Kind regards.
Image
User avatar
PaulMy
Posts: 3775
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: PHP Dayfile issue

Post by PaulMy »

Yes it is showing data.
What is Extr.?

Enjoy,
Paul
Davis Vantage Pro2+
C1 www.komokaweather.com/komokaweather-ca
MX www.komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX www.komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX www. komokaweather.com/cumulusmx4/index.htm

Image
User avatar
laulau
Posts: 678
Joined: Tue 13 Oct 2009 10:52 pm
Weather Station: WeatherDuino Pro2
Operating System: Win 7
Location: Meyenheim, Alsace, FR
Contact:

Re: PHP Dayfile issue

Post by laulau »

EXTR. is Min or Max or Mean or Total depending of the column.
Perhaps it's better to left that box empty :oops:
Laurent

Image
User avatar
PaulMy
Posts: 3775
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: PHP Dayfile issue

Post by PaulMy »

Thanks Laurent, but still haven't figured it out in each of the columns :o Maybe secret code ;)

Is that script available and if so where could i get it?

Regards,
Paul
Davis Vantage Pro2+
C1 www.komokaweather.com/komokaweather-ca
MX www.komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX www.komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX www. komokaweather.com/cumulusmx4/index.htm

Image
User avatar
laulau
Posts: 678
Joined: Tue 13 Oct 2009 10:52 pm
Weather Station: WeatherDuino Pro2
Operating System: Win 7
Location: Meyenheim, Alsace, FR
Contact:

Re: PHP Dayfile issue

Post by laulau »

Mapantz wrote: Before I was sending my data to SQL, I used to upload the dayfile.txt,....
Hi,
How do you populate SQL database without uploading dayfile ?

Thanks
Is that script available and if so where could i get it?
http://meteo.laurentmey.fr/php/sdayfile.php?view=sce
SQL extraction
http://www.laurentmey.fr/meteo/histogra ... p?view=sce
Laurent

Image
Mapantz
Posts: 1774
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 11 x64
Location: Dorset - UK
Contact:

Re: PHP Dayfile issue

Post by Mapantz »

laulau wrote: Hi,
How do you populate SQL database without uploading dayfile ?

Thanks
Hi Laurent

I plumbed in my details in to MySQL settings in Cumulus MX, and then used the Create Dayfile to create the table, and checked Dayfile.txt upload option - It will add a new line in to the table just after midnight. :)
Image
User avatar
PaulMy
Posts: 3775
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: PHP Dayfile issue

Post by PaulMy »

Thanks Laurent,
I've got it showing http://www.komokaweather.com/mysql/sdayfile.php but not as nice yet as yours and Mapantz :oops:

Paul
Davis Vantage Pro2+
C1 www.komokaweather.com/komokaweather-ca
MX www.komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX www.komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX www. komokaweather.com/cumulusmx4/index.htm

Image
weatherist34
Posts: 51
Joined: Wed 13 Apr 2016 11:09 am
Weather Station: Davis Vantage Pro2 Plus
Operating System: OSX High Sierra
Contact:

Re: PHP Dayfile issue

Post by weatherist34 »

PaulMy wrote:Thanks Laurent,
I've got it showing http://www.komokaweather.com/mysql/sdayfile.php but not as nice yet as yours and Mapantz :oops:

Paul
just what i have been waiting for , is this a common structure is everyone using the same schema http://www.komokaweather.com/mysql/sdayfile.php ?? please say yes

if so happy days
User avatar
PaulMy
Posts: 3775
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: PHP Dayfile issue

Post by PaulMy »

Hi Brian,
dayfile.txt is one of the basic Cumulus data files showing the daily data up till midnight yesterday. I have the file FTPd to my webserver as well as having it uploaded to my MySQL database dayfile table on a daily basis after midnight as I believe several other users have as well.

Paul
Davis Vantage Pro2+
C1 www.komokaweather.com/komokaweather-ca
MX www.komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX www.komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX www. komokaweather.com/cumulusmx4/index.htm

Image
weatherist34
Posts: 51
Joined: Wed 13 Apr 2016 11:09 am
Weather Station: Davis Vantage Pro2 Plus
Operating System: OSX High Sierra
Contact:

Re: PHP Dayfile issue

Post by weatherist34 »

PaulMy wrote:Hi Brian,
dayfile.txt is one of the basic Cumulus data files showing the daily data up till midnight yesterday. I have the file FTPd to my webserver as well as having it uploaded to my MySQL database dayfile table on a daily basis after midnight as I believe several other users have as well.

Paul
SQL dump is what i need but it just as easy to work with a csv export i just received an SQL dump from Tina if they all are structured like that and voila its good to go , i just imported her sql and set the row numbers and 2 minutes job done but essentially it all needs to be structured in the same way otherwise it would be hard to support and release a general download it would require knowledge of editing charts which would defeat the object of the easy set up screen but anyhow see screenshot of tina's sql dump .

if all goes well i can release it as a standalone to allow others to throw ideas at it.
You do not have the required permissions to view the files attached to this post.
weatherist34
Posts: 51
Joined: Wed 13 Apr 2016 11:09 am
Weather Station: Davis Vantage Pro2 Plus
Operating System: OSX High Sierra
Contact:

Re: PHP Dayfile issue

Post by weatherist34 »

what i forgot to say is , the charts you are using already can be easily fed in to the template HOMEWEATHERSTATION thingy all you would need to do is point to the url of the pages the charts you are using already, so theoretically your already good to go albeit just a few adjustments or a bit customisation
Mapantz
Posts: 1774
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 11 x64
Location: Dorset - UK
Contact:

Re: PHP Dayfile issue

Post by Mapantz »

I'm having the same problem today, the data doesn't show again. Sometimes it does, sometimes it doesn't..
I have put some error checking in there, and i've gotten some messages back

When it works, I get this:

Code: Select all

    [type] => 8
    [message] => Undefined variable: LF
    [line] => 220
When it doesn't work, I get these two:

Code: Select all

  
       [type] => 2
    [message] => file_get_contents(http://www.warehamwx.co.uk/cumulus/utils/historicDfile.php?mm=9&yy=2016): failed to open stream: HTTP       request failed! 

Code: Select all

       [type] => 8
    [message] => file_get_contents(): send of 2 bytes failed with errno=104 Connection reset by peer
So it seems I am getting inconsistent calls from this:

Code: Select all

   $data = json_decode(file_get_contents('http://www.warehamwx.co.uk/cumulus/utils/historicDfile.php?mm='.$month.'&yy='.$year), true);
Image
User avatar
dazza1223
Posts: 860
Joined: Sun 25 Jan 2015 8:41 pm
Weather Station: Davis Vantage Pro 2 plus
Operating System: Raspberry pi 4 (4gb)
Location: Worthing
Contact:

Re: PHP Dayfile issue

Post by dazza1223 »

i ant haveing much luck with this all im getting is errors in the php log


[Mon Jan 14 22:43:58.720028 2019] [:error] [pid 1508] PHP Notice: Undefined index: jour in /home/pi/usb/website/sdayfile.php on line 160, referer: http://www.davisworthing.co.uk/sdayfile.php?y=2019&m=4
[Mon Jan 14 22:43:58.720191 2019] [:error] [pid 1508] PHP Notice: Undefined variable: found in /home/pi/usb/website/sdayfile.php on line 205, referer: http://www.davisworthing.co.uk/sdayfile.php?y=2019&m=4
[Mon Jan 14 22:43:58.720345 2019] [:error] [pid 1508] PHP Notice: Undefined variable: found in /home/pi/usb/website/sdayfile.php on line 243, referer: http://www.davisworthing.co.uk/sdayfile.php?y=2019&m=4
Have fun and keep learning

dazza :D

https://www.davisworthing.co.uk

Image
Post Reply