Exceptions attribute error - Interceptor driver for Acurite bridge

375 views
Skip to first unread message

Douglas Krug

unread,
May 24, 2018, 11:14:19 AM5/24/18
to weewx-user

Have installed weeWX on MacOS 10.11.6 and I think my install is correct. I'm able to launch with Simulator configured, but I get the following error when I try to run configured with Interceptor for an Acurite bridge.

I also installed libcap as instructed.


From wee_debug


Using configuration file /Users/Shared/weewx/weewx.conf

Using database binding 'wx_binding', which is bound to database 'archive_sqlite'


System info

  Platform:       Darwin-15.6.0-x86_64-i386-64bit

  Python Version: 2.7.10


Load Information

  1 minute load average:  1.12

  5 minute load average:  1.22

  15 minute load average: 1.17


General Weewx info

  Weewx version 3.8.0 detected.


Station info

  Station type: Interceptor

  Driver:       user.interceptor


Driver info

[Interceptor]

    # This section is for the network traffic interceptor driver.

    

    # The driver to use:

    driver = user.interceptor

    

    # Specify the hardware device to capture.  Options include:

    #   acurite-bridge - acurite internet bridge

    #   observer - fine offset WH2600/HP1000/HP1003, aka 'observer'

    #   lw30x - oregon scientific LW301/LW302

    #   lacrosse-bridge - lacrosse GW1000U/C84612 internet bridge

    device_type = acurite-bridge

    mode = sniff

    iface = en0

    pcap_filter = src 192.168.0.125 and dst port 80


Currently installed extensions

Extension Name    Version   Description

Traceback (most recent call last):

  File "/Users/Shared/weewx/bin/wee_debug", line 427, in <module>

    main()

  File "/Users/Shared/weewx/bin/wee_debug", line 160, in main

    options.verbosity)

  File "/Users/Shared/weewx/bin/wee_debug", line 227, in generateDebugInfo

    ext.enumerate_extensions()

  File "/Users/Shared/weewx/bin/weecfg/extension.py", line 81, in enumerate_extensions

    info = self.get_extension_info(f)

  File "/Users/Shared/weewx/bin/weecfg/extension.py", line 93, in get_extension_info

    _, installer = weecfg.get_extension_installer(ext_cache_dir)

  File "/Users/Shared/weewx/bin/weecfg/__init__.py", line 1296, in get_extension_installer

    raise ExtensionError("Cannot find 'install' module in %s" % extension_installer_dir)

weecfg.ExtensionError: Cannot find 'install' module in /Users/Shared/weewx/bin/user/installer/.DS_Store


Not sure if this last error is typical on Mac OS when using wee_debug, but I don't get an error when I install the Interceptor driver.

Output from Mac OS console

5/24/18 1:12:59.654 AM weewx[677]: import of driver failed: 'module' object has no attribute 'pcapObject' (<type 'exceptions.AttributeError'>)
5/24/18 1:12:59.655 AM weewx[677]: engine: Unable to load driver: 'module' object has no attribute 'pcapObject'
5/24/18 1:12:59.655 AM weewx[677]: **** Exiting...

From my conf file

[Interceptor]
# This section is for the network traffic interceptor driver.


# The driver to use: driver = user.interceptor # Specify the hardware device to capture. Options include: # acurite-bridge - acurite internet bridge # observer - fine offset WH2600/HP1000/HP1003, aka 'observer' # lw30x - oregon scientific LW301/LW302 # lacrosse-bridge - lacrosse GW1000U/C84612 internet bridge device_type = acurite-bridge mode = sniff iface = eth1 pcap_filter = src 192.168.0.125 and dst port 80


# The driver to use: driver = user.interceptor # Specify the hardware device to capture. Options include: # acurite-bridge - acurite internet bridge # observer - fine offset WH2600/HP1000/HP1003, aka 'observer' # lw30x - oregon scientific LW301/LW302 # lacrosse-bridge - lacrosse GW1000U/C84612 internet bridge device_type = acurite-bridge mode = sniff iface = eth1 pcap_filter = src 192.168.0.125 and dst port 80

Not sure where to go from here. I know nothing about python. Any guidance would be helpful and much appreciated.

mwall

unread,
May 24, 2018, 11:55:21 AM5/24/18
to weewx-user
douglas,

this looks like a pcap library issue.  i think there are two python bindings for pcap:  pypcap and pylibpcap.  apparently pylibpcap has the pcapObject, but pypcap does not.


when i did the development of weewx-interceptor, the 'pip install pypcap' gave me the pylibpcap bindings.  but more recently i have been using the debian-based python-libpcap package, which seems to have pylibpcap bindings as well.  if you did the 'pip install pypcap' you might have gotten the pypcap bindings.

so what do we do?

option 1: figure out how to install the pylibpcap bindings on your system.  you might be able to do this with 'pip install pylibpcap'

