weewxaverage extension

73 views
Skip to first unread message

Phil Owers

unread,
Jul 19, 2019, 3:30:30 PM7/19/19
to weewx-user
Hi All

I had trouble with the average extension back end of last year and thanks to Gary he put me right. I'm changing over to a new server and I'm having trouble again


The new looks to be set up the same but the graph is empty.  Ive look through VIEW SOURCE on edge or View Page Source on Firefox and admittedly my understanding of it is limited but it looks similar as the files look the same.  

The problem is the same what ever browser I use and I have deleted the browsing history as Ive had problems with that especially if I change an icon on the forecast.

Any help would be appreciated Thanks Phil
Message has been deleted

Phil Owers

unread,
Jul 20, 2019, 10:14:47 AM7/20/19
to weewx-user
Thanks for your time Jerry.
I can see that its failed to open http://www.sheringhamukweather.org.uk/json/averages.json but looking on the server it has a subdirectory called json

drwxr-xr-x 1 ftp ftp              0 Jul 20 14:44 json 

and it has a file called averages.json will the following in it

[{
"_version": "averages.json.tmpl version 0.5.0",
"temperatureplot": {"series":
{"outTempMeanMinMax": {"name": "Temperature", "data": [[3.0, 7.2], [3.3, 7.8], [4.2, 10.1], [6.2, 13.0], [9.0, 16.0], [11.9, 19.1], [14.1, 21.5], [14.1, 21.2], [12.1, 18.6], [10.1, 15.2], [6.5, 10.8], [4.5, 8.6]]},
"outTempMean": {"name": "Mean Temperature", "data": [5.1, 5.6, 7.1, 9.6, 12.5, 15.5, 17.8, 17.6, 15.4, 12.7, 8.7, 6.6]},
"outTempMax": {"name": "Maximum Temperature", "data": [15.2, 18.3, 21.8, 28.3, 28.8, 32.3, 34.1, 30.9, 30.3, 28.2, 17.6, 15.6]},
"outTempMin": {"name": "Minimum Temperature", "data": [-7.9, -5.4, -6.1, -0.3, -1.5, 5.1, 9.2, 8.1, 5.3, 2.8, -0.1, -5.9]}},
"yAxisLabel": {"text":  "(\u00B0 C)"
},
"yAxisUnits": {"text":  "\u00B0 C"
}},
"rainplot": {"series":
{"rainAvg": {"name": "Rain", "data": [53.5, 44.7, 43.4, 33.7, 46.0, 47.5, 44.4, 52.2, 42.9, 62.1, 64.0, 56.5]}},
"yAxisLabel": {"text":  "(mm)"
},
"yAxisUnits": {"text":  "mm"
}},
"generated": "20 July 2019 14:50"
}]

but for some reason it cant see it.   Any more help would be appreciated.
Phil

gjr80

unread,
Jul 20, 2019, 10:36:29 AM7/20/19
to weewx-user
Phil,

The problem is the JavaScript that loads and displays the plot is looking in the wrong directory for the .json file containing the plot data; it is currently looking in the scripts directory but it should be looking in the json directory. To fix it, on your WeeWX machine edit skins/HighcartsAverages/scripts/averages.js (will be in the /etc/weewx or /home/weewx directory depending on your install type). Around line 44 you have:

json_source: 'scripts/averages.json', // path to the JSON file holding the source data

change it to:

json_source: 'json/averages.json', // path to the JSON file holding the source data

Save the file and restart WeeWX. The plot should work after the next report cycle completes.

Gary

Phil Owers

unread,
Jul 20, 2019, 10:46:10 AM7/20/19
to weewx-user
Sorry Gary, either you were to quick or I was to slow.
After I posted I realised I hadn't changed it back to json/averages.json. where it is now.  I was playing to see if I could change anything but it didn't.
Afraid to say it still fails
Phil

On Friday, July 19, 2019 at 8:30:30 PM UTC+1, Phil Owers wrote:

gjr80

