On Monday, October 3, 2016 at 10:35:53 PM UTC-4, Allan H wrote:
>
> Den 04-10-2016 kl. 03:22 skrev mwall: 
> > there already is exception handling (and retries) happening in the _read 
>
> really ? Doesn't seem to work 
>
> Here is what I added in the driver: 
>
>      def read_memory_size(self): 
>          loginf("Entry read_memory") 
>          buf = self._read(0xfc) 
>          loginf("After self_read") 
>
> Output in syslog is: 
> (when reset is disabled)) 
>
> Oct  4 02:17:08 mail2 weewx[25331]: engine: Loading station type TE923 
> (weewx.drivers.te923) 
> Oct  4 02:17:08 mail2 weewx[25331]: te923: driver version is 0.21 
> Oct  4 02:17:08 mail2 weewx[25331]: te923: polling interval is 10 
> Oct  4 02:17:08 mail2 weewx[25331]: te923: observation map is {'bat_1': 
> 'outTempBatteryStatus', 'bat_3': 'extraBatteryStatus2', 'bat_2': 
> 'extraBatteryStatus1', 'bat_5': 'extraBatteryStatus4', 'bat_4': 
> 'extraBatteryStatus3', 'bat_wind': 'windBatteryStatus', 't_in': 
> 'inTemp', 'link_rain': 'rainLinkStatus', 't_5': 'extraTemp4', 'h_in': 
> 'inHumidity', 'h_4': 'extraHumid3', 'h_5': 'extraHumid4', 'h_2': 
> 'extraHumid1', 'h_3': 'extraHumid2', 'h_1': 'outHumidity', 't_2': 
> 'extraTemp1', 'link_2': 'extraLinkStatus1', 'link_uv': 'uvLinkStatus', 
> 'link_wind': 'windLinkStatus', 'uv': 'UV', 'bat_uv': 'uvBatteryStatus', 
> 'link_5': 'extraLinkStatus4', 'bat_rain': 'rainBatteryStatus', 'link_3': 
> 'extraLinkStatus2', 't_3': 'extraTemp2', 'link_1': 'outLinkStatus', 
> 't_1': 'outTemp', 't_4': 'extraTemp3', 'link_4': 'extraLinkStatus3'} 
> Oct  4 02:17:08 mail2 weewx[25331]: te923: Found device on USB bus= 
> device= 
> Oct  4 02:17:08 mail2 weewx[25331]: te923: Entry read_memory 
> Oct  4 02:17:10 mail2 weewx[25331]: engine: Unable to load driver: 
> [Errno None] Opkoblingen overskred tidsgrænsen 
> Oct  4 02:17:10 mail2 weewx[25331]:    ****  Waiting 60 seconds then 
> retrying... 
>

allan,

thank you for the detailed response.

the _read method does a number of retries, and it logs each failure.  only 
after failing multiple times will it raise the exception that causes the 
'Unable to load driver' message.

you should see even more log messages if you set debug=1 in weewx.conf
 
if you have been running with debug=1, and what you posted is untouched log 
output, then please check the logging configuration for your system - 
either systemd logging or rsyslog configuration is hiding weewx log 
messages.

another possibility is that your pyusb version is raising a timeout error 
that is not a usb.USBError, so it slips through the error handling in 
_read.  in the _read method in te923.py try changing this:

            except (BadRead, BadHeader, usb.USBError), e:
                logerr("Failed attempt %d of %d to read data: %s" %
                       (cnt + 1, self.max_tries, e))

to this:

            except (BadRead, BadHeader, usb.USBError, Exception), e:
                logerr("Failed attempt %d of %d to read data: %s (%s)" %
                       (cnt + 1, self.max_tries, e, type(e)))

finally, you are using pyusb 1.0.0-11.  after you have tried the code 
change above and gotten its output, you might try reverting the code then 
installing pyusb 0.4 to see what difference that makes.

m

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to