option 2: adjust the weewx-interceptor code so that it works with either pypcap or pylibpcap bindings.  i'm happy to support whichever pcap bindings are more prevalent/modern/available.  the APIs are not compatible, but they are used in only less than 10 lines of code. 

m

Douglas Krug

unread,
May 24, 2018, 1:20:34 PM5/24/18
to weewx-user
Thanks so much for that helpful reply Matthew. I found the pylibpcap bindings here, but unfortunately I still get the same result. Tried rebooting for good measure, but no change. Tried uninstalling pypcap as well, but still no change in result.

Douglas Krug

unread,
May 26, 2018, 12:33:54 PM5/26/18
to weewx-user
Hi Matthew, is there an older version of the weewx-interceptor code before the pylibpcap binding change I might be able to try?

On Thursday, May 24, 2018 at 11:55:21 AM UTC-4, mwall wrote:

mwall

unread,
May 27, 2018, 8:36:47 PM5/27/18
to weewx-user
On Saturday, May 26, 2018 at 12:33:54 PM UTC-4, Douglas Krug wrote:
Hi Matthew, is there an older version of the weewx-interceptor code before the pylibpcap binding change I might be able to try?

nope - you'll be better of working with the latest

are you certain that you installed the pylibpcap bindings properly?  did you test by starting a python shell and doing the imports directly?

Douglas Krug

unread,
May 28, 2018, 11:38:56 AM5/28/18
to weewx...@googlegroups.com
Hi Mathew,

Thanks again. I'm not at a fluent in python. I've spent more time trying to get this running on Mac OS than it's worth. Going to order a Raspberry Pi 3 and try from there. So many more people running that, and support will be easier for everyone if I run into trouble.

I do have a RPi Zero W on hand. What your opinion on using that, would it be sufficient, or under powered for the task?

--
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/0cdl5rIPFCM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Scott Weis

unread,
May 28, 2018, 1:32:43 PM5/28/18
to weewx...@googlegroups.com

I run weewx on a Raspberry Pi model B (512Mb ram and 700 MHz single-core ARM1176JZF-S, running since 2013)  Since the Pi Zero has a 1 GHz single-core ARM1176JZF-S and 512Mb Ram it should be fine.

To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.

 

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

Douglas Krug

unread,
May 29, 2018, 11:41:47 PM5/29/18
to weewx-user
Thanks for the feedback Scott!

Douglas Krug

unread,
Jun 3, 2018, 6:22:17 PM6/3/18
to weewx-user
I'm now running weewx on a RPi Zero W. I have the interceptor driver loaded and I'm no getting the errors I was before. I have Apache2 installed and I can see my weather station from a web page, but I can't get any data from the acurite bridge. Not certain what I'm still missing. The config is now as follows...

[Interceptor]
# This section is for the network traffic interceptor driver.


# The driver to use: driver = user.interceptor # Specify the hardware device to capture. Options include: # acurite-bridge - acurite internet bridge # observer - fine offset WH2600/HP1000/HP1003, aka 'observer' # lw30x - oregon scientific LW301/LW302 # lacrosse-bridge - lacrosse GW1000U/C84612 internet bridge device_type = acurite-bridge mode = sniff iface = eth1 pcap_filter = src 192.168.0.125 and dst port 80


# The driver to use: driver = user.interceptor # Specify the hardware device to capture. Options include: # acurite-bridge - acurite internet bridge # observer - fine offset WH2600/HP1000/HP1003, aka 'observer' # lw30x - oregon scientific LW301/LW302 # lacrosse-bridge - lacrosse GW1000U/C84612 internet bridge device_type = acurite-bridge mode = sniff iface = wlan0 pcap_filter = src 192.168.0.125 and dst port 80

I don't get any reporting to the Apache server. I'm able to ping the bridge from the RPi Zero and I've tried 'sudo tcpdump' and 'sudo tcpdump -i wlan0 host 192.168.0.125 and port 53 -n -s 0 -vvv -w /usr/src/dump'

In both instances, I have no output from the acurite bridge IP, yet it connects with my.acurite.com (which I understand is actually hubapi.myacurite.com).
I am no longer able to get anything on WU from the bridge, but since I get a connection and data on my.acurite.com, I assume there isn't anything wrong with the bridge. I'm also not clear if I need to define the sensor map. 

For hardware such as the Acurite bridge or LW30x that support multiple remote
sensors, use the sensor_map to map the sensors to database fields.  For
example:

[Interceptor]
    driver = user.interceptor
    device_type = acurite-bridge
    ...
    [[sensor_map]]
        inTemp = temperature.06022.*      # sensor id 06022
        outTemp = temperature.05961.*     # sensor id 05961