unread,
Jul 20, 2019, 11:09:28 AM7/20/19
to weewx-user
Yes, can that part ids fixed now but there will be another error somewhere, you need to open the page in your browser and then use your browsers developer tools to look at the console log, in particular the java console log and see what rrrors come up when you refresh the page. That is where you will get s clue as to the error.

Unfortunately I am away from home with only an iPad and I can’t view the console log on my browser.

Gary
Message has been deleted

Andrew Milner

unread,
Jul 20, 2019, 11:15:27 AM7/20/19
to weewx-user
did you stop and restart weewx after changing it back again?

gjr80

unread,
Jul 20, 2019, 11:17:03 AM7/20/19
to weewx-user
Yes he did, the JavaScript file is correct now. There is another error now.

Gary

Phil Owers

unread,
Jul 20, 2019, 11:27:54 AM7/20/19
to weewx...@googlegroups.com
From memory it says cant open file www.sheringhamukweather.org.uk/json/averages.json with  a 404 error number.  Or should l be looking for something else. Phil

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/cf460458-e617-47df-a2e0-24d663025332%40googlegroups.com.

gjr80

unread,
Jul 20, 2019, 11:41:38 AM7/20/19
to weewx-user
Hang on, I thought json/averages.json exists, but if it does it is not where it should be. On your web server the directory that contains averages.html should also contain a directory json and that directory should contain averages.json. Your second post says you have a directory json containing a file averages.json, where is that directory relative to the directory containing averages.html?

Gary

Phil Owers

unread,
Jul 20, 2019, 1:01:43 PM7/20/19
to weewx-user
Hi Gary
The averages.html is in the same directory as index.html (the main directory)   The scripts / json sub-directory hang of that.
This is the same as my old server which works OK.

From the Browser  Control / hsr tag I get
XHRGEThttp://www.sheringhamukweather.org.uk/json/averages.json  [HTTP/1.1 404 Not Found 32ms]
 
Phil

On Friday, July 19, 2019 at 8:30:30 PM UTC+1, Phil Owers wrote:

Phil Owers

unread,
Jul 20, 2019, 1:05:03 PM7/20/19
to weewx-user
I should also add that when I go into my new web server and find averages.json the properties are

Is that a clue

Phil

On Friday, July 19, 2019 at 8:30:30 PM UTC+1, Phil Owers wrote:

gjr80

unread,
Jul 20, 2019, 4:09:17 PM7/20/19
to weewx-user
Phil,

So from your last two posts are these statements true:
- averages.html resides in /sheringhamukweather.org.uk/wwwroot
- the directory json resides in /sheringhamukweather.org.uk/wwwroot
- averages.json resides in /sheringhamukweather.org.uk/wwwroot/json

If each of the above is true then when I view http://sheringhamukweather.org.uk/json/averages.json in my browser I should see a json format file but I still get 404 so it must be a permissions problem. Check the ownership and permissions for /sheringhamukweather.org.uk/wwwroot/json and /sheringhamukweather.org.uk/wwwroot/json/averages.json, they should be the same as for /sheringhamukweather.org.uk/wwwroot/averages.html.

Gary

Phil Owers

unread,
Jul 21, 2019, 5:06:01 AM7/21/19
to weewx-user
Hi Gary
Yep confirmed the files were where they should be so as you mentioned it got me thinking about permissions and it maybe useful for others.
To cut a long story short my web server only hosts windows type web sites which need a web.config file to give it clues as to what to do with certain things.
So I added an empty web.config and added the following (which I admit I got from searching good old google.

<configuration>
<system.webServer>
<staticContent>
<remove fileExtension=".json"/>
<mimeMap fileExtension=".json" mimeType="application/json"/>
</staticContent>
</system.webServer>
</configuration>

It now works OK so thanks to you and eveybody else.
Phil

<?xml version="1.0" encoding="utf-8"?>


On Friday, July 19, 2019 at 8:30:30 PM UTC+1, Phil Owers wrote:
Reply all
Reply to author
Forward
0 new messages