How to sent 'live' data to custom URL?

117 views
Skip to first unread message

Richard

unread,
Oct 27, 2018, 9:06:06 AM10/27/18
to weewx-user
I'm looking for a way to hit an url with weatherdata on the receive of each loop packet.

If I look at the user guide, i can see the [StdRESTful] section and was thinking I need to configure something here.
But I can't see a 'default' extension. Am i missing something?

The rapidfire/wunderground extension sounds what I need, but only need to sent it to my URL instead of wunderground' :)

Thomas Keffer

unread,
Oct 27, 2018, 9:29:01 AM10/27/18
to weewx...@googlegroups.com
Hello, Richard

Binding to the LOOP packets is really quite easy. There are several uploaders that do this. Perhaps you can crib from one of them?
and others. The last, the WeeRT uploader, is probably closest to what you're looking for. Remove the stuff for a database InfluxDB 'measurement'. It also includes an authentication header, which you may or may not need.

-tk


--
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.
For more options, visit https://groups.google.com/d/optout.

Louis De Lange

unread,
Oct 27, 2018, 9:38:38 AM10/27/18
to weewx-user
Richard,

If you read through the restx.py file that controls all of the restx services such wunderground uploads you will notice a number of parameters that can be specified, such as post_interval and server_url.  When you read through the user guide you might notice that these specific parameters are documented for use with CWOP upload, not WU - but they also work for WU upload if you specify them in the [[Wunderground]] section of [StdRESTful]  in you weex.conf file.  Another useful parameter is post_interval as it allows you to send an upload at the intervals you want, not every time you receive a loop packet.

Below is an example of a [[Winderground]] config segment is use to upload to my own remote server - and on the receiving end I use mwall's interceptor driver to receive and decode it.

    [[Wunderground]]
        # This section is for configuring posts to the Weather Underground.

        # If you wish to do this, set the option 'enable' to true,
        # and specify a station (e.g., 'KORHOODR3') and password.
        # To guard against parsing errors, put the password in quotes.
        enable = true
        station = MAKESOMETHINGUP
        password = anthingIwant

        # Set the following to True to have weewx use the WU "Rapidfire"
        # protocol. Not all hardware can support it. See the User's Guide.
        rapidfire = true

        post_interval = 40
        log_success = false
        log_failure = true
        server_url = http://"insert_your_own_url_here"
        max_tries = 2
        post_indoor_observations = true

Why do this? I came up with this approach to receive loop data at my remote cabin, and upload it to my home server running another instance of weewx - all this to minimize the data transfer via cellular modem from the remote site.

Or you can just follow Tom's suggestions that was posted just before mine :-)

Louis  

Thomas Keffer

unread,
Oct 27, 2018, 10:50:52 AM10/27/18
to weewx...@googlegroups.com
Very clever, Louis!

I don't like the WU protocol very much, as it breaks all kinds of rules about how to design a proper RESTful service. In particular, it uses an HTTP GET, when it should really use a POST.

-tk

Richard Verbruggen {Van Nut}

unread,
Oct 27, 2018, 1:59:43 PM10/27/18
to weewx...@googlegroups.com
Hi Thomas and Louis,

Thank you for your swift responses!

I'm not very familiar with coding in Python, so Louis' approach sounds more likely to fit my python skills ;)

As a background: At the moment we have a Vantage Vue connected to a Mac Mini running LWC. LWC is responsible to call an URL with the weather data as a query parameter. It was running properly for at least 4 years now; but now it's not that stable anymore. Besides the (headless) mac mini is offcourse complete overkill to just transfer the weatherdata to our servers :) (It used to have more jobs; but the were migrated to the cloud :)

Just a couple of additional questions:
- At the moment we share the data with CWOP and Wunderground; those other services listed in [stdRESTful] share the same config, so they all could be used as a private service?
- How is the data transfered to the service? As a POST or GET request? And how is it built?

Thanks (again) for you answers! 

Best regards
Richard


Op za 27 okt. 2018 om 16:50 schreef Thomas Keffer <tke...@gmail.com>:

Louis De Lange

unread,
Oct 27, 2018, 4:45:01 PM10/27/18
to weewx-user
Richard,

To really provide you with the best advice we need to understand a bit better what you want to do.

I am not familiar with LWC so I am not sure how this fits into the picture.

From your description below it sound like you are trying to upload to WU and CWOP at a minimum - this can be done directly from weewx.  Are you trying to do any other uploads?  What else are you doing with your data?

LdL

Richard Verbruggen {Van Nut}

unread,
Oct 27, 2018, 4:57:41 PM10/27/18
to weewx...@googlegroups.com
Hi Louis,

Sorry for the ambiguity. 
At the moment I use LightsoftWeatherCenter to sent our weather data to: WU, CWOP and my own server. 
This server in his turn collects data from multiple stations and creates a websocket push service for my clients (other websites) to subscribe to, to get local weather data.  Works like a charm :)

This server runs an public endpoint on a url which excepts the weather data  as a payload. Which then gets queued to get processed, async stored and broadcasted etc etc

So I need WeeWX to post a request to this public endpoint. (besides  updating WU and CWOP) :)

Hope this clarifies my needs

Best regards
Richard



Op za 27 okt. 2018 om 22:45 schreef Louis De Lange <kilo...@gmail.com>:

Louis De Lange

unread,
Oct 27, 2018, 8:03:49 PM10/27/18
to weewx-user
Richard, 

The fog is lifting...

On your own server, do you have the ability to adapt to receive the standard GET or POST payload formats that services such as WU use?  Or does the payload need to be in specific format that you cannot change?

LdL

Richard Verbruggen {Van Nut}

unread,
Oct 29, 2018, 8:54:23 AM10/29/18
to weewx...@googlegroups.com
Hi Louis, 

Thank you for making time to help me!

I own the code base :) So I can change to way the data is being processed on my server. That logic is refactored into 'adaptors' so should be fairly simple :)

Best
Richard


Op zo 28 okt. 2018 om 02:03 schreef Louis De Lange <kilo...@gmail.com>:

Thomas Keffer

unread,
Oct 29, 2018, 10:15:50 AM10/29/18
to weewx...@googlegroups.com
If this is the case, then the WeeRT uploader and, perhaps, the server API may be of the most help. It is designed to accept real-time LOOP packets, then pass them on via websockets. However, it is written in Node. 

-tk

Richard Verbruggen {Van Nut}

unread,
Oct 30, 2018, 7:09:07 AM10/30/18
to weewx...@googlegroups.com
That WeeRT extension looks like what I need. 
Now I have to wait for my rPi to arrive :)

Thanks for your help!

Best regards
Richard

Op ma 29 okt. 2018 om 15:15 schreef Thomas Keffer <tke...@gmail.com>:
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/s9mFNBRjbAk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages