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 4019) - 03 April 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

Undefined units in trends.htm

Topics about the Beta trials up to Build 3043, the last build by Cumulus's founder Steve Loft. It was by this time way out of Beta but Steve wanted to keep it that way until he made a decision on his and Cumulus's future.

Moderator: mcrossley

Locked
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:

Undefined units in trends.htm

Post by laulau »

I have (undefined) as units in trends.htm, it's ok in charts.html.
Is something missing somewhere ?
CaptCMX.JPG
You do not have the required permissions to view the files attached to this post.
Laurent

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

Re: Undefined units in trends.htm

Post by steve »

The javascript reads the units from the units.json file that MX uploads. The contents of that file downloaded from your site look OK, but your web server is returning it with Content-Type application/octet-stream, unlike my web server, which returns it as application/json. Perhaps this stops the javascript being able to interpret it correctly.
Steve
User avatar
jpsc
Posts: 179
Joined: Tue 23 Aug 2011 6:06 pm
Weather Station: Davis Vantage Vue, belfryboy USB
Operating System: Raspbian Bullseye
Location: Wye valley, Herefordshire, UK
Contact:

Re: Undefined units in trends.htm

Post by jpsc »

I see the same 3009 and 3010, Windows 7 serving to Chrome
John Cooper

Cumulus 3 on RPi3 with SSD

http://weather.mountpleasanthouse.uk

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

Re: Undefined units in trends.htm

Post by mcrossley »

I have a nagging memory that this is why I stuck with .txt for the ss gauges, too many web servers don't have the mime types up to date. Though using .txt also has its own problems.
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: Undefined units in trends.htm

Post by laulau »

I think I'll do a test on my main website (paying hosting with OVH.com) rather than Chez.com that is a free hosting (but with less capable services)
Laurent

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: Undefined units in trends.htm

Post by laulau »

http://laurentmey.fr/test/trends.htm
(not updated for the moment)
Laurent

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

Re: Undefined units in trends.htm

Post by steve »

Currently, the code does this:

Code: Select all

$.ajax({url: "units.json", success: function (result) {
            createTemp(result.temp);
And the problem is that 'result' is not being given to the script as an object but a string.

If I change it to use JSON.parse() instead, would that get around the problem? But would it break the case where it's working already?
Steve
User avatar
mcrossley
Posts: 12763
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Undefined units in trends.htm

Post by mcrossley »

Steve, you could tell jQuery that it is a json query by adding the parameter

dataType: "json",

Or switch to using the jQuery $.getJSON() function rather than the $.ajax()

http://api.jquery.com/jquery.getjson/
User avatar
steve
Cumulus Author
Posts: 26701
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Undefined units in trends.htm

Post by steve »

Thanks Mark, I'll give that a try.
Steve
User avatar
steve
Cumulus Author
Posts: 26701
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Undefined units in trends.htm

Post by steve »

I tried adding "dataType: "json"," (using the Chrome developer tools) on Laurent's site and it works.
Steve
User avatar
mcrossley
Posts: 12763
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Undefined units in trends.htm

Post by mcrossley »

Good, I prefer to add the parameter rather than use $.getJSON() - which is just a wrapper to $.ajax anyway.

iirc, adding that parameter also auto-enables appending a browser cache buster string to the query?
User avatar
steve
Cumulus Author
Posts: 26701
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Undefined units in trends.htm

Post by steve »

It looks like it might have changed the cache headers to no-cache?
Steve
User avatar
steve
Cumulus Author
Posts: 26701
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Undefined units in trends.htm

Post by steve »

I've done this change to the cumuluscharts.js file in build 3011 - you'll need to upload it to the web site, of course.
Steve
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: Undefined units in trends.htm

Post by laulau »

Fixed with Build 3011
Laurent

Image
Locked