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

UV and Ozone

Discussion of Mark Crossley's HTML5/Javascript gauges

Moderator: mcrossley

User avatar
gluepack
Posts: 460
Joined: Tue 22 Jan 2013 9:20 pm
Weather Station: PCE-FWS 20
Operating System: Win 7 Pro
Location: Zlatina, Bulgaria

UV and Ozone

Post by gluepack »

As I don't have a UV sensor, so get no data via Cumulus, I didn't bother with the UV gauge. However, as I get a UV forecast through temis.nl anyway, I decided to use that. What I hadn't realised was that the output from them includes an ozone column value for the same coordinates, so I modified the solar radiation gauge code (as I don't have that either) to display that value too.

http://www.jerbils.info/saratoga/wxgauges.php

uvdu04.jpg
You do not have the required permissions to view the files attached to this post.
Image

PWS links: WundergroundIVARNAPR3CWOP/APRSE(W)2048PWSWeatherZLATINABGAwekas10631Twitter@Zlatina_weather
Station type: PCE-FWS 20…Webcam link: View south to edge of Provadisko plateau
water01
Posts: 3244
Joined: Sat 13 Aug 2011 9:33 am
Weather Station: Ecowitt HP2551
Operating System: Windows 10 64bit
Location: Burnham-on-Sea
Contact:

Re: UV and Ozone

Post by water01 »

Very good, I presume you will not mind if I steal the code? :D
David
Image
User avatar
gluepack
Posts: 460
Joined: Tue 22 Jan 2013 9:20 pm
Weather Station: PCE-FWS 20
Operating System: Win 7 Pro
Location: Zlatina, Bulgaria

Re: UV and Ozone

Post by gluepack »

If you can find it, lol!

Actually, I have a slight problem as I modified the uv forecast php to echo json_encode the two values to make them available to the js code.
Now that I have replaced the code with the test code, those two values get displayed on the home page above the ajax console as it also uses the uv forecast php.
Err... any idea how I stop that?
Image

PWS links: WundergroundIVARNAPR3CWOP/APRSE(W)2048PWSWeatherZLATINABGAwekas10631Twitter@Zlatina_weather
Station type: PCE-FWS 20…Webcam link: View south to edge of Provadisko plateau
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: UV and Ozone

Post by laulau »

Maybe this :

Code: Select all

ob_start();
require_once "curconditions.php" ;
ob_end_clean();
Laurent

Image
water01
Posts: 3244
Joined: Sat 13 Aug 2011 9:33 am
Weather Station: Ecowitt HP2551
Operating System: Windows 10 64bit
Location: Burnham-on-Sea
Contact:

Re: UV and Ozone

Post by water01 »

Call the UV code in the gauges code instead of in the main index page would be the way I would do it and was planning to, and then populate the variable there rather than trying to carry it over from the index page.

Not sure about laulau's solution as I am not familiar with what curconditions.php contains as I assume it is a Saratoga script?
David
Image
User avatar
gluepack
Posts: 460
Joined: Tue 22 Jan 2013 9:20 pm
Weather Station: PCE-FWS 20
Operating System: Win 7 Pro
Location: Zlatina, Bulgaria

Re: UV and Ozone

Post by gluepack »

Struggling to google alternatives but I think that laulau's solution, based on what I have read, will not only get rid of echos but prints as well.

"Call the UV code in the gauges code instead of in the main index page"... not sure what you mean by that. The problem is that it gets called by both ajax-dashboard and wxgauges. I'll look at calling it from the gauges.js instead. However, it is straining my knowledge re client/server.

Easiest thing is to do what I did in testing, have two copies of the uv retrieval code, lol!.
Image

PWS links: WundergroundIVARNAPR3CWOP/APRSE(W)2048PWSWeatherZLATINABGAwekas10631Twitter@Zlatina_weather
Station type: PCE-FWS 20…Webcam link: View south to edge of Provadisko plateau
water01
Posts: 3244
Joined: Sat 13 Aug 2011 9:33 am
Weather Station: Ecowitt HP2551
Operating System: Windows 10 64bit
Location: Burnham-on-Sea
Contact:

Re: UV and Ozone

Post by water01 »

gluepack wrote:
"Call the UV code in the gauges code instead of in the main index page"... not sure what you mean by that.
What I meant was that the results are retrieved from temis.nl by using get-UV-forecast-inc.php which sets up the URL, gets the data and sets up the arrays, so I would include that in my gauges page this setting up the right variables.
David
Image
User avatar
gluepack
Posts: 460
Joined: Tue 22 Jan 2013 9:20 pm
Weather Station: PCE-FWS 20
Operating System: Win 7 Pro
Location: Zlatina, Bulgaria

Re: UV and Ozone

Post by gluepack »

Umm.. that is what I am doing but I have modified it so that it echos back the uv/du values for gauges.js to use. Unfortunately, as the ajax-dashboard calls the same php, the echo'd variables get displayed above the dashboard.
Temporarily, I have reverted back to using two copies of get-UV-forecast-inc.php, one that echos back and one that doesn't, until I can find a better solution.
Image

PWS links: WundergroundIVARNAPR3CWOP/APRSE(W)2048PWSWeatherZLATINABGAwekas10631Twitter@Zlatina_weather
Station type: PCE-FWS 20…Webcam link: View south to edge of Provadisko plateau
water01
Posts: 3244
Joined: Sat 13 Aug 2011 9:33 am
Weather Station: Ecowitt HP2551
Operating System: Windows 10 64bit
Location: Burnham-on-Sea
Contact:

