WS23xx error when trying to set interval

137 views
Skip to first unread message

Devonian

unread,
Sep 6, 2020, 11:13:46 AM9/6/20
to weewx-user
I have setup a clean install (setup.py) in Debian Buster on a R-Pi as per this
and when trying to:
./wee_device --set-interval=5

I get this:

Using configuration file /home/weewx/weewx.conf
Using WS23xx driver version 0.41 (weewx.drivers.ws23xx)
Changing the interval will clear the station memory.
Interval is 60
Set interval to 5 minutes (y/n)? y

Traceback (most recent call last):
  File "./wee_device", line 78, in <module>
    main()
  File "./wee_device", line 74, in main
    device.configure(config_dict)
  File "/home/weewx/bin/weewx/drivers/__init__.py", line 67, in configure
    self.do_options(options, parser, config_dict, not options.noprompt)
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 316, in do_options
    self.set_interval(options.interval, prompt)
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 378, in set_interval
    self.station.setArchiveInterval(interval)
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 540, in setArchiveInterval
    self.station.set_archive_interval(interval)
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 686, in set_archive_interval
    self.ws.write_safe(m.address, *cmd[1:])
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 1115, in write_safe
    command_data = self.write_data(nybble_address,nybbles,encode_constant)
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 1099, in write_data
    self.write_byte(encoded_data[i])
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 1012, in write_byte
    self.log("%02x" % ord(data))
TypeError: ord() expected string of length 1, but int found

In fact, trying to use any wee_device command throws an error.

Weewx does run and produces data/graphs, but I want 5 min intervals.

Nigel

Tom Keffer

unread,
Sep 6, 2020, 11:38:02 AM9/6/20
to weewx-user
Looks like you found a bug when running under Python 3. Try this version of ws23xx.py.

-tk

--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/77c0d927-a9a0-4bc9-b668-efd285b917e8n%40googlegroups.com.
ws23xx.py

Devonian

unread,
Sep 6, 2020, 1:56:22 PM9/6/20
to weewx-user
Hi Tom,

Thanks, but...

root@raspberrypi:/home/weewx/bin# ./wee_device --set-interval=5
    self.log("%02x" % six.byte2int(data))
TypeError: 'int' object is not subscriptable

---------------------------------------------------------------------------------------------------------------------------

root@raspberrypi:/home/weewx/bin# ./wee_device --info
Using configuration file /home/weewx/weewx.conf
Using WS23xx driver version 0.41 (weewx.drivers.ws23xx)
Querying the station for the configuration...
Traceback (most recent call last):
  File "./wee_device", line 78, in <module>
    main()
  File "./wee_device", line 74, in main
    device.configure(config_dict)
  File "/home/weewx/bin/weewx/drivers/__init__.py", line 67, in configure
    self.do_options(options, parser, config_dict, not options.noprompt)
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 320, in do_options
    self.show_info()
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 326, in show_info
    config = self.station.getConfig()
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 548, in getConfig
    data = self.station.get_raw_data(list(Measure.IDS.keys()))
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 791, in get_raw_data
    data_dict = dict(list(zip(labels, [m.conv.binary2value(d) for m, d in zip(measures, raw_data)])))
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 791, in <listcomp>
    data_dict = dict(list(zip(labels, [m.conv.binary2value(d) for m, d in zip(measures, raw_data)])))
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 1489, in binary2value
    0)) - time.timezone
OverflowError: mktime argument out of range

---------------------------------------------------------------------------------------------------------------------------  

root@raspberrypi:/home/weewx/bin# ./wee_device --clear-memory
Using configuration file /home/weewx/weewx.conf
Using WS23xx driver version 0.41 (weewx.drivers.ws23xx)
Records in memory: 4
Clear console memory (y/n)? y
Traceback (most recent call last):
  File "./wee_device", line 78, in <module>
    main()
  File "./wee_device", line 74, in main
    device.configure(config_dict)
  File "/home/weewx/bin/weewx/drivers/__init__.py", line 67, in configure
    self.do_options(options, parser, config_dict, not options.noprompt)
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 318, in do_options
    self.clear_history(prompt)
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 395, in clear_history
    self.station.clearHistory()
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 565, in clearHistory
    self.station.clear_memory()
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 701, in clear_memory
    self.ws.write_safe(m.address, *cmd[1:])
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 1115, in write_safe
    command_data = self.write_data(nybble_address,nybbles,encode_constant)
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 1099, in write_data
    self.write_byte(encoded_data[i])
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 1012, in write_byte
    self.log("%02x" % six.byte2int(data))
