Revert changes to fousb from commit 2d78943

The commit resulted in errors
"TypeError: can't subtract offset-naive and offset-aware datetimes"
This commit is contained in:
Tom Keffer
2023-10-28 05:45:00 -07:00
parent 846212312f
commit 2202248b0b
3 changed files with 7 additions and 9 deletions

View File

@@ -19,7 +19,9 @@ Any reason why we can't use `weectl station create` to populate `/etc/weewx`
instead of custom shell scripts?
## Utilities
## Drivers
The `fousb` driver needs to be ported to Python 12.
## Docs

View File

@@ -23,8 +23,6 @@ Package installs now use `systemd` instead of the old System V `/etc/init.d`.
Removed all references to the deprecated package `distutils`, which is due to
be removed in Python v3.12.
Ported to Python v3.12.
Removed the utility `wunderfixer`. The Weather Underground seems to no longer
allow posting past-dated records.

View File

@@ -1093,7 +1093,7 @@ class FineOffsetUSB(weewx.drivers.AbstractDevice):
"""
records = self.get_records(since_ts)
log.debug('found %d archive records' % len(records))
epoch = datetime.datetime.fromtimestamp(0, datetime.timezone.utc)
epoch = datetime.datetime.utcfromtimestamp(0)
for r in records:
delta = r['datetime'] - epoch
# FIXME: deal with daylight saving corner case
@@ -1292,7 +1292,7 @@ class FineOffsetUSB(weewx.drivers.AbstractDevice):
if fixed_block['data_count'] is None:
raise weewx.WeeWxIOError('invalid data_count in get_records')
if since_ts:
dt = datetime.datetime.fromtimestamp(since_ts, datetime.timezone.utc)
dt = datetime.datetime.utcfromtimestamp(since_ts)
dt += datetime.timedelta(seconds=fixed_block['read_period']*30)
else:
dt = datetime.datetime.min
@@ -1516,8 +1516,7 @@ class FineOffsetUSB(weewx.drivers.AbstractDevice):
while data_time > next_live + live_interval:
log.debug('missed interval')
next_live += live_interval
result['idx'] = datetime.datetime.fromtimestamp(int(next_live),
datetime.timezone.utc)
result['idx'] = datetime.datetime.utcfromtimestamp(int(next_live))
next_live += live_interval
yield result, old_ptr, False
old_data = new_data
@@ -1555,8 +1554,7 @@ class FineOffsetUSB(weewx.drivers.AbstractDevice):
next_log = None
self._station_clock = None
if next_log:
result['idx'] = datetime.datetime.fromtimestamp(int(next_log),
datetime.timezone.utc)
result['idx'] = datetime.datetime.utcfromtimestamp(int(next_log))
next_log += log_interval
yield result, old_ptr, True
if new_ptr != self.inc_ptr(old_ptr):