Steelseries Gauges for WD

A link to the website may help anyone working on this.

Here is a link to the basic htm file giving the parse error: http://priscillanhk.com/0_Weather/STEEL_DREAMS/gauges-ss-basic.htm

I also get a similar error if I try to run the php file:
http://priscillanhk.com/0_Weather/STEEL_DREAMS/gauges-ss-basic-inc.php

I’m not seeing an error just no gauges I think you have a path issue in the setup

You see the error in Chrome Developer Tools:

Uncaught SyntaxError: Illegal return statement

and the line it doesn’t like is the second return line in this section of code in gauges.js:

// if String doesn't offer a .trim() method, add it
String.prototype.trim = String.prototype.trim || function trim() {
    return this.replace(/^\s+|\s+$/g, '');
};

    return this.replace(/^\s+|\s+$/g, '');
};

Unfortunately I don’t do javascript, but it looks like unmatched } so may be an “else” or similar line missing. Suggest looking at the same code in the original gauges.js in the download.

Looking at the original I don’t think those last two lines should be there at all, so I suggest deleting them:

    return this.replace(/^\s+|\s+$/g, '');
};

Yes, spot on Niko, they must be deleted, it is just copied from the previous line and it is an unclosed return statement, which should normally be inside a function, which it is, but it just got copied over and it is missing the initial function declaration, just delete it and use:

// if String doesn't offer a .trim() method, add it
String.prototype.trim = String.prototype.trim || function trim() {
    return this.replace(/^\s+|\s+$/g, '');
};

Okay, thank you folks for offering your suggestions!

I deleted those extra lines at the end of the the file. I really have no idea why there was an extra identical line.
I’m sure I did not add that myself - at least not with any awareness of doing so.
Deleting the lines did not change the result when running the file online, unless maybe the parse error
changed what line number the error occurs on, decreased the line number by 1.

Speaking of line numbers, the parse error says line 650. (I think it was 651 before).
BUTT, there IS NO LINE 650 in the steelseriesVWSjson.php file!!!
It must be talking about a line number from something else. But from what? And where can I go to fix it?

Several thoughts/questions about “steelseriesVWSjson.php”

  1. Isn’t VWS related to some other weather program, rather than being relevant to weather-display?
    There is no other “json” file provided with steelgauges. The youtube video included uploading it.

  2. Near the top of the steelseriesVWSjson.php file is the following line:
    $wflashDir = ‘./wflash/Data/’; // directory for the the wflash.txt and wflash2.txt files
    However, steelgauges does not come with any flash files of any kind that I can see.
    Nothing I have seen / read, mentions what to do for this directory setting when using weather-display
    with steelgauges.

I’ve been looking all over the place and reading, looking for something that might relate to the problem I am having; the wiki, the FAQ for wd/steelseries, and even at another application of the steelseries at: http://leuven-template.eu/dokuwiki28/doku.php?id=en:steelseries
I’m just not finding ANY mention of the file with json in its name nor anything about parse errors.

Priscilla

I believe the file you are looking for is gauges.js this is what I used for Weather Display setup.

Two more things, which I don’t know, might be relevant to the problem:

In the gauges.js file, near the top:
1.
imgPathURL : ‘trends.gif’, //*** Change this to the relative path for your ‘Trend’ graph images
I have not done anything with this line so what you see here (above) is how it is in my gauges.js file.
I looked at my setup online and there IS a trends.gif file in a directory above my /STEEL_DREAMS directory,
however that trends.gif file is not GRAPHS, it is a TABLE generated by weather display.
Q: Should I go into wd and try to change trends.gif into a graph somehow?

oldGauges : ‘gauges.htm’, //*** Change this to the relative path for your ‘old’ gauges page.
I did not have any “Old gauges” in my set-up. I was just using things provided by wd (weather-display) program, ie, graphs and forecast icons and such.
Q: Do I need to put something on this line or just leave it as it is (above in green) ?

  1. Most folks are using the wxgraphs scripts for the hover-over showing, so this would be…
imgPathURL         : './wxgraphs/',
  1. Leave it as is since you don’t have an ‘old’ page. Mine is the same situation - no old page, no change.

http://tiggrweather.net/wxssgauges.php

Note that the graphs are not part of the steel package or WD, they are a set of third party jpgraphs that work with WD, that’s a whole other step after you get the gauges working.

oldGuages was intended for those who previously used the Weather Display Live Flash based gauges.

Thank you Niko, for clearing that up - about the trends.gif graphs

I’ll repeat the main problem I am still having for the sake of anyone following this thread:

  1. The gauges-ss-basic.htm webpage file does show gauges
  2. And they allow me to change units,
  3. [b][color=blue]However there is a JSON parsing error AND THE GAUGES DO NOT SHOW readings
    • ie the gauges are not dynamically active. [/color][/b]
      “parsererror: syntax error unexpected token in JSON in position 651”

Does anyone have an idea what the problem might be?
I know html and worked through exercises from a book on php a year ago but JSON is unfamiliar to me.

Thanks!

if you could post that line of code where the error is occuring?

What version of php are you running?

in gauges.js have you set the weather program to #1 for WD ??

Thank you all for helping!

My replies to the three of you most recently posting:

  1. Yes I n7xrd, I changed gauges.js for the wd setting = 1

  2. Niko, I believe the php version is now 5.5. As I recall they updated it from 5.4 a year ago in the Fall.
    I don’t remember how to check that.

  3. WEATHER DISPLAY:
    I cannot give you the line of code producing the error since the parse error “message” claims it is line 641
    while the only json related file in steel gauges is: steelseriesVWSjson.php
    and that file ends at line 603.
    The error shows up when I run: http://priscillanhk.com/0_Weather/STEEL_DREAMS/gauges-ss-basic.htm

#2 - Should be OK, earlier versions had a problem with json. To see the version run:

<?php
echo 'Current PHP version: ' . phpversion();
?>

#3 - It’s not a line number, it’s a json data element number. I’m not sure how to display it. Check that there is nothing strange in the customclientraw.txt.

It appears the problem is that the forecast in customclientraw.txt is missing and replaced with carriage return linefeed and that is upsetting the parser. Maybe Brian has some insight into how that is happening :dontknow: Maybe the “%vpforecasttext%” tag doesn’t return anything if you don’t have a VP?

Niko here is a site I just setup for a friend that does not have a VP station the forecast is just blank.
http://n7drd.org/wxssgauges.php

Where’s the customclientraw for that site?