The short answer to your question is no, nothing like that exists at the moment. If you have your web server (or process that wil use gauge-data.txt) on your weeWX machine then it is a simple matter for the generated file to be saved wherever you want, but if you need to transfer the file in near realtime to another machine then no that capability does not exist at the moment.
I made a quick page that updates some data from the real time gauge using Ajax:It takes some data from live_data.json (currently wspeed, wgust, bearing, domwinddir) and displays it, updating every 2 seconds.I'd like to add the highest gust of the day though, and I'm wondering if anyone can see an easy way to do that. In the reports, that would be $day.windGust.max.
Also, would questions like this be better on the dev list?
Since you have rapidfire on WU should be being fed the loop windSpeed values. The loop windSpeed values appear in gauge-data.txt in the wlatest field not the wspeed field you are using; wspeed is the 'average wind speed' which will be the average wind speed over an archive period or 5 minutes depending on settings. The wgust used by your page is the highest wind speed seen over the last 10 minutes, that seems approriate though I am not sure exactly what WU uses.
Direction wise you are using fields bearing and domwinddir, bearing will be the direction corresponding to the loop windSpeed value so that seems appropriate but domwinddir is the vector average wind direction for today. Your brackets around domwinddir seem to imply it is the compas point equvalent of bearing which it isn't, if that is what you intend then perhaps you need to express bearing as a compass point either in the code on your page or in the source gauge-data.txt.
Just wondering if there was any particular reason you used a GET rather than a POST? I think the code to support passing the data via GET is a little simpler than a POST but since GET includes all of the data in the URL my nginx access log is getting hammered. I estimate about 55Mb per day.
Gary
On Tuesday, 21 March 2017 13:09:56 UTC+10, gjr80 wrote:Good work, I must admit I had been stuck in the 'file transfer' paradigm rather than 'data transfer' and whilst I have had loop based RSYNC working on my LAN there was too much contention for my liking. I will have have a look at this and see how your approach works for me.
Gary
On Tuesday, 21 March 2017 04:41:49 UTC+10, Alec Bennett wrote:The short answer to your question is no, nothing like that exists at the moment. If you have your web server (or process that wil use gauge-data.txt) on your weeWX machine then it is a simple matter for the generated file to be saved wherever you want, but if you need to transfer the file in near realtime to another machine then no that capability does not exist at the moment.I added the ability to post live_data.json to a remote webserver, if anyone needs the ability, it's here:It works by posting all the data it writes to live_data.json to a PHP script on a remote webserver using a GET statement. Note the PHP script here, that receives the data:If anyone wants me to convert it to Python for consistency, let me know.To use, set the following value in the RealtimeGaugeData section of your weewx config file:remote_server_url = http://yourwebsite.com/path_to/receive_conditions.phpIt's my first time posting a fork to github, so please let me know if I did anything dumb. And let me know if anyone wants me to change anything.
--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/ws7u2itvJMw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
A lot of thank's for your great work.
Please... could we have a copy of this example wind page?
To unsubscribe from this group and all its topics, send an email to weewx-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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+unsubscribe@googlegroups.com.
On the general problem of what makes a good RESTful API, I found the document RESTful Service Best Practices, Recommendations for Creating Web Services very informative. It would definitely recommend a POST.-tk
On Tue, Mar 21, 2017 at 8:40 AM, Alec Bennett <wryb...@gmail.com> wrote:
Just wondering if there was any particular reason you used a GET rather than a POST? I think the code to support passing the data via GET is a little simpler than a POST but since GET includes all of the data in the URL my nginx access log is getting hammered. I estimate about 55Mb per day.Very interesting, I hadn't considered that. I'll switch to POST later today.
--
Gary
On Tuesday, 21 March 2017 13:09:56 UTC+10, gjr80 wrote:Good work, I must admit I had been stuck in the 'file transfer' paradigm rather than 'data transfer' and whilst I have had loop based RSYNC working on my LAN there was too much contention for my liking. I will have have a look at this and see how your approach works for me.
Gary
On Tuesday, 21 March 2017 04:41:49 UTC+10, Alec Bennett wrote:The short answer to your question is no, nothing like that exists at the moment. If you have your web server (or process that wil use gauge-data.txt) on your weeWX machine then it is a simple matter for the generated file to be saved wherever you want, but if you need to transfer the file in near realtime to another machine then no that capability does not exist at the moment.I added the ability to post live_data.json to a remote webserver, if anyone needs the ability, it's here:It works by posting all the data it writes to live_data.json to a PHP script on a remote webserver using a GET statement. Note the PHP script here, that receives the data:If anyone wants me to convert it to Python for consistency, let me know.To use, set the following value in the RealtimeGaugeData section of your weewx config file:remote_server_url = http://yourwebsite.com/path_to/receive_conditions.phpIt's my first time posting a fork to github, so please let me know if I did anything dumb. And let me know if anyone wants me to change anything.
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/ws7u2itvJMw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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.
<?php
// we are only interested in HTTP POST
if($_SERVER['REQUEST_METHOD'] == 'POST') {
// get the data
$data = file_get_contents("php://input");
// write the data to file
file_put_contents("json/gauge-data.txt", $data);
// send something back indicating success
echo "success";
}
?>
I have added HTTP POST to rtgd.py using a similar approach to that taken in the weeWX RESTful API in restx.py. It seems to work well. The php I am using is:
<?php
// we are only interested in HTTP POST
if($_SERVER['REQUEST_METHOD'] == 'POST') {
// get the data
$data = file_get_contents("php://input");
// write the data to file
file_put_contents("json/gauge-data.txt", $data);
// send something back indicating success
echo "success";
}
?>
If OK with you Alec I have mentioned you in the comments as the source of the idea and referenced your repo. I will publish 0.2.11 later today.