Skip to content

Commit

Permalink
- move parsing of debug options from class gateway to driver and serv…
Browse files Browse the repository at this point in the history
…ice classes

- add TODO re decode of 0x7B
- minor comment updates
  • Loading branch information
gjr80 committed Aug 7, 2023
1 parent 3185210 commit 55539f7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions bin/user/gw1000.py
Original file line number Diff line number Diff line change
Expand Up @@ -968,8 +968,6 @@ def __init__(self, **gw_config):
# whether to log an available firmware update
log_fw_update_avail = weeutil.weeutil.tobool(gw_config.get('log_firmware_update_avail',
False))
# get device specific debug settings
self.debug = DebugOptions(gw_config)

# log our config/settings that are not being pushed further down before
# we obtain a GatewayCollector object, obtaining a gatewayCollector
Expand Down Expand Up @@ -1379,6 +1377,9 @@ def __init__(self, engine, config_dict):
# an extended lost contact period
self.lost_contact_log_period = int(gw_config_dict.get('lost_contact_log_period',
default_lost_contact_log_period))
# get device specific debug settings
self.debug = DebugOptions(gw_config_dict)

if self.debug.any or weewx.debug > 0:
loginf(" max age of API data to be used is %d seconds" % self.max_age)
# The field map. Field map dict output will be in unsorted key order.
Expand Down Expand Up @@ -2304,6 +2305,8 @@ def __init__(self, **stn_dict):

# log our version number
loginf('GatewayDriver: version is %s' % DRIVER_VERSION)
# get device specific debug settings
self.debug = DebugOptions(stn_dict)
# now initialize my superclasses
super(GatewayDriver, self).__init__(**stn_dict)
# start the Gw1000Collector in its own thread
Expand Down Expand Up @@ -2943,6 +2946,7 @@ class ApiParser(object):
b'\x12': ('decode_big_rain', 4, 't_rainmonth'),
b'\x13': ('decode_big_rain', 4, 't_rainyear'),
b'\x7A': ('decode_int', 1, 'rain_priority'),
# TODO. Should this be 'temp_comp' or 'rain_comp'
b'\x7B': ('decode_int', 1, 'temp_comp'),
b'\x80': ('decode_rainrate', 2, 'p_rainrate'),
b'\x81': ('decode_rain', 2, 'p_rainevent'),
Expand Down Expand Up @@ -3789,6 +3793,8 @@ def parse_read_firmware_version(response):
6+f checksum byte LSB of the sum of the
command, size and data
bytes
Returns a unicode string
"""

# create a format string so the firmware string can be unpacked into
Expand Down Expand Up @@ -5203,6 +5209,8 @@ def get_firmware_version(self):
been raised by send_cmd_with_retries() which will be passed through
by get_firmware_version(). Any code calling get_firmware_version()
should be prepared to handle this exception.
Returns a unicode string
"""

# get the validated API response
Expand Down

0 comments on commit 55539f7

Please sign in to comment.