Author Topic: New Saratoga AJAX/PHP template plugin for WeatherCat under construction...  (Read 19775 times)

saratogaWX

  • Strong Breeze
  • ***
  • Posts: 138
  • Weather website programming enthusiast
    • Saratoga-Weather.org
  • Station Details: Davis VP1 +, iMAC 21, OSX 10.6.8
Hi folks!

Stu had asked me if it were feasible to create a Plugin for my AJAX/PHP template sets to work with WeatherCat, and ... yes, it is very feasible, and I've started construction of the Plugin.

I hope to have it available in less than one week from now.

I do have WeatherCat Beta running on my iMAC and creating data from my Davis VP+ station, and already have the PHP tags file pretty much finished.  The only 'issue' I'd found so far is how to handle the '$' tag delimiter and not have PHP be confused by a missing variable name (PHP uses $ at the start to indicate a variable name). 

I'll keep you posted on the progress.  Thanks Stu, for asking in the first place :)

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis Vantage Pro Plus - FARS, Boltek-PCI/NexStorm, GRLevel3, WD, WL, VWS, Cumulus, Meteohub, WeatherSnoop, WeatherCat
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

WCDev

  • WeatherCat Developer
  • Administrator
  • Storm
  • *****
  • Posts: 2809
    • CW9739
    • ISCOTLAN25
    • Trixology
  • Station Details: Main Station: Vantage Pro-2, 24hr fars, solar, soil/leaf station, extra temp stations, no U.V. WeatherLink IP.
Welcome Ken, and on behalf of all the WeatherCat users, thank you for taking the time to do this!

Cheers,
Stu.

Steve

  • Global Moderator
  • Storm
  • *****
  • Posts: 1333
    • DW8454
    • KOHAVON11
    • Avon Weather
  • Station Details: Davis Wireless VP2 Plus w/24 hr FARS, Leaf & Soil Station, 2017 27" iMac 3.8 GHz i5, 40GB RAM, Mac OS 10.14, WeatherCat 3
Thanks for joining us, Ken, and I'm glad to see your interest here. We'd talked to you about this with Stu's prior weather application, LWC a while back on the MacWeather forum, and last week I'd mentioned you might be interested in getting us going on WeatherCat with your templates, so I'm glad Stu contacted you.

I've been fiddling with the WeatherSnoop version on a trial copy of WeatherSnoop. I have it getting data from WeatherCat's feed to Weather Underground. Definitely a round about way to get there. I'm looking forward to adding some of the features of your templates to my web site.

Thanks,
Steve
Steve - Avon, Ohio, USA


CWOP: DW8454 • WU: KOHAVON11 • AWEKAS • CoCoRaHS • Skywarn •  UK Met Office
MWWN •PWSweather • WeatherBug • WeatherCloud • Twitter • Facebook

elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 5295
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, Mac mini (2018), macOS 10.14.3, WeatherCat 3
Thank you!! (Re: New Saratoga AJAX/PHP template)
« Reply #3 on: March 16, 2012, 02:08:25 AM »
Welcome Ken!!

Let me join the chorus thanking you for your efforts at supporting da' Cat!  [cat]

Much appreciated!!  [tup]

Cheers, Edouard  [cheers1]

Jace

  • Storm
  • *****
  • Posts: 811
    • DW9675
    • ISuffolk62
    • Yoxford weather site.
  • Station Details: Davis Vantage Pro2, with Mac USB Data Logger. 2.4 GHz Intel Core 2 Duo MacBook, with 8 GB 1033 MHz DDR3 Memory, running Mac OSX Version 10.10.1 (Yosimite).
Where do I sign up for web page design and Applescript lessons  [tup] [banghead]

JC

saratogaWX

  • Strong Breeze
  • ***
  • Posts: 138
  • Weather website programming enthusiast
    • Saratoga-Weather.org
  • Station Details: Davis VP1 +, iMAC 21, OSX 10.6.8
Thanks for the warm welcome!  I'm very pleased to help WeatherCat enthusiasts be able to use a modular AJAX/PHP template design.  WeatherCat will be the 7th weather software package to use the template set -- and over 600 websites have used the free template set as a starting point for their personal weather websites around the world.

I've got a working copy (testing version) up at http://saratoga-weather.org/wxtemplates/Test/wxindex.php if you'd like to 'kick the tires' on my development copy.

Currently, WeatherCat is uploading the tags file (see dump, see source) with weather from my station, and the defs file (see source) maps the $WX[] variables to the $variables needed for the display in the dashboard/gizmo area.  I'll be adding the AJAX script as I figure out how to upload one file more frequently than 5 minutes (like every 15 seconds).

