Meteobridge Driver

66 views
Skip to first unread message

Ryan Stasel

unread,
May 13, 2020, 11:13:49 PM5/13/20
to weewx-development
So, I'm doing all this work to get rtldavis working (which is working!), and before that fileparse (couldn't handle rain data without massaging). And thinking I should just look at making a driver that will query my Meteobridge Nano for data. I know this is possible via it's cgi-bin directory (I already have a Hubitat app doing this). 


Anyone have an example driver they could point me to that might be a decent start? First to admit, don't know much python. But, have wanted to learn it, so this might be a good opportunity. =)

Closest thing I can find is the ObserveIP driver. Many of the other drivers are doing either usb/serial work, or interception, etc. 

Thanks! 

mwall

unread,
May 14, 2020, 8:56:39 AM5/14/20
to weewx-development


On Wednesday, May 13, 2020 at 11:13:49 PM UTC-4, Ryan Stasel wrote:
And thinking I should just look at making a driver that will query my Meteobridge Nano for data. I know this is possible via it's cgi-bin directory (I already have a Hubitat app doing this). 


Anyone have an example driver they could point me to that might be a decent start?

the rainwise ip100 driver uses http queries to get data:


 

Bill Burton

unread,
May 14, 2020, 1:23:21 PM5/14/20
to weewx-development
Hello,
I used this driver as the basis as a driver for the Columbia MicroServer and it worked out very well. Thanks Matthew! The only thing is this version is for WeeWX 3.x and Python 2. Not aware if anyone has ported it yet to WeeWX 4 and Python 3. In the process of implementing the Columbia driver, I ported it to WeeWX 4 and Python 3 but tried to keep it backwards compatible with WeeWX 3.9 and Python 2. You can find the Columbia driver at:


The following should be noted:
  • A value for "rain" is not returned as the hardware does not return a delta value, only totals and rainRate. The IP-100 driver returns rain value directly from the hardware. Many or most drivers need to calculate a delta value for rain[1].
  • Exception handling is improved over the IP-100 driver. The Columbia hardware would sometimes return truncated XML so the driver detects that and if parsing still fails, will propagate the exeption correctly.
  • There are some porting loose ends in for the main() function since I don't fully understand the logging.
[1] Many drivers have to calculate the rain delta themselves to correctly return the value for "rain". A common way to do that is with this helper method like the following:
    def __init__(...):
       
...
       
self.last_rain_total = None
       
...

   
def _calculate_rain_delta(self, packet):
       
"""Convert from rain total to rain delta."""
        packet
['rain'] = weewx.wxformulas.calculate_rain(packet['rainTotal'], self.last_rain_total)
       
self.last_rain_total = packet['rainTotal']

The above assumes that packet['rainTotal'] is some cumulative rain total whether for a day, week or month, etc. returned by the hardware. When called in the genLoopPacket() method before the yield, the method will return the rain delta in packet['rain'].

The next version of the Columbia MicroServer driver uses the above method to calculate rain but is not on github.com yet.

If you search for "calculate_rain" in the bin/weewx/drivers folder, you can find many drivers that use the same helper method.

Hope this helps,
-Bill
Reply all
Reply to author
Forward
0 new messages