Author Topic: SteelSeries gauges scroller content  (Read 1589 times)

0 Members and 1 Guest are viewing this topic.

Offline lobsterman

  • Senior Member
  • **
  • Posts: 81
    • Cape Small Harbor Weather
SteelSeries gauges scroller content
« on: September 03, 2016, 10:34:31 PM »
I note that the MB-Plugins for populating the gauges offers a "forecast" field which is displayed in the scroller/tickertape gauges display.. Can someone point me to how to populate that with the NWS forecast for my zone?

Examples are http://saratoga-weather.org/gauges.php andhttp://www.frontrangeweather.net/wxssgauges.php

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6649
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: SteelSeries gauges scroller content
« Reply #1 on: September 04, 2016, 12:36:45 AM »
It's a bit of apples v.s. oranges.  Both the examples are using text data produced by Weather-Display, which includes that text when it creates the JSON file for the gauges to use.

You are using Meteobridge, and the data comes from MB doing a HTTP GET to conds.php on your site (with a bunch of weather variables in the arguments).  The conds.php script creates two files:  MBrealtime.txt and MBrealtimegauges.txt, the latter is used as the JSON input file for the gauges script.

The current conds.php (Version 1.05 - 04-Jun-2013) added the support for the MBrealtimegauges.txt generation.  In that file, there is
Code: [Select]
$JSONdata["forecast"] = 'Conditions updated: '.$Data[1]; // WD Sample= 'increasing clouds and warmer. precipitation possible within 12 to 24 hrs. windy.'
to create a "forecast"="....", entry in the JSON output for MBrealtimegauges.txt since Meteobridge doesn't have that data to provide.

If you really want the next period forecast to appear in that area, it's going to be a small coding challenge for you.  I'd suggest the following approach:
1) add to your index.php page (near the end) a few lines of code to print $forecasttext[0] to a file (could be named 'curforecast.txt')
2) change conds.php line above to test for presence of 'curforecast.txt', and if it exists, read the file and use it for the contents of $JSONdata["forecast"] in place of what is there.

Happy coding :)
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline lobsterman

  • Senior Member
  • **
  • Posts: 81
    • Cape Small Harbor Weather
Re: SteelSeries gauges scroller content
« Reply #2 on: September 05, 2016, 04:00:26 PM »
It's a bit of apples v.s. oranges.  Both the examples are using text data produced by Weather-Display, which includes that text when it creates the JSON file for the gauges to use.

You are using Meteobridge, and the data comes from MB doing a HTTP GET to conds.php on your site (with a bunch of weather variables in the arguments).  The conds.php script creates two files:  MBrealtime.txt and MBrealtimegauges.txt, the latter is used as the JSON input file for the gauges script.

The current conds.php (Version 1.05 - 04-Jun-2013) added the support for the MBrealtimegauges.txt generation.  In that file, there is
Code: [Select]
$JSONdata["forecast"] = 'Conditions updated: '.$Data[1]; // WD Sample= 'increasing clouds and warmer. precipitation possible within 12 to 24 hrs. windy.'
to create a "forecast"="....", entry in the JSON output for MBrealtimegauges.txt since Meteobridge doesn't have that data to provide.

If you really want the next period forecast to appear in that area, it's going to be a small coding challenge for you.  I'd suggest the following approach:
1) add to your index.php page (near the end) a few lines of code to print $forecasttext[0] to a file (could be named 'curforecast.txt')
2) change conds.php line above to test for presence of 'curforecast.txt', and if it exists, read the file and use it for the contents of $JSONdata["forecast"] in place of what is there.

Happy coding :)

Hinn, OK. Built the curforecast.txt and the index page writes the $forecasttext[0] contents to it fine.

Added that loop to conds.php

Code: [Select]
$filename = 'curforecast.txt';

if (file_exists($filename)) {
    $wxcurrentforecast = file_get_contents($filename);
}

