Problem in TE923 driver with Weewx 4.0.0 on Python 3.7

182 views
Skip to first unread message

Anders Fosgerau

unread,
May 1, 2020, 7:24:28 AM5/1/20
to weewx-user
Seems like the TE923 driver is not Python3 compliant? Had version 4.0.0 running just fine with Python2. Apt based install on debian 10.

May  1 13:14:31 hjernen weewx[12927] INFO __main__: Initializing weewx version 4.0.0
May  1 13:14:31 hjernen weewx[12927] INFO __main__: Using Python 3.7.3 (default, Dec 20 2019, 18:57:59) #012[GCC 8.3.0]
May  1 13:14:31 hjernen weewx[12927] INFO __main__: Platform Linux-4.19.0-8-amd64-x86_64-with-debian-10.3
May  1 13:14:31 hjernen weewx[12927] INFO __main__: Locale is 'da_DK.UTF-8'
May  1 13:14:31 hjernen weewx[12927] INFO __main__: PID file is /var/run/weewx.pid
May  1 13:14:31 hjernen weewx[12931] INFO __main__: Using configuration file /etc/weewx/weewx.conf
May  1 13:14:31 hjernen weewx[12931] INFO weewx.engine: Loading station type TE923 (weewx.drivers.te923)
May  1 13:14:31 hjernen weewx[12916]: Starting weewx weather system: weewx.
May  1 13:14:31 hjernen weewx[12931] INFO weewx.drivers.te923: driver version is 0.40
May  1 13:14:31 hjernen weewx[12931] INFO weewx.drivers.te923: polling interval is 10
May  1 13:14:31 hjernen weewx[12931] INFO weewx.drivers.te923: sensor map is {'windLinkStatus': 'link_wind', 'windBatteryStatus': 'bat_wind', 'rainLinkStatus': 'link_rain', 'rainBatteryStatus': 'bat_rain', 'uvLinkStatus': 'link_uv', 'uvBatteryStatus': 'bat_uv', 'inTemp': 't_in', 'inHumidity': 'h_in', 'outTemp': 't_1', 'outHumidity': 'h_1', 'outTempBatteryStatus': 'bat_1', 'outLinkStatus': 'link_1', 'extraTemp1': 't_2', 'extraHumid1': 'h_2', 'extraBatteryStatus1': 'bat_2', 'extraLinkStatus1': 'link_2', 'extraTemp2': 't_3', 'extraHumid2': 'h_3', 'extraBatteryStatus2': 'bat_3', 'extraLinkStatus2': 'link_3', 'extraTemp3': 't_4', 'extraHumid3': 'h_4', 'extraBatteryStatus3': 'bat_4', 'extraLinkStatus3': 'link_4', 'extraTemp4': 't_5', 'extraHumid4': 'h_5', 'extraBatteryStatus4': 'bat_5', 'extraLinkStatus4': 'link_5'}
May  1 13:14:31 hjernen weewx[12931] INFO weewx.drivers.te923: Found device on USB bus= device=
May  1 13:14:31 hjernen weewx[12931] ERROR weewx.engine: Import of driver failed: unsupported operand type(s) for ^: 'int' and 'float' (<class 'TypeError'>)
May  1 13:14:31 hjernen weewx[12931] CRITICAL weewx.engine:     ****  Traceback (most recent call last):
May  1 13:14:31 hjernen weewx[12931] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/weewx/engine.py", line 103, in setupStation
May  1 13:14:31 hjernen weewx[12931] CRITICAL weewx.engine:     ****      self.console = loader_function(config_dict, self)
May  1 13:14:31 hjernen weewx[12931] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/weewx/drivers/te923.py", line 456, in loader
May  1 13:14:31 hjernen weewx[12931] CRITICAL weewx.engine:     ****      return TE923Driver(**config_dict[DRIVER_NAME])
May  1 13:14:31 hjernen weewx[12931] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/weewx/drivers/te923.py", line 1137, in __init__
May  1 13:14:31 hjernen weewx[12931] CRITICAL weewx.engine:     ****      self.station.open()
May  1 13:14:31 hjernen weewx[12931] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/weewx/drivers/te923.py", line 1557, in open
May  1 13:14:31 hjernen weewx[12931] CRITICAL weewx.engine:     ****      self.read_memory_size()
May  1 13:14:31 hjernen weewx[12931] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/weewx/drivers/te923.py", line 1752, in read_memory_size
May  1 13:14:31 hjernen weewx[12931] CRITICAL weewx.engine:     ****      buf = self._read(0xfc)
May  1 13:14:31 hjernen weewx[12931] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/weewx/drivers/te923.py", line 1722, in _read
May  1 13:14:31 hjernen weewx[12931] CRITICAL weewx.engine:     ****      buf = self._raw_read(addr)
May  1 13:14:31 hjernen weewx[12931] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/weewx/drivers/te923.py", line 1582, in _raw_read
May  1 13:14:31 hjernen weewx[12931] CRITICAL weewx.engine:     ****      reqbuf[5] = (reqbuf[1] ^ reqbuf[2] ^ reqbuf[3] ^ reqbuf[4])
May  1 13:14:31 hjernen weewx[12931] CRITICAL weewx.engine:     ****  TypeError: unsupported operand type(s) for ^: 'int' and 'float'
May  1 13:14:31 hjernen weewx[12931] CRITICAL __main__: Unable to load driver: unsupported operand type(s) for ^: 'int' and 'float'
May  1 13:14:31 hjernen weewx[12931] CRITICAL __main__:     ****  Exiting...