Re: UV and Ozone

Post by water01 »

OK I have got mine going. http://www.dmjsystems.co.uk/weather/gauges-ss.php

No problem with variables used

Code: Select all

$UVfcstUVTODAY = $UVfcstUVI[0];
$UVfcstOZONE = $UVfcstOZN[0];
echo '<script>';
echo 'var UVfcstUVTODAY = ' . json_encode($UVfcstUVTODAY) . ';';
echo 'var UVfcstOZONE = ' . json_encode($UVfcstOZONE) . ';';
echo '</script>';
to pass the new variables from PHP to jscript.
David
Image
User avatar
gluepack
Posts: 460
Joined: Tue 22 Jan 2013 9:20 pm
Weather Station: PCE-FWS 20
Operating System: Win 7 Pro
Location: Zlatina, Bulgaria

Re: UV and Ozone

Post by gluepack »

Lol, there are no problems with my variables but you don't understand. I have an ajax console on my home page that calls the same php and the echos are displayed on it. Meanwhile, until I can figure it out, I'll live with two versions of the php.

By the way, if you are going to display my images, you might want to change your css file to size them correctly. I used different tipimg params to do that ;)
Image

PWS links: WundergroundIVARNAPR3CWOP/APRSE(W)2048PWSWeatherZLATINABGAwekas10631Twitter@Zlatina_weather
Station type: PCE-FWS 20…Webcam link: View south to edge of Provadisko plateau
water01
Posts: 3244
Joined: Sat 13 Aug 2011 9:33 am
Weather Station: Ecowitt HP2551
Operating System: Windows 10 64bit
Location: Burnham-on-Sea
Contact:

Re: UV and Ozone

Post by water01 »

Just fixed that thank you. Took me a while to figure that one out as it was a combination of the css and the js ;)
David
Image
User avatar
gluepack
Posts: 460
Joined: Tue 22 Jan 2013 9:20 pm
Weather Station: PCE-FWS 20
Operating System: Win 7 Pro
Location: Zlatina, Bulgaria

Re: UV and Ozone

Post by gluepack »

I should have scrolled down at sometime I guess. The additional gauges css has screwed up the placement of the trailing information on that page. Now I have to figure out how to resolve that.
Update: well, having failed to find anything about saving css and reverting back to it, I just wrapped the included footer with a second main-copy div with a style size and that seems to have worked. For someone who much prefers definitives, I do seem to end up with a lot of scrappy workarounds. I guess that is the nature of dealing with css, html, javascript and php when you are not an expert in any of them. How I miss the days of fifty years ago when you could turn to the person next to you with a question about coding and get an immediate straight answer.
Image

PWS links: WundergroundIVARNAPR3CWOP/APRSE(W)2048PWSWeatherZLATINABGAwekas10631Twitter@Zlatina_weather
Station type: PCE-FWS 20…Webcam link: View south to edge of Provadisko plateau
User avatar
gluepack
Posts: 460
Joined: Tue 22 Jan 2013 9:20 pm
Weather Station: PCE-FWS 20
Operating System: Win 7 Pro
Location: Zlatina, Bulgaria

Re: UV and Ozone

Post by gluepack »

I noticed that someone else had added labels underneath their gauges. I had wanted to do this myself but was concerned that I would have to modify the js to do it. As it turns out, it was just a matter of adding a new div for each gauge (with a style override for one gauge to line up the label) in the calling saratoga template.

Code: Select all

<div class="gauge">
…			
<div class="gauge-label">Temperature</div>
    </div>
Well, plus an update to the css file and an appropriate base image.

Code: Select all

.gauge-label {
    background-image: url(label.jpg);
    background-repeat: no-repeat;
    font-family: Verdana, Helvetica, sans-serif;
    color: #022B40;
    height: 25px;
    width: 125px;
    font-size: 15px;
    padding-top: 2px;
    margin-top: 6px;
    margin-right: auto;
    margin-left: auto;
    text-align: center;
}
http://jerbils.info/saratoga/wxgauges.php thanks to Sun Prairie Weather.
Image

PWS links: WundergroundIVARNAPR3CWOP/APRSE(W)2048PWSWeatherZLATINABGAwekas10631Twitter@Zlatina_weather
Station type: PCE-FWS 20…Webcam link: View south to edge of Provadisko plateau
User avatar
ace2
Posts: 679
Joined: Tue 14 Jan 2014 12:38 pm
Weather Station: maxkon ws-1081pc
Operating System: windows 7 & 8
Location: Adelaide, south Australia, Australia
Contact:

Re: UV and Ozone

Post by ace2 »

Can this be used with HTM instead of PHP for my area and if so, what would i need to change??
CHRIS
Image
web site
http://www.ace2weather.com
Follow me on Twitter
http://tinyurl.com/kwlr9re
YouTube channel
http://tinyurl.com/lehwpgp
Facebook page
http://tinyurl.com/k3sap4s
Tiny URL links used
water01
Posts: 3244
Joined: Sat 13 Aug 2011 9:33 am
Weather Station: Ecowitt HP2551
Operating System: Windows 10 64bit
Location: Burnham-on-Sea
Contact:

Re: UV and Ozone

Post by water01 »

If you mean the SteelSeries gauges, yes they can no problem. See here https://cumulus.hosiene.co.uk/viewtopic.php?f=21&t=7186

The Ozone and UV gauges are using the data obtained by using the uvforecast.php code obtainable here http://saratoga-weather.org/scripts-UVforecast.php which has instructions on how to incorporate into your page.
David
Image
Post Reply