Commenting the rain= line in weewx.conf stops the WeatherFlow UDP driver from logging that particular sensor value.
You still need to write a Python data_services routine to count the tips via a GPIO pin and insert them into WeeWX. The provided link is an example to base a custom rain tipper data_services from.....
I got it working, except the "rain =" line i needed to comment out was in the driver file (in this case simulator.py), not weewx.conf.
My service is running by adding it in weewx.conf under [Engine]-->[Services]-->data_services.
But I don't know how to add variables into weewx.conf such as GPIO pin and bucket_size and have them pass into the service. How are variables in weewx.conf referenced?
For reference, here is the service to log the rain from the Rainwise 111:
import syslog
import weewx
from weewx.wxengine import StdService
from gpiozero import Button
import datetime
import time
DRIVER_NAME = "RW111GPIO"
DRIVER_VERSION = "0.1"
class Rw111GpioService(StdService):
def __init__(self, engine, config_dict):
super(Rw111GpioService, self).__init__(engine, config_dict)
d = config_dict.get('Rw111GpioService', {})
self.rw111 = Rw111(**d)
self.bind(weewx.NEW_LOOP_PACKET, self.load_data)
def load_data(self, event):
try:
self.get_rain(event)
except Exception as e:
syslog.syslog(syslog.LOG_ERR, "rw111gpio: cannot read value: %s" % e)
# Get Rainfall data
def get_rain(self, event):
rainfall = round(self.rw111.get_rainfall(),2)
syslog.syslog(syslog.LOG_DEBUG, "rw111gpio: found rain value of %s cm" % rainfall)
event.packet['rain'] = float(rainfall)
class Rw111(object):
""" Object that represents a RainWise Wired Rain Gauge. """
def __init__(self, **d):
""" Initialize Object. """
# Read from config the bucket size
self.bucket_size = 0.1 # in mm
self.rain_count = 0
# Read from config which pin to use on the RPI GPIO
self.rain_sensor = Button(6)
self.rain_sensor.when_pressed = self.bucket_tipped
def bucket_tipped(self):
self.rain_count = self.rain_count + 1
def get_rainfall(self):
""" Returns rainfall in cm. """
rainfall = (self.rain_count * self.bucket_size) / 10.0
self.reset_rainfall()
return rainfall
def reset_rainfall(self):
self.rain_count = 0
I'd like self.bucket_size and self.rain_sensor to reference variables in weewx.conf, but I have no clue how to do that. The service is called in the weewx.conf file at the end:
[Engine]
# The following section specifies which services should be run and in what order.
[[Services]]
data_services = user.Rw111GpioTest.Rw111GpioService,