Thanks for spotting that, device_list is a list of dicts so line 3928 was
never going to work. I am surprised it has not shown up previously, though
it is buried in some code that is seldom used. You almost have the fix
correct, but '%s' should be '%s:%d' to give the *IP address:port number*
format. There are also a couple of other changes further down from line
3298 that will also need to be made. I should have an update in the next
few days; the rediscovery code is complex and I want to make sure sure it
is functioning properly (now) - testing of the rediscovery code is time
consuming.
In the meantime, are you operating your device with a fixed IP allocation?
If possible that is the recommended way to use the GW1x00 devices with the
GW1000 driver.
Gary
On Wednesday, 16 March 2022 at 04:42:02 UTC+10 Dr__Bob wrote:
> Hi. From time to time, it seems like my GW1000 disappears. It looks like
> the code is trying to rediscover it, but in the process hits a bug in the
> code and crashes. This is with weewx 4.5.1 with python 3.7.3 and GW1000
> 0.41. The syslog looks like:
>
> Mar 15 04:14:45 raspberrypi weewx[1374] ERROR user.gw1000: Failed to
> obtain response to command 'CMD_READ_SENSOR_ID_NEW' after 3 attempts
>
> Mar 15 04:14:45 raspberrypi weewx[1374] INFO user.gw1000: Attempting to
> re-discover GW1000...
>
> Mar 15 04:15:05 raspberrypi weewx[1374] CRITICAL user.gw1000: ****
> Traceback (most recent call last):
>
> Mar 15 04:15:05 raspberrypi weewx[1374] CRITICAL user.gw1000: ****
> File "/usr/share/weewx/user/gw1000.py", line 3587, in get_sensor_id
>
> Mar 15 04:15:05 raspberrypi weewx[1374] CRITICAL user.gw1000: ****
> return self.send_cmd_with_retries('CMD_READ_SENSOR_ID_NEW')
>
> Mar 15 04:15:05 raspberrypi weewx[1374] CRITICAL user.gw1000: ****
> File "/usr/share/weewx/user/gw1000.py", line 3740, in send_cmd_with_retries
>
> Mar 15 04:15:05 raspberrypi weewx[1374] CRITICAL user.gw1000: ****
> raise GW1000IOError(_msg)
>
> Mar 15 04:15:05 raspberrypi weewx[1374] CRITICAL user.gw1000: ****
> user.gw1000.GW1000IOError: Failed to obtain response to command
> 'CMD_READ_SENSOR_ID_NEW' after 3 attempts
>
> Mar 15 04:15:05 raspberrypi weewx[1374] CRITICAL user.gw1000: ****
>
> Mar 15 04:15:05 raspberrypi weewx[1374] CRITICAL user.gw1000: ****
> During handling of the above exception, another exception occurred:
>
> Mar 15 04:15:05 raspberrypi weewx[1374] CRITICAL user.gw1000: ****
>
> Mar 15 04:15:05 raspberrypi weewx[1374] CRITICAL user.gw1000: ****
> Traceback (most recent call last):
>
> Mar 15 04:15:05 raspberrypi weewx[1374] CRITICAL user.gw1000: ****
> File "/usr/share/weewx/user/gw1000.py", line 3024, in run
>
> Mar 15 04:15:05 raspberrypi weewx[1374] CRITICAL user.gw1000: ****
> self.client.collect_sensor_data()
>
> Mar 15 04:15:05 raspberrypi weewx[1374] CRITICAL user.gw1000: ****
> File "/usr/share/weewx/user/gw1000.py", line 2476, in collect_sensor_data
>
> Mar 15 04:15:05 raspberrypi weewx[1374] CRITICAL user.gw1000: ****
> queue_data = self.get_live_sensor_data()
>
> Mar 15 04:15:05 raspberrypi weewx[1374] CRITICAL user.gw1000: ****
> File "/usr/share/weewx/user/gw1000.py", line 2525, in get_live_sensor_data
>
> Mar 15 04:15:05 raspberrypi weewx[1374] CRITICAL user.gw1000: ****
> self.update_sensor_id_data()
>
> Mar 15 04:15:05 raspberrypi weewx[1374] CRITICAL user.gw1000: ****
> File "/usr/share/weewx/user/gw1000.py", line 2538, in update_sensor_id_data
>
> Mar 15 04:15:05 raspberrypi weewx[1374] CRITICAL user.gw1000: ****
> sensor_id_data = self.station.get_sensor_id()
>
> Mar 15 04:15:05 raspberrypi weewx[1374] CRITICAL user.gw1000: ****
> File "/usr/share/weewx/user/gw1000.py", line 3591, in get_sensor_id
>
> Mar 15 04:15:05 raspberrypi weewx[1374] CRITICAL user.gw1000: ****
> if not self.rediscover():
>
> Mar 15 04:15:05 raspberrypi weewx[1374] CRITICAL user.gw1000: ****
> File "/usr/share/weewx/user/gw1000.py", line 3928, in rediscover
>
> Mar 15 04:15:05 raspberrypi weewx[1374] CRITICAL user.gw1000: ****
> gw1000_str = ', '.join([':'.join(['%s:%d' % b]) for b in device_list])
>
> Mar 15 04:15:05 raspberrypi weewx[1374] CRITICAL user.gw1000: ****
> File "/usr/share/weewx/user/gw1000.py", line 3928, in <listcomp>
>
> Mar 15 04:15:05 raspberrypi weewx[1374] CRITICAL user.gw1000: ****
> gw1000_str = ', '.join([':'.join(['%s:%d' % b]) for b in device_list])
>
> Mar 15 04:15:05 raspberrypi weewx[1374] CRITICAL user.gw1000: ****
> TypeError: not enough arguments for format string
>
> I *think* the bug is on line 3928 in rediscover(self):
>
> gw1000_str = ', '.join([':'.join(['%s:%d' % b]) for b in device_list])
>
> This looks like a copy of the similar line further up in the code where
> the GW1000 is first discovered. I'm a complete python newbie, but it looks
> like the second join in the above line wants two fields but is only getting
> one. Shouldn't it be ".join(['%s' % (b['ip_address'],b['port'])])"?
> That's the way the first version of gw1000_str is formed.
>
> Cheers,
>
> Bob Clare
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/weewx-user/7e9a2bc0-7524-4b93-a5c0-7329c1230751n%40googlegroups.com.