When I try to use PYTHONPATH=bin python bin/user/interceptor.py --device=acurite-bridge --mode=sniff --iface=wlan0 --filter="src 192.168.0.125 and dst port 80",it results in  "python: can't open file 'bin/user/interceptor.py': [Errno 2] No such file or directory". If I point to where I'm actually finding interceptor.py by using PYTHONPATH=bin python /usr/share/weewx/user/interceptor.py --device=acurite-bridge --mode=sniff --iface=wlan0 --filter="src 192.168.0.125 and dst port 80" then the response is "Traceback (most recent call last):

  File "/usr/share/weewx/user/interceptor.py", line 203, in <module> import weewx.drivers ImportError: No module named weewx.drivers"


I've seen some post about redirecting in Apache2. That would be ideal if it worked for me and I didn't have to use a router in-between to redirect, but I'm finding it challenging to understand how to accomplish that exactly. The directories in the instructions don't exist, and I'm not clear if I have to create them or if they should already be there, such as 'conf.d' referenced below.

In the file /etc/apache2/conf.d/myacurite.conf:

RewriteEngine on
RewriteCond %{HTTP_POST} www.myacurite.com
RewriteRule ^/weatherstation(.*)$ http://Y.Y.Y.Y/weatherstation$1

I really want this to work, but I'm quite lost at the moment as to what others have done to get this happening. What logs or other info could I provide that would help? I'm willing to keep plugging away at it with some guidance, since I'm not using a configuration that isn't out of the norm, so I must just have something misconfigured.

gjr80

unread,
Jun 3, 2018, 6:54:38 PM6/3/18
to weewx-user
Hi,

Just like you needed to provide an explicit path to interceptor.py you need to provide an explicit path for PYTHONPATH. Try replacing PYTHONPATH=bin with PYTHONPATH=/usr/share/weewx

Gary

Douglas Krug

unread,
Jun 3, 2018, 7:58:39 PM6/3/18
to weewx-user
Thanks so much Gary. I tried

sudo PYTHONPATH=/usr/share/weewx python /usr/share/weewx/user/interceptor.py --device=acurite-bridge --mode=sniff --iface=wlan0 --filter="src 192.168.0.125 and dst port 80"


I get no output after 30 minutes, so I must have something on my new router that's not allowing this between the wlan0 and eth0. It's a TP-Link Deco M5 that allows a parent the type of control we need, but is pretty limited in what can be customized, and doesn't provide a lot of info about what's going on or how devices are connecting. I'll have to setup a DD-WRT test router and see if it get results. Really appreciate your tip.

gjr80

unread,
Jun 3, 2018, 8:02:38 PM6/3/18
to weewx-user
No problems, pure python issues I can help with but unfortunately you now need someone knowledgeable on the interceptor driver and it's setup. Unfortunately that's not me :(

Gary

Douglas Krug

unread,
Jun 3, 2018, 9:03:57 PM6/3/18
to weewx-user

With RPi Zero W and the Acurite bridge now both on a DD-WRT router, I still get nothing with 


sudo PYTHONPATH=/usr/share/weewx python /usr/share/weewx/user/interceptor.py --device=acurite-bridge --mode=sniff --iface=wlan0 --filter="src 192.168.0.125 and dst port 80"


I get nothing more than ARP requests when I run a tcp dump


00:51:33.916388 ARP, Request who-has DD-WRT (Broadcast) tell Acurite_Bridge, length 46


So I'm still lost in confusion.


On Thursday, May 24, 2018 at 11:14:19 AM UTC-4, Douglas Krug wrote:

mwall

unread,
Jun 4, 2018, 10:22:40 AM6/4/18
to weewx-user


On Sunday, June 3, 2018 at 9:03:57 PM UTC-4, Douglas Krug wrote:

With RPi Zero W and the Acurite bridge now both on a DD-WRT router, I still get nothing with 


sudo PYTHONPATH=/usr/share/weewx python /usr/share/weewx/user/interceptor.py --device=acurite-bridge --mode=sniff --iface=wlan0 --filter="src 192.168.0.125 and dst port 80"


I get nothing more than ARP requests when I run a tcp dump


00:51:33.916388 ARP, Request who-has DD-WRT (Broadcast) tell Acurite_Bridge, length 46


So I'm still lost in confusion.


the pi will not see any traffic from the bridge - the switch on the dd-wrt router ensures that.

option 1:  ssh to the dd-wrt router and run a capture+redirect on the router.  run the interceptor on the pi in sniff mode.

option 2:  install a hub (or a switch that can mirror ports) and plug the pi and acurite into the hub. then the hub into the router.  then you will be able to see the acurite traffic on the pi using sniffing.

option 3: configure dns on the dd-wrt router so that dns queries for hubapi.myacurite.com (or aculink.com if you have the old acurite hub firmware) resolve to the ip address of the pi.  then run the interceptor in listen mode, not sniff mode.

m
Reply all
Reply to author
Forward
0 new messages