Author Topic: Use ambientweather.net data for a Saratoga Template website...  (Read 15017 times)

0 Members and 1 Guest are viewing this topic.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9396
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Use ambientweather.net data for a Saratoga Template website...
« on: February 26, 2018, 07:00:19 PM »
If you purchased a weather station from Ambientweather.com AND have it reporting data to ambientweather.net AND would like to have a personal weather website, then there is good news:  the AWN-plugin for Saratoga templates is now available.

Note that if you have a device (e.g. Meteobridge) that is not a branded Ambient 'Weatherbridge' device, this plugin will not work for you without you paying a license fee to AmbientWeather.com to have your device macAddress listed.  That fee is currently $150.  If you did purchase your Weatherbridge (or other weather station) from Ambient, then the access is no charge.

What you need:
1) an account on https://ambientweather.net/
2) one (or more) weather stations reporting to ambientweather.net.  If you have more than one, you can only use ONE of the stations with the template.
3) an apiKey which is (during the beta API period issued by Ed@ambientweather.com) and after the API beta, issued on your account dashboard via a request button.

4) if you are currently using a Saratoga template with other weather software, just use the update tool with a query of Base-*,AWN-plugin, 26-Feb-2018 to get a .zip of the plugin.  Copy your existing Settings-weather.php to another name before replacing it with the one from the plugin.
Configure the Settings-weather.php using the AWN configuration page

5) if you have never installed a Saratoga template, then use the Template Download/Installation instructions page and set up a new website.

Be advised that new 'realtime' data is available from the API at 1 minute intervals, and the last 24hrs of data is updated every 5 minutes.  Also, you will need to run a cron job to capture 'yesterday' data for display on the ajax-dashboard.

You can see a running sample here with data from my Davis VP1+ system via Meteobridge.

I am looking to provide a socket.io based replacement AJAX JavaScript to enable even more 'realtime' data in the future -- the current implementation relies entirely on the REST API provided by ambientweather.net

Enjoy, and best regards,
Ken
« Last Edit: February 26, 2018, 07:02:46 PM by saratogaWX »
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9396
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Use ambientweather.net data for a Saratoga Template website...
« Reply #1 on: March 07, 2018, 03:29:59 PM »
I've updated the AWN-plugin to include a trends page and a graphs page (using Highcharts) for the last 24hrs of data.

Existing users can use the https://saratoga-weather.org/wxtemplates/updates.php update tool with a query for AWN-plugin, Base-*, 07-Mar-2018 to get the updates. Be sure to read the enclosed README file for directions.

Note that this initial version has some (but not all) the internationalization done. The Windrose will only display in MPH at this time. The Highcharts graphs will display in your template units, but the legends will all be in English.

A future update will correct those shortcomings.

Sample display at https://saratoga-weather.org/AWN/index.php

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

Offline dow

  • Senior Member
  • **
  • Posts: 62
  • Village Idiot in training
Re: Use ambientweather.net data for a Saratoga Template website...
« Reply #2 on: October 26, 2018, 01:45:40 PM »
Hi,

I've got a wordpress site that I'm using to display the WU forecast for my PWS.  I know that wordpress uses PHP, and have checked that your test php script will work for me.  Can I insert your other scripts without completely hosing my wordpress installation?  If so, can you direct me to a tutorial that will assist me with this?

Thanks!
dow
https://www.pwsweather.com/station/pws/ktxboern48
Dow Mathis ∴
Boerne, TX
Nothing is foolproof to a sufficiently motivated fool.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9396
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Use ambientweather.net data for a Saratoga Template website...
« Reply #3 on: October 26, 2018, 02:20:31 PM »
Ahh.. what you ask for is definitely non-trivial.  The AWN plugin is designed to work within a Saratoga template set, and not for standalone use.  WordPress requires a separate plugin to execute native PHP code.

I strongly suggest you look at https://weather.station.software/ which is a WordPress plugin that can access Ambientweather.net for data, and provides shortcodes for you to embed your weather data in posts and pages.  It would be a LOT less effort than trying to use the Saratoga AWN-plugin with WordPress (or any other CMS like Joomla or Drupal).

