ignore historical records with future timestamps

This commit is contained in:
Matthew Wall
2019-12-14 18:12:43 -05:00
parent 397ecd3cbb
commit 10d00a2327
2 changed files with 9 additions and 2 deletions

View File

@@ -790,7 +790,7 @@ from weeutil.weeutil import timestamp_to_string
log = logging.getLogger(__name__)
DRIVER_NAME = 'WMR300'
DRIVER_VERSION = '0.30'
DRIVER_VERSION = '0.31'
DEBUG_COMM = 0
DEBUG_PACKET = 0
@@ -1337,8 +1337,13 @@ class WMR300Driver(weewx.drivers.AbstractDevice):
time.sleep(0.001)
def genStartupRecords(self, since_ts):
now = time.time()
for rec in self.get_history(since_ts):
yield rec
ts = rec.get('dateTime')
if ts and ts < now:
yield rec
else:
log.info('ignored historical record: %s' % rec)
def convert(self, pkt, ts):
# if debugging packets, log everything we got

View File

@@ -106,6 +106,8 @@ Use of strftime() date and time format codes in template file names is now
supported as an alternative to the legacy 'YYYY', 'MM' and 'DD'. The legacy
codes continue to be supported for backwards compatibility. Fixes issue #415.
In WMR300 driver, ignore historical records with timestamp in the future.
3.9.2 07/14/2019