I'll keep you posted on progress, and suggestions are always welcome!

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis Vantage Pro Plus - FARS, Boltek-PCI/NexStorm, GRLevel3, WD, WL, VWS, Cumulus, Meteohub, WeatherSnoop, WeatherCat
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

tigers

  • Gentle Breeze
  • **
  • Posts: 79
Thanks for the warm welcome!  I'm very pleased to help WeatherCat enthusiasts be able to use a modular AJAX/PHP template design.  WeatherCat will be the 7th weather software package to use the template set -- and over 600 websites have used the free template set as a starting point for their personal weather websites around the world.

I've got a working copy (testing version) up at http://saratoga-weather.org/wxtemplates/Test/wxindex.php if you'd like to 'kick the tires' on my development copy.

Currently, WeatherCat is uploading the tags file (see dump, see source) with weather from my station, and the defs file (see source) maps the $WX[] variables to the $variables needed for the display in the dashboard/gizmo area.  I'll be adding the AJAX script as I figure out how to upload one file more frequently than 5 minutes (like every 15 seconds).

I'll keep you posted on progress, and suggestions are always welcome!

Best regards,
Ken

Good to see you here. Your templates were the inspiration I needed to kick off my own template project although I'm not sure my template will be nearly as comprehensive as yours!

As for real time data, you can use the cgi tab and get the updates that way. I'm using this to generate an XML file which I'm then reading into my template via Ajax. Currently I've got the update interval at 5 seconds and it seems to work well.

I'm going to ask Stu if the real time data can be expanded a bit to include highs,lows, and the times for those.

saratogaWX

  • Strong Breeze
  • ***
  • Posts: 138
  • Weather website programming enthusiast
    • Saratoga-Weather.org
  • Station Details: Davis VP1 +, iMAC 21, OSX 10.6.8
Thanks for the tip about the CGI upload .. that sounds quite workable, and I hope Stu does add in today's high/low temperatures and times to the mix.   I'll give that a try with a modified submit script :)

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis Vantage Pro Plus - FARS, Boltek-PCI/NexStorm, GRLevel3, WD, WL, VWS, Cumulus, Meteohub, WeatherSnoop, WeatherCat
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

WCDev

  • WeatherCat Developer
  • Administrator
  • Storm
  • *****
  • Posts: 2809
    • CW9739
    • ISCOTLAN25
    • Trixology
  • Station Details: Main Station: Vantage Pro-2, 24hr fars, solar, soil/leaf station, extra temp stations, no U.V. WeatherLink IP.
Let me know what you need folks and I can get it into the development plan.

Ken, for individual uploads please see the 'Additional Files' tab in the Custom Web preferences - here you can add files that are processed individually on their own time schedule.

Nice work  [tup]

Stu.

saratogaWX

  • Strong Breeze
  • ***
  • Posts: 138
  • Weather website programming enthusiast
    • Saratoga-Weather.org
  • Station Details: Davis VP1 +, iMAC 21, OSX 10.6.8
Let me know what you need folks and I can get it into the development plan.

Ken, for individual uploads please see the 'Additional Files' tab in the Custom Web preferences - here you can add files that are processed individually on their own time schedule.

Nice work  [tup]

Stu.

Thanks Stu!

It would be nice to have STAT$TEMPERATURE:DELTA24$ to return the outside temperature 24hrs ago.

I'll give a try to the Additional Files to upload a WCT_realtime.txt file for the AJAX script ..

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis Vantage Pro Plus - FARS, Boltek-PCI/NexStorm, GRLevel3, WD, WL, VWS, Cumulus, Meteohub, WeatherSnoop, WeatherCat
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Steve

  • Global Moderator
  • Storm
  • *****
  • Posts: 1333
    • DW8454
    • KOHAVON11
    • Avon Weather
  • Station Details: Davis Wireless VP2 Plus w/24 hr FARS, Leaf & Soil Station, 2017 27" iMac 3.8 GHz i5, 40GB RAM, Mac OS 10.14, WeatherCat 3
Ken,

What's nice with the CGI export is that it sends out only raw date every few seconds rather than a template every however seconds/minutes for the 'Additional Files', keeping bandwidth tidy. (unless you are processing locally and sending converted raw data every few seconds.)

Steve
Steve - Avon, Ohio, USA


CWOP: DW8454 • WU: KOHAVON11 • AWEKAS • CoCoRaHS • Skywarn •  UK Met Office
MWWN •PWSweather • WeatherBug • WeatherCloud • Twitter • Facebook

