Output current weather conditions to xml

287 views
Skip to first unread message

Hiljo Lodewijk

unread,
Nov 6, 2016, 6:38:00 AM11/6/16
to weewx-user
Hello everyone,

I'm pretty new into weewx, but for what i see, it is an awsome piece of software! Thnx for the development so far :)

But for now i'm having a small issue:
What i see is that when i run weewx from te command line, the current received weather conditions are printed to STDOUT. This happens multiple times per minute. But when i look at the archive database, the conditions are only inserted every 5 minutes. I'd like to output the current conditions to an XML file, so i can get the most recent conditions (and not those 5 minutes old).
But where to start? How can i get Weewx to not output the conditions to STDOUT but to an XML file?

Thnx for a little help!

Thomas Keffer

unread,
Nov 6, 2016, 8:10:27 AM11/6/16
to weewx-user
There are lots of ways to accomplish this.

1. You could modify the csv service extension to save output in XML (instead of csv).

2. You could modify the StdPrint service to output XML to a file instead of printing to stdout.

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

Dave Webb KB1PVH

unread,
Nov 6, 2016, 8:55:12 AM11/6/16
to weewx...@googlegroups.com

There is a weewx extension called Pocket PWS that creates an XML file. Maybe you can use that and modify to your needs.

http://android.teszdesign.hu/installation-instructions/weewx/

Dave-KB1PVH

Sent from my Galaxy S7

Hiljo Lodewijk

unread,
Nov 17, 2016, 5:54:54 AM11/17/16
to weewx-user
Thanks Tom and Dave. I've managed to modify the CSV extension so it outputs an XML file. I've attached the file with this post.

The format of the XML file is:
<current>
 
<lastupdate>2016-11-15 10:48:27</lastupdate>
 
<temperature>18.9</temperature>
 
<pressure>1001</pressure>
 
<humidity>87</humidity>
 
<dewpoint>11.4</dewpoint>
 
<windchill>18.9</windchill>
 
<wind>
 
<direction>288</direction>
 
<speed>0.4</speed>
 
</wind>
 
<gust>
 
<direction>125</direction>
 
<speed>0.6</speed>
 
</gust>
 
<rain>
 
<rainrate>0.26</rainrate>
 
<rain>0.00</rain>
 
</rain>
</current>


currentweather.py

Thomas Keffer

unread,
Nov 17, 2016, 9:00:21 AM11/17/16
to weewx-user
Well done. 

There are some nice tools for parsing and writing XML in the standard Python library. Take a look at ElementTree.

-tk

Reply all
Reply to author
Forward
0 new messages