Some of my other scripts (for forecasts, etc) can work inside a WordPress installation, but you'll need a WordPress plugin to enable native PHP code to work within WordPress posts/pages.
« Last Edit: October 26, 2018, 02:22:26 PM by saratogaWX »
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline zeppline

  • Senior Member
  • **
  • Posts: 73
    • Las Vegas Weather Guy
Re: Use ambientweather.net data for a Saratoga Template website...
« Reply #4 on: January 18, 2024, 01:17:54 PM »
I am looking at weather stations, I have Rainwise and Weather-display and your template I am looking a Ambient WS-2000. I was reading your AWN plugin Readme.txt what is  "saveYesterday.php" to be run by cron It's not in my software, do I need it for the trend which shows yesterday info. I am a little confused how it all works. I have always had direct connect to computer. This how I think it works, WS-2000 sends wifi to router then Ethernet to Ambient network, WD reads the Ambient network to display WD on computer. WD then sends to my web page. I hope this makes sense.
         Thanks Joe  "lasvegaswx.com"


Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9396
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Use ambientweather.net data for a Saratoga Template website...
« Reply #5 on: January 18, 2024, 04:19:49 PM »
Both AmbientWeather.net and WeatherLink.com network API calls do not return any 'yesterday' high/low data, so the saveYesterday.php script was developed.  What it does is run (via cron) every hour at 59 minutes after the hour, and if the hour is 23:59 local time (determined by the timezone setting in Settings.php), then a copy of the API data is saved as 'yesterday' data for use tomorrow.

Without running the saveYesterday.php script via cron, the dashboard won't show yesterday's high/low temperature nor yesterday rain.  The same data will not be displayed in the wxtrends.php page. 

So.. if you need to see the yesterday data, then you'll need to set up the cron job to run on your website to capture the data from AmbientWeather.net or WeatherLink.com.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline zeppline

  • Senior Member
  • **
  • Posts: 73
    • Las Vegas Weather Guy
Re: Use ambientweather.net data for a Saratoga Template website...
« Reply #6 on: January 19, 2024, 11:35:18 AM »
I am trying to learn about cron jobs. My host has cron job setup is said line ends have end with unix style ends? Do I have to change saveYesterday.php files or are they OK.  I use editPlus++ it has way to change file format to unix, I try it but I see no difference? What do they look like? /n

another question the time they have hour, 23 minutes 45 or 60 *** ?  then once, a day, week , month 

Offline Gyvate

  • Forecaster
  • *****
  • Posts: 3563
Re: Use ambientweather.net data for a Saratoga Template website...
« Reply #7 on: January 20, 2024, 12:05:05 AM »
I am trying to learn about cron jobs. My host has cron job setup is said line ends have end with unix style ends? Do I have to change saveYesterday.php files or are they OK.  I use editPlus++ it has way to change file format to unix, I try it but I see no difference? What do they look like? /n

another question the time they have hour, 23 minutes 45 or 60 *** ?  then once, a day, week , month
Google is your friend:
content-wise look up e.g. https://opensource.com/article/17/11/how-use-cron-linux
for editing  use vi, vim, nano (how to: --> Google)
side remark: this is rather a weather forum - not really a Linux (derivate) learning forum  8-)
WS2350 1.6.7, GW1000(3) 1.7.7,WH2650 WiFi (2) 1.7.7 (test/backup), GW1100 2.3.2, GW1200 1.3.1, GW2000(3) 3.1.3, HP2551 1.9.6,5.1.6;HP3500 1.7.2,WS3800 1.3.0, WN1910 1.2.3,WN1980 1.2.3;
Ecowitt WS90(2)1.4.3/1.4.0, WS80(2)1.2.8, WS68, WS69, WH40,WH31,WH31-EP,WN30,WN34L,WN35,WH32,WH32-EP, WH32B, WH57 [Lightning], WH41[PM2.5], WH51, WH45, WH55
MeteobridgePro(2)[test,prod] 5.8 Mar 01 2024, 15185 - Blake-Larsen Sun Recorder - RPi4/weewx 4.8.0/4.10.2/CumulusMX 3283/Meteobridge RPi4B-2GB,
Barani Meteoshield Pro, MetSpecRad02
weather landing page: http://meshka.eu
WIKI http://meshka.eu/Ecowitt/dokuwiki

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9396
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Use ambientweather.net data for a Saratoga Template website...
« Reply #8 on: January 20, 2024, 08:56:21 AM »
I am trying to learn about cron jobs. My host has cron job setup is said line ends have end with unix style ends? Do I have to change saveYesterday.php files or are they OK.  I use editPlus++ it has way to change file format to unix, I try it but I see no difference? What do they look like? /n