Any hints out there before deep diving into the wonderful sea of python and weewx drivers ?

Anders 

Tom Keffer

unread,
May 1, 2020, 9:07:16 AM5/1/20
to weewx-user
Looks like we missed an integer division. Try the attached version of te923.py. It goes in /usr/share/weewx/weewx/drivers/te923.py.



--
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/1f05c160-6257-4df9-a107-68c829e9c1bc%40googlegroups.com.
te923.py

Michael

unread,
May 1, 2020, 10:06:03 AM5/1/20
to weewx-user
Hi Tom,

I have the same bug as Anders and have tried your attached version.
Unfortunately with the following result:

May  1 16:00:33 raspi01 weewx-tfa[4434] INFO __main__: Initializing weewx version 4.0.0
May  1 16:00:33 raspi01 weewx-tfa[4434] INFO __main__: Using Python 3.7.3 (default, Dec 20 2019, 18:57:59) #012[GCC 8.3.0]
May  1 16:00:33 raspi01 weewx-tfa[4434] INFO __main__: Platform Linux-4.19.75-v7+-armv7l-with-debian-10.3
May  1 16:00:33 raspi01 weewx-tfa[4434] INFO __main__: Locale is 'de_DE.UTF-8'
May  1 16:00:33 raspi01 weewx-tfa[4434] INFO __main__: PID file is /var/run/weewx-tfa.pid
May  1 16:00:33 raspi01 weewx-tfa[4438] INFO __main__: Using configuration file /home/weewx/tfa.conf
May  1 16:00:33 raspi01 weewx-tfa[4438] INFO weewx.engine: Loading station type TE923 (weewx.drivers.te923)
May  1 16:00:33 raspi01 weewx-tfa[4438] INFO weewx.drivers.te923: driver version is 0.40
May  1 16:00:33 raspi01 weewx-tfa[4438] INFO weewx.drivers.te923: polling interval is 10
May  1 16:00:33 raspi01 weewx-tfa[4438] INFO weewx.drivers.te923: sensor map is {'windLinkStatus': 'link_wind', 'windBatteryStatus': 'bat_wind', 'rainLinkStatus': 'link_rain', 'rainBatteryStatus': 'bat_rain', 'uvLinkStatus': 'link_uv', 'uvBatteryStatus': 'bat_uv', 'inTemp': 't_in', 'inHumidity': 'h_in', 'outTemp': 't_1', 'outHumidity': 'h_1', 'outTempBatteryStatus': 'bat_1', 'outLinkStatus': 'link_1', 'extraTemp1': 't_2', 'extraHumid1': 'h_2', 'extraBatteryStatus1': 'bat_2', 'extraLinkStatus1': 'link_2', 'extraTemp2': 't_3', 'extraHumid2': 'h_3', 'extraBatteryStatus2': 'bat_3', 'extraLinkStatus2': 'link_3', 'extraTemp3': 't_4', 'extraHumid3': 'h_4', 'extraBatteryStatus3': 'bat_4', 'extraLinkStatus3': 'link_4', 'extraTemp4': 't_5', 'extraHumid4': 'h_5', 'extraBatteryStatus4': 'bat_5', 'extraLinkStatus4': 'link_5'}
May  1 16:00:33 raspi01 weewx-tfa[4438] INFO weewx.drivers.te923: Found device on USB bus= device=
May  1 16:00:35 raspi01 weewx-tfa[4438] ERROR weewx.drivers.te923: Failed attempt 1 of 5 to read data: [Errno 110] Operation timed out
May  1 16:00:38 raspi01 weewx-tfa[4438] ERROR weewx.engine: Import of driver failed: unsupported operand type(s) for ^: 'int' and 'float' (<class 'TypeError'>)
May  1 16:00:38 raspi01 weewx-tfa[4438] CRITICAL weewx.engine:     ****  Traceback (most recent call last):
May  1 16:00:38 raspi01 weewx-tfa[4438] CRITICAL weewx.engine:     ****    File "/home/weewx/bin/weewx/engine.py", line 103, in setupStation
May  1 16:00:38 raspi01 weewx-tfa[4438] CRITICAL weewx.engine:     ****      self.console = loader_function(config_dict, self)
May  1 16:00:38 raspi01 weewx-tfa[4438] CRITICAL weewx.engine:     ****    File "/home/weewx/bin/weewx/drivers/te923.py", line 456, in loader
May  1 16:00:38 raspi01 weewx-tfa[4438] CRITICAL weewx.engine:     ****      return TE923Driver(**config_dict[DRIVER_NAME])
May  1 16:00:38 raspi01 weewx-tfa[4438] CRITICAL weewx.engine:     ****    File "/home/weewx/bin/weewx/drivers/te923.py", line 1137, in __init__
May  1 16:00:38 raspi01 weewx-tfa[4438] CRITICAL weewx.engine:     ****      self.station.open()
May  1 16:00:38 raspi01 weewx-tfa[4438] CRITICAL weewx.engine:     ****    File "/home/weewx/bin/weewx/drivers/te923.py", line 1557, in open
May  1 16:00:38 raspi01 weewx-tfa[4438] CRITICAL weewx.engine:     ****      self.read_memory_size()
May  1 16:00:38 raspi01 weewx-tfa[4438] CRITICAL weewx.engine:     ****    File "/home/weewx/bin/weewx/drivers/te923.py", line 1752, in read_memory_size
May  1 16:00:38 raspi01 weewx-tfa[4438] CRITICAL weewx.engine:     ****      buf = self._read(0xfc)
May  1 16:00:38 raspi01 weewx-tfa[4438] CRITICAL weewx.engine:     ****    File "/home/weewx/bin/weewx/drivers/te923.py", line 1722, in _read
May  1 16:00:38 raspi01 weewx-tfa[4438] CRITICAL weewx.engine:     ****      buf = self._raw_read(addr)
May  1 16:00:38 raspi01 weewx-tfa[4438] CRITICAL weewx.engine:     ****    File "/home/weewx/bin/weewx/drivers/te923.py", line 1622, in _raw_read
May  1 16:00:38 raspi01 weewx-tfa[4438] CRITICAL weewx.engine:     ****      reqbuf[5] = (reqbuf[1] ^ reqbuf[2] ^ reqbuf[3] ^ reqbuf[4])
May  1 16:00:38 raspi01 weewx-tfa[4438] CRITICAL weewx.engine:     ****  TypeError: unsupported operand type(s) for ^: 'int' and 'float'
May  1 16:00:38 raspi01 weewx-tfa[4438] CRITICAL __main__: Unable to load driver: unsupported operand type(s) for ^: 'int' and 'float'
May  1 16:00:38 raspi01 weewx-tfa[4438] CRITICAL __main__:     ****  Exiting...

Michael

Tom Keffer

unread,
May 1, 2020, 10:14:42 AM5/1/20
to weewx-user
Missed a few more. Try this version.

Unfortunately, this will be an iterative process.

-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.
te923.py

Michael

unread,
May 1, 2020, 10:20:38 AM5/1/20
to weewx-user
thx, but now i get this:

May  1 16:18:23 raspi01 weewx-tfa[6402] INFO __main__: Initializing weewx version 4.0.0
May  1 16:18:23 raspi01 weewx-tfa[6402] INFO __main__: Using Python 3.7.3 (default, Dec 20 2019, 18:57:59) #012[GCC 8.3.0]
May  1 16:18:23 raspi01 weewx-tfa[6402] INFO __main__: Platform Linux-4.19.75-v7+-armv7l-with-debian-10.3
May  1 16:18:23 raspi01 weewx-tfa[6402] INFO __main__: Locale is 'de_DE.UTF-8'
May  1 16:18:23 raspi01 weewx-tfa[6402] INFO __main__: PID file is /var/run/weewx-tfa.pid
May  1 16:18:23 raspi01 weewx-tfa[6406] INFO __main__: Using configuration file /home/weewx/tfa.conf
May  1 16:18:23 raspi01 weewx-tfa[6406] INFO weewx.engine: Loading station type TE923 (weewx.drivers.te923)
May  1 16:18:23 raspi01 weewx-tfa[6406] INFO weewx.drivers.te923: driver version is 0.40
May  1 16:18:23 raspi01 weewx-tfa[6406] INFO weewx.drivers.te923: polling interval is 10
May  1 16:18:23 raspi01 weewx-tfa[6406] INFO weewx.drivers.te923: sensor map is {'windLinkStatus': 'link_wind', 'windBatteryStatus': 'bat_wind', 'rainLinkStatus': 'link_rain', 'rainBatteryStatus': 'bat_rain', 'uvLinkStatus': 'link_uv', 'uvBatteryStatus': 'bat_uv', 'inTemp': 't_in', 'inHumidity': 'h_in', 'outTemp': 't_1', 'outHumidity': 'h_1', 'outTempBatteryStatus': 'bat_1', 'outLinkStatus': 'link_1', 'extraTemp1': 't_2', 'extraHumid1': 'h_2', 'extraBatteryStatus1': 'bat_2', 'extraLinkStatus1': 'link_2', 'extraTemp2': 't_3', 'extraHumid2': 'h_3', 'extraBatteryStatus2': 'bat_3', 'extraLinkStatus2': 'link_3', 'extraTemp3': 't_4', 'extraHumid3': 'h_4', 'extraBatteryStatus3': 'bat_4', 'extraLinkStatus3': 'link_4', 'extraTemp4': 't_5', 'extraHumid4': 'h_5', 'extraBatteryStatus4': 'bat_5', 'extraLinkStatus4': 'link_5'}
May  1 16:18:23 raspi01 weewx-tfa[6406] INFO weewx.drivers.te923: Found device on USB bus= device=
May  1 16:18:25 raspi01 weewx-tfa[6406] ERROR weewx.drivers.te923: Failed attempt 1 of 5 to read data: [Errno 110] Operation timed out
May  1 16:18:29 raspi01 weewx-tfa[6406] INFO weewx.drivers.te923: logger capacity 3442 records
May  1 16:18:29 raspi01 weewx-tfa[6406] ERROR weewx.engine: Import of driver failed: integer argument expected, got float (<class 'TypeError'>)
May  1 16:18:29 raspi01 weewx-tfa[6406] CRITICAL weewx.engine:     ****  Traceback (most recent call last):
May  1 16:18:29 raspi01 weewx-tfa[6406] CRITICAL weewx.engine:     ****    File "/home/weewx/bin/weewx/engine.py", line 103, in setupStation
May  1 16:18:29 raspi01 weewx-tfa[6406] CRITICAL weewx.engine:     ****      self.console = loader_function(config_dict, self)
May  1 16:18:29 raspi01 weewx-tfa[6406] CRITICAL weewx.engine:     ****    File "/home/weewx/bin/weewx/drivers/te923.py", line 456, in loader
May  1 16:18:29 raspi01 weewx-tfa[6406] CRITICAL weewx.engine:     ****      return TE923Driver(**config_dict[DRIVER_NAME])
May  1 16:18:29 raspi01 weewx-tfa[6406] CRITICAL weewx.engine:     ****    File "/home/weewx/bin/weewx/drivers/te923.py", line 1139, in __init__
May  1 16:18:29 raspi01 weewx-tfa[6406] CRITICAL weewx.engine:     ****      ts = self.station.get_date()
May  1 16:18:29 raspi01 weewx-tfa[6406] CRITICAL weewx.engine:     ****    File "/home/weewx/bin/weewx/drivers/te923.py", line 2063, in get_date
May  1 16:18:29 raspi01 weewx-tfa[6406] CRITICAL weewx.engine:     ****      ts = time.mktime((year, month, day + offset, 0, 0, 0, 0, 0, 0))
May  1 16:18:29 raspi01 weewx-tfa[6406] CRITICAL weewx.engine:     ****  TypeError: integer argument expected, got float
May  1 16:18:29 raspi01 weewx-tfa[6406] CRITICAL __main__: Unable to load driver: integer argument expected, got float
May  1 16:18:29 raspi01 weewx-tfa[6406] CRITICAL __main__:     ****  Exiting...

