def __init__(self, **stn_dict): loginf('driver version is %s' % DRIVER_VERSION) self._log_raw_packets = tobool(stn_dict.get('log_raw_packets', False)) self._udp_address = stn_dict.get('udp_address', '<broadcast>') self._udp_port = int(stn_dict.get('udp_port', 50222)) self._udp_timeout = int(stn_dict.get('udp_timeout', 90)) self._share_socket = tobool(stn_dict.get('share_socket', False)) self._sensor_map = stn_dict.get('sensor_map', {}) loginf('sensor map is %s' % self._sensor_map) loginf('*** Sensor names per packet type') for pkt_type in fields.keys(): loginf('packet %s: %s' % (pkt_type,fields[pkt_type]))
def __init__(self, **stn_dict): loginf('driver version is %s' % DRIVER_VERSION) self._log_unknown = tobool(stn_dict.get('log_unknown_sensors', False)) self._log_unmapped = tobool(stn_dict.get('log_unmapped_sensors', False)) self._sensor_map = stn_dict.get('sensor_map', {}) loginf('sensor map is %s' % self._sensor_map) self._deltas = stn_dict.get('deltas', TFRCDriver.DEFAULT_DELTAS) loginf('deltas is %s' % self._deltas) self._counter_values = dict() cmd = stn_dict.get('cmd', DEFAULT_CMD) path = stn_dict.get('path', None) ld_library_path = stn_dict.get('ld_library_path', None) self._last_pkt = None # avoid duplicate sequential packets self._mgr = ProcManager() self._mgr.startup(cmd, path, ld_library_path)
def __init__(self, config_dict, fix_config_dict): """A generic initialisation.""" # save our weewx config dict self.config_dict = config_dict # save our fix config dict self.fix_config_dict = fix_config_dict # get our name self.name = fix_config_dict['name'] # is this a dry run self.dry_run = tobool(fix_config_dict.get('dry_run', True))
def __init__(self, **stn_dict): loginf('driver version is %s' % DRIVER_VERSION) self._log_raw_packets = tobool(stn_dict.get('log_raw_packets', False)) self._udp_address = stn_dict.get('udp_address', '<broadcast>') self._udp_port = int(stn_dict.get('udp_port', 12000)) self._udp_timeout = int(stn_dict.get('udp_timeout', 90)) self._share_socket = tobool(stn_dict.get('share_socket', True)) self._station_units = eval( stn_dict.get('station_units', 'weewx.METRICWX')) self._sensor_map = stn_dict.get('sensor_map', {}) if not self._sensor_map: logerr( '*** ERROR! sensor_map is empty! Terminating, since it would be silly to continue when we are not receiving data...' ) print "\nERROR! sensor_map is empty! Please check your weewx.conf file to ensure that your sensor_map is present and in the correct syntax/spacing." print "See the readme file for details on creating a sensor_map." print "\nTerminating, since it would be silly to continue when we are not receiving data...\n" exit() else: loginf('sensor map is %s' % self._sensor_map) loginf('*** Sensor names per packet type') self.raintype = ('rainin', 'dailyrainin', 'weeklyrainin', 'monthlyrainin', 'yearlyrainin') self.lastrain = {}