WCDev

  • WeatherCat Developer
  • Administrator
  • Storm
  • *****
  • Posts: 2809
    • CW9739
    • ISCOTLAN25
    • Trixology
  • Station Details: Main Station: Vantage Pro-2, 24hr fars, solar, soil/leaf station, extra temp stations, no U.V. WeatherLink IP.
Hi Ken,
Thanks for the feedback.

I'll add a counterpart to CURRENT which will be 24HRSAGO - this will return the data as it was 24 hours ago. I'll also add DELTA24 which will return the difference between the data 24 hours ago and now (this fits in with DELTA1).

I should be able to get these into the next build (out in a few days).

Cheers,
Stu.

tigers

  • Gentle Breeze
  • **
  • Posts: 79
 Stu, I'd also like to request the high and low temps for the day and the time they occurred. Hopefully this won't turn unwieldy from your end.

saratogaWX

  • Strong Breeze
  • ***
  • Posts: 138
  • Weather website programming enthusiast
    • Saratoga-Weather.org
  • Station Details: Davis VP1 +, iMAC 21, OSX 10.6.8
Hi Ken,
Thanks for the feedback.

I'll add a counterpart to CURRENT which will be 24HRSAGO - this will return the data as it was 24 hours ago. I'll also add DELTA24 which will return the difference between the data 24 hours ago and now (this fits in with DELTA1).

I should be able to get these into the next build (out in a few days).

Cheers,
Stu.

Awesome, Stu!

Would it also be possible to add a 24hr time with hh:mm:ss in it (instead of just hh:mm?  That would help with the AJAX updates (which are now pegged at 1 minute since no :ss available on the time).  This could be a new tag so the t24$ wouldn't have to change if you didn't want it to.  A similar new tag for h:mm:ss AM/PM (to augment t12$ would also be useful.

A 'date/time of last rain gauge tip' tag would be helpful too (ISO YYYY-MM-DD HH:MM:SS would be great).  This can be used to compute 'days since last rain'.

I see that all the date tags come out as 'dd MON yyyy', but there doesn't seem to be a setting preference to have them in dd/mm/yyyy or mm/dd/yyyy format.  Is that a system-wide option, or something that could be added?  The reason is that the MON (if it comes from the system) may be in a non-English locale which would make it difficult to handle with PHP (which runs English).  If it is a system-wide thing, then another option would be to add a tag that would have the month-name abbreviations used on the system like

Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec

Then I could convert to English for processing even if the Mac were running with a different language default.

BTW... I now have AJAX updates on the test site.  I am using the Additional Files upload for a small tags file (based on the Cumulus realtime.txt) handled by an ajaxWCTwx.js AJAX script (oddly enough, based on the Cumulus script too :) )

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis Vantage Pro Plus - FARS, Boltek-PCI/NexStorm, GRLevel3, WD, WL, VWS, Cumulus, Meteohub, WeatherSnoop, WeatherCat
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

WCDev

  • WeatherCat Developer
  • Administrator
  • Storm
  • *****
  • Posts: 2809
    • CW9739
    • ISCOTLAN25
    • Trixology
  • Station Details: Main Station: Vantage Pro-2, 24hr fars, solar, soil/leaf station, extra temp stations, no U.V. WeatherLink IP.
Todd, Ken - this is development how I like it  :)

Todd, I assume you're talking about the custom CGI? If so, if I can just spec the changes you want, they are:
1. Add daily high external temperature  (Fahrenheit)
2. Add time of daily high external temperature
3. Add daily low external temperature (Fahrenheit)
4. Add time of daily low temperature.
Let me know if this is OK.


Ken, I understand your problems :)

My preliminary suggestion is to add a tag that switches the web processing from human readable/localised date/time formats to a more machine readable format. I would suggest ISO 8601 - i.e. YYYY-MM-DD and times as hh:mm:ss (24 hour format)). Dates/times are separated by the character 'T'.

A full date/time would be of the format: YYYY-MM-DDTHH:MM:SS - i.e. 2012-03-16T22:48:14

So if WeatherCat sees ISO8601DATES$ from that point on until the end of the page (or HUMANDATES$) it switches to the ISO 8601 format for dates and times. Fixed format tags such as t12$ are excluded, I'll also add t12s$ and t24s$ which output with seconds and similarly are excluded.

(Note, I am not in front of the WeatherCat code at the moment (I'm actually deep into www.F1.com getting ready for the season), but I don't think it'll be too difficult to do this).

Would that cover your requirements?

Cheers,
Stu.