Trouble with Vaisala driver - syslog not defined

148 views
Skip to first unread message

Chris Howard

unread,
Aug 11, 2020, 9:59:51 PM8/11/20
to weewx-user

I am attempting to install on a BeagleBone Black Wireless.
My device is a Vaisala wxt520.  I have installed a driver from github.

BeagleBone ubuntu is based on Debian 9 so I am running python2.

I'm not afraid to edit files, but not sure if this driver should run on my system
and maybe I just missing something dumb in the install.

I did try a small sample python program to see if I could successfully import syslog
and send a message to syslog.  That seemed to work fine.

Here is my error message:
Aug 12 01:34:33 beaglebone weewx[2348]: Stopping weewx weather system: weewx not running....
Aug 12 01:34:40 beaglebone weewx[2400] INFO __main__: Initializing weewx version 4.1.1
Aug 12 01:34:40 beaglebone weewx[2400] INFO __main__: Using Python 2.7.13 (default, Sep 26 2018, 18:42:22) #012[GCC 6.3.0 20170516]
Aug 12 01:34:40 beaglebone weewx[2400] INFO __main__: Platform Linux-4.14.71-ti-r80-armv7l-with-debian-9.5
Aug 12 01:34:40 beaglebone weewx[2400] INFO __main__: Locale is 'en_US.UTF-8'
Aug 12 01:34:40 beaglebone weewx[2400] INFO __main__: PID file is /var/run/weewx.pid
Aug 12 01:34:40 beaglebone weewx[2389]: Starting weewx weather system: weewx.
Aug 12 01:34:40 beaglebone weewx[2404] INFO __main__: Using configuration file /etc/weewx/weewx.conf
Aug 12 01:34:40 beaglebone weewx[2404] INFO __main__: Debug is 0
Aug 12 01:34:41 beaglebone weewx[2404] INFO weewx.engine: Loading station type WXT5x0 (user.wxt5x0)
Aug 12 01:34:41 beaglebone weewx[2404] ERROR weewx.engine: Import of driver failed: global name 'syslog' is not defined (<type 'exceptions.NameError'>)
Aug 12 01:34:41 beaglebone weewx[2404] CRITICAL weewx.engine:     ****  Traceback (most recent call last):
Aug 12 01:34:41 beaglebone weewx[2404] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/weewx/engine.py", line 103, in setupStation
Aug 12 01:34:41 beaglebone weewx[2404] CRITICAL weewx.engine:     ****      self.console = loader_function(config_dict, self)
Aug 12 01:34:41 beaglebone weewx[2404] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/user/wxt5x0.py", line 109, in loader
Aug 12 01:34:41 beaglebone weewx[2404] CRITICAL weewx.engine:     ****      return WXT5x0Driver(**config_dict[DRIVER_NAME])
Aug 12 01:34:41 beaglebone weewx[2404] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/user/wxt5x0.py", line 470, in __init__
Aug 12 01:34:41 beaglebone weewx[2404] CRITICAL weewx.engine:     ****      loginf('driver version is %s' % DRIVER_VERSION)
Aug 12 01:34:41 beaglebone weewx[2404] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/user/wxt5x0.py", line 122, in loginf
Aug 12 01:34:41 beaglebone weewx[2404] CRITICAL weewx.engine:     ****      logmsg(syslog.LOG_INFO, msg)
Aug 12 01:34:41 beaglebone weewx[2404] CRITICAL weewx.engine:     ****  NameError: global name 'syslog' is not defined
Aug 12 01:34:41 beaglebone weewx[2404] CRITICAL __main__: Unable to load driver: global name 'syslog' is not defined
Aug 12 01:34:41 beaglebone weewx[2404] CRITICAL __main__:     ****  Exiting...


Tom Keffer

unread,
Aug 12, 2020, 9:04:08 AM8/12/20
to weewx-user
It looks like the driver was not properly ported to WeeWX V4. There is still some old V3 cod in there. Try filing an issue request with the author.

-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/48c3ed56-d160-4952-a0ac-265d98a7be20o%40googlegroups.com.

Chris Howard

unread,
Aug 13, 2020, 10:11:03 PM8/13/20
to weewx-user
The driver author is Matthew Wall.  His github site was pretty active until June and then it has gone quiet.
With the state of the world these days, it's hard to know what that means.  I hope the guy is healthy
and lounging on a beach somewhere.

