WeePOST Extension

165 views
Skip to first unread message

Andrew B

unread,
Feb 16, 2020, 3:01:08 AM2/16/20
to weewx-user
Hi All,

I've had my weewx site up and running since last summer and have been quite happy with the 5-minute update interval. However, this past week I found some time to add a bit of live (loop) data to the site. It doesn't serve much of a practical purpose but I get a kick out of live wind data for some reason.

Anyway, I couldn't find an extension that would allow for what I wanted without having to go the route of InfluxDB or MQTT (both awesome but overkill for this). So what I ended up doing was modifying the WeeRT extension to just obliviously post loop data to an endpoint. On the receiving end, I created a PHP script that uses an often forgotten PHP shared memory feature to store the loop data in memory instead of writing the data to disk. So this is a Raspberry PI/SD card friendly. No special PHP configuration is needed. Just a basic Apache/PHP, Nginx/PHP, or Whatever/PHP setup will work fine.

You can see this in action here:

And the extension can be found here:

99.9% of the credit for the extension should go to the author of the WeeRT extension. I just modified it to do what I described above and am sharing it in case someone finds it useful.

Thomas Keffer

unread,
Feb 16, 2020, 7:03:38 AM2/16/20
to weewx-user
Very clever! That's the simplest "live" station I've seen.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/942ed034-36ca-4e53-8108-3a0220501bc7%40googlegroups.com.

Walter Smith

unread,
Feb 18, 2020, 12:39:57 PM2/18/20
to weewx-user
Andrew, this is great!  I am working my way through it all.  I have the data being posted, but I get an entry in syslog for every post:

Feb 18 10:45:59 raspberrypi2 weewx[30469]: restx: WeePOST: Published record 2020-02-18 10:45:59 CST (1582044359)
Feb 18 10:46:01 raspberrypi2 weewx[30469]: restx: WeePOST: Published record 2020-02-18 10:46:02 CST (1582044362)
Feb 18 10:46:03 raspberrypi2 weewx[30469]: restx: WeePOST: Published record 2020-02-18 10:46:04 CST (1582044364)
Feb 18 10:46:05 raspberrypi2 weewx[30469]: restx: WeePOST: Published record 2020-02-18 10:46:06 CST (1582044366)
Feb 18 10:46:07 raspberrypi2 weewx[30469]: restx: WeePOST: Published record 2020-02-18 10:46:08 CST (1582044368)
Feb 18 10:46:09 raspberrypi2 weewx[30469]: restx: WeePOST: Published record 2020-02-18 10:46:10 CST (1582044370)

Is there a way to turn (most) of those off?

more complete log attached.

Thanks,

Walt
outfile0218.txt

Andrew Milner

unread,
Feb 18, 2020, 12:44:47 PM2/18/20
to weewx-user

Andrew B

unread,
Feb 18, 2020, 9:15:49 PM2/18/20
to weewx-user
Hi Walt,

As Andrew Milner linked to, you need to set log_success under [StdRESTful] to False inside weewx.conf.

This will eliminate the log entries for successful but will still allow for failures to be logged. I've actually turned off all "success" logging for weewx as I really only need to know about failures.

Walter Smith

unread,
Feb 19, 2020, 12:49:42 PM2/19/20
to weewx-user
Hi to both Andrews,

That fixed the writes to syslog, but I do see more green flashes on my Raspberry Pi now that weePOST is active.  The nginx activity log gets an entry on every post, so that may be the cause?  It's not a biggie, maybe I could move that log to a RAM drive or find a setting in nginx to not post those entries.

Andrew B, I ripped off your newLiveDataCheck function from your current.js, and this morning I got my first live update to my web page.  Neat!  This has been a good learning experience, thanks again.

Walt

Andrew B

unread,
Feb 19, 2020, 5:30:54 PM2/19/20
to weewx-user
Awesome! I'm glad you were able to find some of the code on my site useful.

As for the logs, I followed these steps to save logs to a ramdisk:
https://github.com/weewx/weewx/wiki/Minimize-writes-on-SD-cards#save-log-files-to-ramdisk-option-1

Günther Wrana

unread,
Mar 3, 2020, 8:36:02 AM3/3/20
to weewx-user
Hello i have questions about minimizing the writes to SD card.

Weewx has been running on my Raspberry since may 2019 and an SD Card and two USB sticks have been on it since then.

Now i put the HTML files into RAM area as mentioned above under the link.

Should I also move the LOG files to the RAM area, or is it sufficient to deactivate them with the STOP command?

What I hope for is that after half a year the SD card is not broken again and I have to reinstall everything.


Thanks for everything and the text is written with Googel translator.

Günther

Andrew B

unread,
Mar 3, 2020, 2:56:52 PM3/3/20
to weewx-user
Hi Günther,

I put my logs on a ramdisk as well.
Reply all
Reply to author
Forward
0 new messages