Michael

Tom Keffer

unread,
May 1, 2020, 10:33:00 AM5/1/20
to weewx-user
Those pesky integer divides...

I went through the driver top to bottom and I think I found them all.


--
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.
te923.py

Michael

unread,
May 1, 2020, 10:38:34 AM5/1/20
to weewx-user
;)

this version looks good. No more Errors. Thank you very much for the fast support.

Michael

Paul Bartholdi

unread,
May 1, 2020, 2:58:55 PM5/1/20
to weewx-user
I had the same problem, and this new version sovles it. THANK YOU !      Paul
(By the way, I started 60 years ago with FORTRAN I...)

Anders Fosgerau

unread,
May 1, 2020, 5:42:44 PM5/1/20
to weewx-user

That's it! Big tip o' the hat.


I guess it's well-known that the forecast extension version 3.3.2 also needs a little make-over to become python 3.7 "compliant", but with all those changes to forecasting APIs and licenses it's probably dificult times for forecasting anyway (and not an integral part of weewx).


May  1 23:25:44 hjernen weewx[1659] CRITICAL __main__:     ****      self.loadServices(config_dict)
May  1 23:25:44 hjernen weewx[1659] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 138, in loadServices
May  1 23:25:44 hjernen weewx[1659] CRITICAL __main__:     ****      obj = weeutil.weeutil.get_object(svc)(self,config_dict)
May  1 23:25:44 hjernen weewx[1659] CRITICAL __main__:     ****    File "/usr/share/weewx/weeutil/weeutil.py", line 1093, in get_object
May  1 23:25:44 hjernen weewx[1659] CRITICAL __main__:     ****      mod = __import__(module)
May  1 23:25:44 hjernen weewx[1659] CRITICAL __main__:     ****    File "/usr/share/weewx/user/forecast.py", line 567
May  1 23:25:44 hjernen weewx[1659] CRITICAL __main__:     ****      except OSError, e:
May  1 23:25:44 hjernen weewx[1659] CRITICAL __main__:     ****                    ^
May  1 23:25:44 hjernen weewx[1659] CRITICAL __main__:     ****  SyntaxError: invalid syntax
May  1 23:25:44 hjernen weewx[1659] CRITICAL __main__:     ****  Exiting.