Until his return, is there a document or someone who can help me sort out the 3v-4v differences?

 

Glenn McKechnie

unread,
Aug 13, 2020, 11:10:41 PM8/13/20
to weewx...@googlegroups.com
Using https://github.com/matthewwall/weewx-wxt5x0/blob/master/bin/user/wxt5x0.py

In the absence of Mathews expertise, try the attached copy of that
original file.
Save yours, replace it with the attached wxt5x0-trimmed.py file (yes, rename it)
Restart weewx.


I'm no expert, so fingers crossed ;-)


It removes the duplicate syslog code between lines 114 and 126
It also imports the threading module to satisfy pyflakes.

ie:-
01:04 PM $ diff -u2r wxt5x0.py wxt5x0-trimmed.py
--- wxt5x0.py 2020-08-14 13:00:54.026076071 +1000
+++ wxt5x0-trimmed.py 2020-08-14 12:50:56.169586563 +1000
@@ -78,4 +78,5 @@
# Old-style weewx logging
import syslog
+ import threading

def logmsg(level, msg):
@@ -112,18 +113,4 @@
return WXT5x0ConfigurationEditor()

-
-def logmsg(level, msg):
- syslog.syslog(level, 'wxt5x0: %s' % msg)
-
-def logdbg(msg):
- logmsg(syslog.LOG_DEBUG, msg)
-
-def loginf(msg):
- logmsg(syslog.LOG_INFO, msg)
-
-def logerr(msg):
- logmsg(syslog.LOG_ERR, msg)
-
-
def _fmt(x):
"""
@@ -491,5 +478,5 @@
def hardware_name(self):
return self._model
-
+
def genLoopPackets(self):
while True:
> --
> 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/2dbdebb0-3fb8-458c-a2ad-17ae19931a5do%40googlegroups.com.
>


--


Cheers
Glenn

rorpi - read only raspberry pi & various weewx addons
https://github.com/glennmckechnie
wxt5x0-trimmed.py

gjr80

unread,
Aug 13, 2020, 11:48:12 PM8/13/20
to weewx-user
Glenn,

I think you will find the threading reference in the wxt5x0 driver is an incomplete cut and paste when Matthew was updating the wxt5x0 driver logging code with that from the sdr driver. You can drop the threading import and change:

    def logmsg(level, msg):
        syslog
.syslog(level, 'sdr: %s: %s' %
                     
(threading.currentThread().getName(), msg))

to

    def logmsg(level, msg):
        syslog
.syslog(level, 'wxt5x0: %s' % (msg,))

Gary

Glenn McKechnie

unread,
Aug 14, 2020, 12:52:56 AM8/14/20
to weewx...@googlegroups.com
Ah. Thanks Gary, that makes more sense.

@Chris
Gary's correction has been applied to this attachment wxt5x0-trimmed2.py
and has the following diff...

02:49 PM $ diff -u2r wxt5x0.py wxt5x0-trimmed2.py
--- wxt5x0.py 2020-08-14 13:00:54.026076071 +1000
+++ wxt5x0-trimmed2.py 2020-08-14 14:46:56.535608367 +1000
@@ -80,6 +80,5 @@

def logmsg(level, msg):
- syslog.syslog(level, 'sdr: %s: %s' %
- (threading.currentThread().getName(), msg))
+ syslog.syslog(level, 'wxt5x0: %s' % (msg,))

def logdbg(msg):
@@ -112,18 +111,4 @@
return WXT5x0ConfigurationEditor()

-
-def logmsg(level, msg):
- syslog.syslog(level, 'wxt5x0: %s' % msg)
-
-def logdbg(msg):
- logmsg(syslog.LOG_DEBUG, msg)
-
-def loginf(msg):
- logmsg(syslog.LOG_INFO, msg)
-
-def logerr(msg):
- logmsg(syslog.LOG_ERR, msg)
-
-
def _fmt(x):
"""
@@ -491,5 +476,5 @@
def hardware_name(self):
return self._model
-
+
def genLoopPackets(self):
while True:



On 14/08/2020, gjr80 <gjrod...@gmail.com> wrote:
> Glenn,
>
> I think you will find the threading reference in the wxt5x0 driver is an
> incomplete cut and paste when Matthew was updating the wxt5x0 driver
> logging code with that from the sdr driver. You can drop the threading
> import and change:
>
> def logmsg(level, msg):
> syslog.syslog(level, 'sdr: %s: %s' %
> (threading.currentThread().getName(), msg))
>
> to
>
> def logmsg(level, msg):
> syslog.syslog(level, 'wxt5x0: %s' % (msg,))
>
> Gary



wxt5x0-trimmed2.py

Chris Howard

unread,
Aug 17, 2020, 7:13:21 AM8/17/20
to weewx-user

Thanks!
That got the driver running.

I have another hurdle.
I am seeing data from the device but it is in NMEA format.
The driver is set up for serial format.  So my data is not being parsed.
 
I see a command/method defined which would
put it in serial mode as a side effect:   set_automatic_mode()
but I don't see that method being called anywhere.
(there is also set_polled_mode() but it has an error and I also don't see it being used either.)

I can mangle this up myself... but I thought I should ask: is
it generally considered kosher to do a re-config on the hardware when
weewx starts up?  Or does the user have to sort that out
himself using whatever config tools available to him?

Erik Finskas

unread,
Oct 12, 2020, 5:36:51 AM10/12/20
to weewx-user
Hi all.

Followed up this thread to fix the WXT5x0 driver from GitHub and got bit forward but got jammed to another issue, apparently something to do with python3 (?)
Running Ubuntu server 20.04.1 LTS

Startup log looks like this;
Oct 12 12:30:51 PusulaServer systemd[1]: Starting LSB: weewx weather system...
Oct 12 12:30:51 PusulaServer weewx[4672]:  * Starting weewx weather system weewx
Oct 12 12:30:51 PusulaServer weewx[4684] INFO __main__: Initializing weewx version 4.1.1
Oct 12 12:30:51 PusulaServer weewx[4684] INFO __main__: Using Python 3.8.5 (default, Jul 28 2020, 12:59:40) #012[GCC 9.3.0]
Oct 12 12:30:51 PusulaServer weewx[4684] INFO __main__: Platform Linux-5.4.0-48-generic-x86_64-with-glibc2.29
Oct 12 12:30:51 PusulaServer weewx[4684] INFO __main__: Locale is 'en_US.UTF-8'
Oct 12 12:30:51 PusulaServer weewx[4684] INFO __main__: PID file is /var/run/weewx.pid
Oct 12 12:30:51 PusulaServer weewx[4687] INFO __main__: Using configuration file /etc/weewx/weewx.conf
Oct 12 12:30:51 PusulaServer weewx[4687] INFO __main__: Debug is 0
Oct 12 12:30:51 PusulaServer weewx[4687] INFO weewx.engine: Loading station type WXT5x0 (user.wxt5x0)
Oct 12 12:30:51 PusulaServer weewx[4672]:    ...done.
Oct 12 12:30:51 PusulaServer systemd[1]: Started LSB: weewx weather system.
Oct 12 12:30:51 PusulaServer weewx[4687] INFO user.wxt5x0: driver version is 0.5
...
Oct 12 12:30:51 PusulaServer weewx[4687] INFO weewx.engine: Starting main packet loop.
Oct 12 12:30:51 PusulaServer weewx[4687] INFO weewx.engine: Main loop exiting. Shutting engine down.
Oct 12 12:30:51 PusulaServer weewx[4687] CRITICAL __main__: Caught unrecoverable exception:
Oct 12 12:30:51 PusulaServer weewx[4687] CRITICAL __main__:     ****  unicode strings are not supported, please encode to bytes: '0R0\r\n'
Oct 12 12:30:51 PusulaServer weewx[4687] CRITICAL __main__:     ****  Traceback (most recent call last):
Oct 12 12:30:51 PusulaServer weewx[4687] CRITICAL __main__:     ****    File "/usr/share/weewx/weewxd", line 154, in main
Oct 12 12:30:51 PusulaServer weewx[4687] CRITICAL __main__:     ****      engine.run()
Oct 12 12:30:51 PusulaServer weewx[4687] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 188, in run
Oct 12 12:30:51 PusulaServer weewx[4687] CRITICAL __main__:     ****      for packet in self.console.genLoopPackets():
Oct 12 12:30:51 PusulaServer weewx[4687] CRITICAL __main__:     ****    File "/usr/share/weewx/user/wxt5x0.py", line 483, in genLoopPackets
Oct 12 12:30:51 PusulaServer weewx[4687] CRITICAL __main__:     ****      raw = self._station.get_composite()
Oct 12 12:30:51 PusulaServer weewx[4687] CRITICAL __main__:     ****    File "/usr/share/weewx/user/wxt5x0.py", line 202, in get_composite
Oct 12 12:30:51 PusulaServer weewx[4687] CRITICAL __main__:     ****      return self.get_data('R0')
Oct 12 12:30:51 PusulaServer weewx[4687] CRITICAL __main__:     ****    File "/usr/share/weewx/user/wxt5x0.py", line 155, in get_data
Oct 12 12:30:51 PusulaServer weewx[4687] CRITICAL __main__:     ****      self.send_cmd(cmd)
Oct 12 12:30:51 PusulaServer weewx[4687] CRITICAL __main__:     ****    File "/usr/share/weewx/user/wxt5x0.py", line 149, in send_cmd
Oct 12 12:30:51 PusulaServer weewx[4687] CRITICAL __main__:     ****      self.device.write(cmd)
Oct 12 12:30:51 PusulaServer weewx[4687] CRITICAL __main__:     ****    File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 532, in write
Oct 12 12:30:51 PusulaServer weewx[4687] CRITICAL __main__:     ****      d = to_bytes(data)
Oct 12 12:30:51 PusulaServer weewx[4687] CRITICAL __main__:     ****    File "/usr/lib/python3/dist-packages/serial/serialutil.py", line 63, in to_bytes
Oct 12 12:30:51 PusulaServer weewx[4687] CRITICAL __main__:     ****      raise TypeError('unicode strings are not supported, please encode to bytes: {!r}'.format(seq))
Oct 12 12:30:51 PusulaServer weewx[4687] CRITICAL __main__:     ****  TypeError: unicode strings are not supported, please encode to bytes: '0R0\r\n'
Oct 12 12:30:51 PusulaServer weewx[4687] CRITICAL __main__:     ****  Exiting.

Any clues how to get forward? The system works OK with the simulation driver so this might be still to do with the WXT5x0 driver.

..
Erik

Tom Keffer

unread,
Oct 12, 2020, 9:02:18 AM10/12/20
to weewx-user
It's definitely the driver. It looks like Matthew never finished the port to Python 3.

--
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/fdd27793-8376-40cd-90f0-5cc327cdd307n%40googlegroups.com.

Tom Keffer

unread,
Oct 12, 2020, 9:57:03 AM10/12/20
to weewx-user
Try this version of wxt5x0.py


wxt5x0.py

Erik Finskas

unread,
Oct 13, 2020, 5:47:08 AM10/13/20
to weewx...@googlegroups.com
Thanks Tom, that driver seems to work OK.

Though now I faced another issue, it looks like the WXT510 is emitting NMEA strings which the driver is not capable of yet ;(

Oct 13 12:38:49 PusulaServer weewx[1561] DEBUG user.wxt5x0-python3: raw: 24 57 49 58 44 52 2C 41 2C 32 34 32 2C 44 2C 31 2C 41 2C 32 39 33 2C 44 2C 32 2C 53 2C 33 2E 30 2C 53 2C
 31 2C 53 2C 35 2E 32 2C 53 2C 32 2C 43 2C 34 38 2E 39 2C 46 2C 30 2C 48 2C 37 39 2E 37 2C 50 2C 30 2C 50 2C 32 39 2E 37 37 2C 49 2C 30 2C 56 2C 34 2E 30 31 30 2C 49 2C 30 2C 5A
 2C 31 34 36 30 38 2C 73 2C 30 2C 52 2C 30 2E 30 30 2C 49 2C 30 2C 56 2C 30 2C 49 2C 31 2C 5A 2C 30 2C 73 2C 31 2C 52 2C 30 2C 49 2C 31 2C 52 2C 32 2E 37 37 2C 49 2C 32 2C 52 2C
 30 2C 49 2C 33 2C 43 2C 34 38 2E 35 2C 46 2C 32 2C 55 2C 31 33 2E 30 2C 4E 2C 30 2C 55 2C 31 33 2E 35 2C 56 2C 31 2C 55 2C 33 2E 35 32 33 2C 56 2C 32 2A 37 33 0D 0A
Oct 13 12:38:49 PusulaServer weewx[1561] DEBUG user.wxt5x0-python3: parsed: {}
Oct 13 12:38:49 PusulaServer weewx[1561] DEBUG user.wxt5x0-python3: mapped: {}

The hex string decodes to an apparent NMEA message of $WIXDR,A,247,D,1,A,295,D,2,S,3.7,S,1,S,6.5,S,2,C,48.9,F,0,H,79.5,P,0,P,29.77,I,0,V,4.010,I,0,Z,14608,s,0,R,0.00,I,0,V,0,I,1,Z,0,s,1,R,0,I,1,R,2.77,I,2,R,0,I,3,C,48.2,F,2,U,13.9,N,0,U,13.5,V,1,U,3.525,V,2*79

When reconfiguring weewx for NMEA, I get this;
Oct 13 12:39:50 PusulaServer weewx[1691] ERROR weewx.engine: Import of driver failed: NMEA support not implemented (<class 'NotImplementedError'>)
Oct 13 12:39:50 PusulaServer weewx[1691] CRITICAL weewx.engine:     ****  Traceback (most recent call last):
Oct 13 12:39:50 PusulaServer weewx[1691] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/weewx/engine.py", line 103, in setupStation
Oct 13 12:39:50 PusulaServer weewx[1691] CRITICAL weewx.engine:     ****      self.console = loader_function(config_dict, self)
Oct 13 12:39:50 PusulaServer weewx[1691] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/user/wxt5x0-python3.py", line 108, in loader
Oct 13 12:39:50 PusulaServer weewx[1691] CRITICAL weewx.engine:     ****      return WXT5x0Driver(**config_dict[DRIVER_NAME])
Oct 13 12:39:50 PusulaServer weewx[1691] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/user/wxt5x0-python3.py", line 483, in __init__
Oct 13 12:39:50 PusulaServer weewx[1691] CRITICAL weewx.engine:     ****      self._station = WXT5x0Driver.STATION.get(protocol)(address, port, baud)
Oct 13 12:39:50 PusulaServer weewx[1691] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/user/wxt5x0-python3.py", line 392, in __init__
Oct 13 12:39:50 PusulaServer weewx[1691] CRITICAL weewx.engine:     ****      raise NotImplementedError("NMEA support not implemented")
Oct 13 12:39:50 PusulaServer weewx[1691] CRITICAL weewx.engine:     ****  NotImplementedError: NMEA support not implemented
Oct 13 12:39:50 PusulaServer weewx[1691] CRITICAL __main__: Unable to load driver: NMEA support not implemented
Oct 13 12:39:50 PusulaServer weewx[1691] CRITICAL __main__:     ****  Exiting...

So I think I need to take the WXT510 down from the roof and reconfigure it for serial data using the service port. It does need cleaning anyway :)

..
Erik



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/t8pTnYHcS68/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/CAPq0zEAjRaRMzqaC1FO0B4ZrPW1ieePTwGR3UXWt4S1t4R%2Bidw%40mail.gmail.com.

d k

unread,
Oct 15, 2020, 5:44:50 AM10/15/20
to weewx-user
Erik,

I'm taking a stab in the dark here. But you probably have to tell the WXT5 to provide output in the format you want which I assume is ASCII and it's currently set to NMEA 0183. 
Check the manual https://www.vaisala.com/sites/default/files/documents/WXT530-User-Guide-in-English-M211840EN-E.pdf
Page 157.
  • Problem
    Data messages are not
    in expected format.
  • Possible causes
    The communication protocol may not be the one you want.
  • Action(s)
    Check the communication
    protocol of the device by using the
    Vaisala Configuration Tool or any
    terminal with command aXU,M!
    (SDI-12) aXU,M<cr><lf> (ASCII/
    NMEA) and change it if needed
Hope this helps you. I used to these issues when I was surveying cable.
Reply all
Reply to author
Forward
0 new messages