New $JSONdata line in conds:
Code: [Select]
$JSONdata["forecast"] = 'NWS Current Forecast: '.$wxcurrentforecast;
orig line:
Code: [Select]
$JSONdata["forecast"] = 'Conditions updated: '.$Data[1];
Now what happens is that the meteobridge http upload to conds.php fails.

Also, my MBrealtimegauges.txt file is not being updated at all, which may be a separate issue?

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6649
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: SteelSeries gauges scroller content
« Reply #3 on: September 05, 2016, 05:25:56 PM »
What's the URL to your website (it's not in your profile or sig) :(

I'll take a look...(if I have the URL)
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline lobsterman

  • Senior Member
  • **
  • Posts: 81
    • Cape Small Harbor Weather
Re: SteelSeries gauges scroller content
« Reply #4 on: September 05, 2016, 05:57:12 PM »
What's the URL to your website (it's not in your profile or sig) :(

I'll take a look...(if I have the URL)

Not in my profile or sig since I figure it's still a work in progress! :???:

http://suiattle.net/CapeSmallHarborWeather/mbridge/wxindex.php

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6649
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: SteelSeries gauges scroller content
« Reply #5 on: September 05, 2016, 06:47:47 PM »
Give the attached a try (as conds.php) - I added some checking to the processing to make it safe to use with/without having a curforecast.txt.  It just defaults to the original text if the curforecast.txt isn't available.

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 6649
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: SteelSeries gauges scroller content
« Reply #6 on: September 05, 2016, 07:03:12 PM »
Just tried it on my test site (with a
Code: [Select]
        <?php if(isset($forecasttext[0]) and isset($forecasttitles[0])) {
file_put_contents('curforecast.txt',$forecasttitles[0].' - ' $forecasttext[0]);
}
?>

</div><!-- end main-copy -->
to index.php to create the curforecast.txt file. and the conds.php I'd attached above (named conds.php).

My test site shows the result http://saratogawx.net/wxssgauges.php

This same mod should work for Canada and World sites too (with the same index.php mod) as the ajax-dashboard has code to port forecasts from EC and WU into the same variable :)

Edited to have it display the forecast period before the forecast text.
« Last Edit: September 05, 2016, 07:23:56 PM by saratogaWX »
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline lobsterman

  • Senior Member
  • **
  • Posts: 81
    • Cape Small Harbor Weather
Re: SteelSeries gauges scroller content
« Reply #7 on: September 05, 2016, 09:02:46 PM »
Just tried it on my test site (with a
Code: [Select]
        <?php if(isset($forecasttext[0]) and isset($forecasttitles[0])) {
file_put_contents('curforecast.txt',$forecasttitles[0].' - ' $forecasttext[0]);
}
?>

</div><!-- end main-copy -->
to index.php to create the curforecast.txt file. and the conds.php I'd attached above (named conds.php).

My test site shows the result http://saratogawx.net/wxssgauges.php

This same mod should work for Canada and World sites too (with the same index.php mod) as the ajax-dashboard has code to port forecasts from EC and WU into the same variable :)

Edited to have it display the forecast period before the forecast text.

Bingo, many thanks for your elegant code, and it now works nicely! Much appreciated.

Offline ea1hmy

  • Senior Member
  • **
  • Posts: 97
    • meteotorrelavega
Re: SteelSeries gauges scroller content
« Reply #8 on: November 18, 2016, 09:54:54 AM »
Hello could be applied with the program weather dispaly +Oregon WMR200
thank you very much
emilio

Offline Mehdi

  • Member
  • *
  • Posts: 20
Re: SteelSeries gauges scroller content
« Reply #9 on: January 11, 2017, 06:36:18 PM »
Ken,

I had this same issue and would like to let you know that I've been able to use the conds.php v1.06 and the modifications to the index.php file to display the forecast in the LCD panel of steel gauges.

This is still a work in progress, but can be seen here:  http://armon.com/canon-wx/gauges.php

Thanks very much!
« Last Edit: January 11, 2017, 07:19:48 PM by Mehdi »