TypeError: 'int' object is not subscriptable

Sorry for the pain !

Nigel



Devonian

unread,
Sep 6, 2020, 1:58:20 PM9/6/20
to weewx-user
ooops, ignore the first couple of lines above, copy/paste error

Nigel

Devonian

unread,
Sep 6, 2020, 2:00:51 PM9/6/20
to weewx-user
humpf - I don't like this new fangle google group on-line...

Should be

Nigel

Tom Keffer

unread,
Sep 7, 2020, 7:40:04 PM9/7/20
to weewx-user
Let's try that again. How about this version?



ws23xx.py

Nigel Head

unread,
Sep 8, 2020, 3:43:19 AM9/8/20
to weewx...@googlegroups.com
Hi Tom,

Sorry, still erroring...

root@raspberrypi:/home/weewx/bin# ./wee_device --set-interval=5
Using configuration file /home/weewx/weewx.conf
Using WS23xx driver version 0.41 (weewx.drivers.ws23xx)
Changing the interval will clear the station memory.
Interval is 60
Set interval to 5 minutes (y/n)? y
Traceback (most recent call last):
  File "./wee_device", line 78, in <module>
    main()
  File "./wee_device", line 74, in main
    device.configure(config_dict)
  File "/home/weewx/bin/weewx/drivers/__init__.py", line 67, in configure
    self.do_options(options, parser, config_dict, not options.noprompt)
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 316, in do_options
    self.set_interval(options.interval, prompt)
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 378, in set_interval
    self.station.setArchiveInterval(interval)
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 540, in setArchiveInterva                                      l
    self.station.set_archive_interval(interval)
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 686, in set_archive_inter                                      val
    self.ws.write_safe(m.address, *cmd[1:])
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 1120, in write_safe
    command_data = self.write_data(nybble_address,nybbles,encode_constant)
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 1104, in write_data
    self.write_byte([encoded_data[i]])
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 1017, in write_byte
    self.log("%02x" % ord(data))
TypeError: ord() expected string of length 1, but list found

Nigel

You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/_eXfjstpDyM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/CAPq0zEBdwX5A5MhbDRYhQ8MVkU8UxHC4Ug3ghUUJ3nY0x-OJ6A%40mail.gmail.com.

Tom Keffer

unread,
Sep 8, 2020, 11:03:21 AM9/8/20
to weewx-user
We will eventually get there. This is typical of remote debugging!

Try this version.

-tk

ws23xx.py

Nigel Head

unread,
Sep 8, 2020, 1:33:19 PM9/8/20
to weewx...@googlegroups.com
Hi Tom,

Very close now (good enough for me) as I'm preparing to upgrade from 3.9.2 to 4.x and just testing on a test rig before committing ;-)

./wee_device --set-interval=5 (works, but did take maybe 20+ seconds before it gave me the chance to hit 'y' to confirm on first attempt) - 2nd time of running the command, it fires off in a second or two.

./wee_device --clear-memory (works fine after first run with command above)

BUT (I'm not too concerned with this one, but for completeness).

root@raspberrypi:/home/weewx/bin# ./wee_device --info
Using configuration file /home/weewx/weewx.conf
Using WS23xx driver version 0.41 (weewx.drivers.ws23xx)
Querying the station for the configuration...
Traceback (most recent call last):
  File "./wee_device", line 78, in <module>
    main()
  File "./wee_device", line 74, in main
    device.configure(config_dict)
  File "/home/weewx/bin/weewx/drivers/__init__.py", line 67, in configure
    self.do_options(options, parser, config_dict, not options.noprompt)
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 320, in do_options
    self.show_info()
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 326, in show_info
    config = self.station.getConfig()
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 548, in getConfig
    data = self.station.get_raw_data(list(Measure.IDS.keys()))
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 791, in get_raw_data
    data_dict = dict(list(zip(labels, [m.conv.binary2value(d) for m, d in zip(measures, raw_data)])))
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 791, in <listcomp>
    data_dict = dict(list(zip(labels, [m.conv.binary2value(d) for m, d in zip(measures, raw_data)])))
  File "/home/weewx/bin/weewx/drivers/ws23xx.py", line 1494, in binary2value

    0)) - time.timezone
OverflowError: mktime argument out of range
Reply all
Reply to author
Forward
0 new messages