another question the time they have hour, 23 minutes 45 or 60 *** ?  then once, a day, week , month
Google is your friend:
content-wise look up e.g. https://opensource.com/article/17/11/how-use-cron-linux
for editing  use vi, vim, nano (how to: --> Google)
side remark: this is rather a weather forum - not really a Linux (derivate) learning forum  8-)
<musing>
True, it's not really a Linux/*nix learning forum, but... since the majority of the template/PHP script users have a mixed environment to cope with (Windows for weather system/maintenance of scripts/templates, and a *nix website host on a commercial hoster), a bit of both environments needs to be understood to be successful.
Most Windows users (especially ones who didn't start using DOS command line) find the *nix shell command environment a bit daunting.
When you throw in the differences between website relative addressing paths and filesystem addressing paths, it can be very fraught with simple typos that cause unexpected results to happen.  Then.. throw in cron commands (which run with your webserver's userid and a starting path that is NOT your website document root) it is hard to get it all correct to have a cron job work for you.

Since I'm fairly Windows/*nix 'bi-lingual', I think it's helpful to both explain and show examples of how to make it work on the first try.
</musing>
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline zeppline

  • Senior Member
  • **
  • Posts: 73
    • Las Vegas Weather Guy
Re: Use ambientweather.net data for a Saratoga Template website...
« Reply #9 on: January 20, 2024, 12:13:37 PM »
I think everyone on this forum is trying to learn something or they would not be looking for help. I have been with windows Dos and windows 3.0 now windows 11. I worked for Borg Warner, Siemens for 31 years writing program to control building automation, chillers, boilers,lighting,temperature control. I do use Google a lot. I have never wrote a cron job. I never have used unix programming language Just looking for example, Ken is the one everyone goes too. This is my hobby I am 82 and things change over the year. I will try to not ask stupid questions. Thanks Ken I will find out some how.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9396
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Use ambientweather.net data for a Saratoga Template website...
« Reply #10 on: January 20, 2024, 03:00:42 PM »
Sigh, I'd replied with detailed instructions earlier, but forgot to POST.  So here's the easy method to enable saveYesterday.php execution using cron (and the saratoga template):

1) run check-fetch-times.php?show=info in your browser.  It should return something like
Code: [Select]
Website PHP information

Webserver OS: Linux trues.name 3.10.0-957.5.1.el7.x86_64 #1 SMP Fri Feb 1 14:54:57 UTC 2019 x86_64
PHP Version: 8.1.27 built for Linux
PHP cmd location: /opt/plesk/php/8.1/bin/php
Document root: /var/www/vhosts/trues.name/httpdocs/wx
Template root: /var/www/vhosts/trues.name/httpdocs/wx/AWN
make note of the PHP cmd and Template root values.
2) make a cron command to cd to your template root and then run php for saveYesterday.php so your cron command should look like this example:
Code: [Select]
58 * * * * cd /var/www/vhosts/trues.name/httpdocs/wx/AWN; /opt/plesk/php/8.1/bin/php -q saveYesterday.php > yday-log.txt 2>&1The semicolon separating the two commands (cd and php) is needed so they are executed by cron in sequence.  The default for cron jobs is to use your home directory, not your document root directory so the cd is needed.

I hope this helps.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline zeppline

  • Senior Member
  • **
  • Posts: 73
    • Las Vegas Weather Guy
Re: Use ambientweather.net data for a Saratoga Template website...
« Reply #11 on: January 20, 2024, 08:36:56 PM »
Thank You for the information, I have been on Google all day. I just login and saw your reply. It will be sum time before I get everything together Thanks again.