Anders

To unsubscribe from this group and stop receiving emails from it, send an email to weewx...@googlegroups.com.

vince

unread,
May 1, 2020, 5:49:31 PM5/1/20
to weewx-user
On Friday, May 1, 2020 at 2:42:44 PM UTC-7, Anders Fosgerau wrote:

I guess it's well-known that the forecast extension version 3.3.2 also needs a little make-over to become python 3.7 "compliant", but with all those changes to forecasting APIs and licenses it's probably dificult times for forecasting anyway (and not an integral part of weewx).



Do a little searching of the google group.  This has come up many times in the last few months among the 4.0 beta testers.

There are some unofficial forks of Matthew's extension that work fine under python3.    

Tom Keffer

unread,
May 1, 2020, 6:08:04 PM5/1/20
to weewx-user
On Fri, May 1, 2020 at 11:58 AM Paul Bartholdi <paul.ba...@gmail.com> wrote:
I had the same problem, and this new version sovles it. THANK YOU !      Paul
(By the way, I started 60 years ago with FORTRAN I...)

OK. You win!

Andrea

unread,
May 3, 2020, 9:30:37 AM5/3/20
to weewx-user
Hello Tom,
I downloaded the latest 4.0 version and I have TE923 driver in use. Did you update the released version with the patched driver or I have to get the correct TE923 driver here?
Thanks


Il giorno sabato 2 maggio 2020 00:08:04 UTC+2, Tom Keffer ha scritto:

Tom Keffer

unread,
May 3, 2020, 9:35:32 AM5/3/20
to weewx-user
The patched driver is only available on the GitHub repository.



--
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.

Andrea

unread,
May 3, 2020, 10:17:50 AM5/3/20
to weewx-user
ok thanks


Il giorno domenica 3 maggio 2020 15:35:32 UTC+2, Tom Keffer ha scritto:
The patched driver is only available on the GitHub repository.



On Sun, May 3, 2020 at 6:30 AM Andrea <anicol...@gmail.com> wrote:
Hello Tom,
I downloaded the latest 4.0 version and I have TE923 driver in use. Did you update the released version with the patched driver or I have to get the correct TE923 driver here?
Thanks


Il giorno sabato 2 maggio 2020 00:08:04 UTC+2, Tom Keffer ha scritto:
On Fri, May 1, 2020 at 11:58 AM Paul Bartholdi <paul.b...@gmail.com> wrote:
I had the same problem, and this new version sovles it. THANK YOU !      Paul
(By the way, I started 60 years ago with FORTRAN I...)

OK. You win!

--
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...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages