From 1fbd98b7bb6c8f87ec5f370fc8203c2edd172da8 Mon Sep 17 00:00:00 2001 From: Matthew Wall Date: Mon, 31 Oct 2016 22:02:50 -0400 Subject: [PATCH] fix corner case in ws23xx driver when read returns nothing --- bin/weewx/drivers/ws23xx.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/weewx/drivers/ws23xx.py b/bin/weewx/drivers/ws23xx.py index a5ed0afa..2b538e1e 100644 --- a/bin/weewx/drivers/ws23xx.py +++ b/bin/weewx/drivers/ws23xx.py @@ -256,7 +256,7 @@ import weewx.drivers import weewx.wxformulas DRIVER_NAME = 'WS23xx' -DRIVER_VERSION = '0.24' +DRIVER_VERSION = '0.25' def loader(config_dict, _): @@ -1004,14 +1004,14 @@ class Ws2300(object): # # Initialise ourselves. # - def __init__(self,serial_port): + def __init__(self, serial_port): self.log_buffer = [] self.log_nest = 0 self.serial_port = serial_port # # Write data to the device. # - def write_byte(self,data): + def write_byte(self, data): if self.log_mode != 'w': if self.log_mode != 'e': self.log(' ') @@ -1026,7 +1026,7 @@ class Ws2300(object): self.log_mode = 'r' self.log(':') result = self.serial_port.read_byte(timeout) - if result == None: + if not result: self.log("--") else: self.log("%02x" % ord(result))