On Thursday, August 25, 2016 at 10:25:23 AM UTC-4, moof wrote:
>
> Good morning,
>
> I am looking to add support for the Rainwise IP-100. The device provides a 
> XML feed via the devices ip/status.xml updated every 2 second. 
>
> I am new to Python, so some examples could help. What is the best driver 
> to use a basis to parse the XML?
>

hi moof!

this looks like a wonderful little project - you should be able to get a 
driver running in no time.

you might want to start with the fileparse driver that is distributed with 
weewx (look in the extensions directory).

in the genLoopPackets function, replace the 'with open(self.path) ...' code 
with the code that pulls data from the ip-100 then parses it.

there are many examples for getting data via http, but it really boils down 
to this:

http://stackoverflow.com/questions/22676/how-do-i-download-a-file-over-http-using-python

as for examples for parsing xml:

http://stackoverflow.com/questions/1912434/how-do-i-parse-xml-in-python

http://docs.python-guide.org/en/latest/scenarios/xml/

http://www.tutorialspoint.com/python/python_xml_processing.htm

be sure to read the 'porting to new hardware' section of the weewx 
customization guide.

http://weewx.com/docs/customizing.htm#porting

and let us know how it goes!

m

Reply via email to