So here's the situation:

Over the past 3 days I've tried countless iterations of the topic title on 
numerous hardware platforms and OS. Here's my observations:

WeeWx v 3.9.2 + apt installed python-libpcap has been my tried and true 
setup for years with my WS-2902. Works great.

It was time to update my server hardware so I started building a whole new 
software stack from scratch on a new RPi 4b. (and a bunch of other hardware 
when i started running into trouble, all with the same result)

Here's what I ran into: There seems to be no good configuration that allows 
the Interceptor driver to work with a python3/weewx v4 setup. I've tried 
Debian, Ubuntu, Raspbian. I could be totally threading the needle wrong, 
but at this point i can't find a way through this.

1. using python2 i can get pypcap installed but it won't see any station 
data. probably a pip2 vs pip3 problem
2. Using python3, i can't get pypcap to 'see' any station data either. 
3. using apt, there is no python3 support for python-libpcap so a python 
mismatch still. 

The problem appears to be python v2 vs v3. here's some logging:

This is with the apt version of pcap installed with weewx in python3 mode:


May  7 09:10:24 weather2 systemd[1]: Stopped LSB: weewx weather system.
May  7 09:10:24 weather2 systemd[1]: Starting LSB: weewx weather system...
May  7 09:10:24 weather2 weewx[1694] INFO __main__: Initializing weewx 
version 4.0.0
May  7 09:10:24 weather2 weewx[1694] INFO __main__: Using Python 3.7.3 
(default, Dec 20 2019, 18:57:59) #012[GCC 8.3.0]
May  7 09:10:24 weather2 weewx[1694] INFO __main__: Platform 
Linux-4.19.97-v7l+-armv7l-with-debian-10.3
May  7 09:10:24 weather2 weewx[1694] INFO __main__: Locale is 'en_GB.UTF-8'
May  7 09:10:24 weather2 weewx[1694] INFO __main__: PID file is 
/var/run/weewx.pid
May  7 09:10:24 weather2 weewx[1698] INFO __main__: Using configuration 
file /etc/weewx/weewx.conf
May  7 09:10:24 weather2 weewx[1698] INFO weewx.engine: Loading station 
type Interceptor (user.interceptor)
May  7 09:10:24 weather2 weewx[1683]: Starting weewx weather system: weewx.
May  7 09:10:24 weather2 systemd[1]: Started LSB: weewx weather system.
May  7 09:10:24 weather2 weewx[1698] INFO user.interceptor: driver version 
is 0.53
May  7 09:10:24 weather2 weewx[1698] INFO user.interceptor: device type: 
observer
May  7 09:10:24 weather2 weewx[1698] INFO user.interceptor: mode is sniff
May  7 09:10:24 weather2 weewx[1698] INFO user.interceptor: sniff 
iface=wlan0 promiscuous=0
May  7 09:10:24 weather2 weewx[1698] INFO user.interceptor: sniff filter 
'src 192.168.24.2 and dst port 80'
May  7 09:10:24 weather2 weewx[1698] ERROR weewx.engine: Import of driver 
failed: No module named 'pcap' (<class 'ModuleNotFoundError'>)
May  7 09:10:24 weather2 weewx[1698] CRITICAL weewx.engine:     ****  
Traceback (most recent call last):
May  7 09:10:24 weather2 weewx[1698] CRITICAL weewx.engine:     ****    
File "/usr/share/weewx/weewx/engine.py", line 103, in setupStation
May  7 09:10:24 weather2 weewx[1698] CRITICAL weewx.engine:     ****      
self.console = loader_function(config_dict, self)
May  7 09:10:24 weather2 weewx[1698] CRITICAL weewx.engine:     ****    
File "/usr/share/weewx/user/interceptor.py", line 315, in loader
May  7 09:10:24 weather2 weewx[1698] CRITICAL weewx.engine:     ****      
return InterceptorDriver(**config_dict[DRIVER_NAME])
May  7 09:10:24 weather2 weewx[1698] CRITICAL weewx.engine:     ****    
File "/usr/share/weewx/user/interceptor.py", line 2522, in __init__
May  7 09:10:24 weather2 weewx[1698] CRITICAL weewx.engine:     ****      
self._device = self.DEVICE_TYPES.get(self._device_type)(**stn_dict)
May  7 09:10:24 weather2 weewx[1698] CRITICAL weewx.engine:     ****    
File "/usr/share/weewx/user/interceptor.py", line 1285, in __init__
May  7 09:10:24 weather2 weewx[1698] CRITICAL weewx.engine:     ****      
Observer.Parser(), handler=Observer.Handler, **stn_dict)
May  7 09:10:24 weather2 weewx[1698] CRITICAL weewx.engine:     ****    
File "/usr/share/weewx/user/interceptor.py", line 427, in __init__
May  7 09:10:24 weather2 weewx[1698] CRITICAL weewx.engine:     ****      
iface, pcap_filter, promiscuous)
May  7 09:10:24 weather2 weewx[1698] CRITICAL weewx.engine:     ****    
File "/usr/share/weewx/user/interceptor.py", line 465, in __init__
May  7 09:10:24 weather2 weewx[1698] CRITICAL weewx.engine:     ****      
import pcap
May  7 09:10:24 weather2 weewx[1698] CRITICAL weewx.engine:     ****  
ModuleNotFoundError: No module named 'pcap'
May  7 09:10:24 weather2 weewx[1698] CRITICAL __main__: Unable to load 
driver: No module named 'pcap'
May  7 09:10:24 weather2 weewx[1698] CRITICAL __main__:     ****  Exiting...

Removing the apt version, here's with python3 pypcap

pi@weather2:/etc/apt/sources.list.d $ sudo pip3 install libpcap
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: libpcap in 
/usr/local/lib/python3.7/dist-packages (4.1.3a4)
Requirement already satisfied: setuptools>=30.4.0 in 
/usr/lib/python3/dist-packages (from libpcap) (40.8.0)
Requirement already satisfied: cffi>=1.10.0 in 
/usr/local/lib/python3.7/dist-packages (from libpcap) (1.14.0)
Requirement already satisfied: pycparser in 
/usr/local/lib/python3.7/dist-packages (from cffi>=1.10.0->libpcap) (2.20)

pi@weather2:/etc/apt/sources.list.d $ sudo pip3 install pypcap
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pypcap
Installing collected packages: pypcap
Successfully installed pypcap-1.2.3

and the syslog:

May  7 09:27:07 weather2 systemd[1]: Starting LSB: weewx weather system...
May  7 09:27:07 weather2 weewx[1880] INFO __main__: Initializing weewx 
version 4.0.0
May  7 09:27:07 weather2 weewx[1880] INFO __main__: Using Python 3.7.3 
(default, Dec 20 2019, 18:57:59) #012[GCC 8.3.0]
May  7 09:27:07 weather2 weewx[1880] INFO __main__: Platform 
Linux-4.19.97-v7l+-armv7l-with-debian-10.3
May  7 09:27:07 weather2 weewx[1880] INFO __main__: Locale is 'en_GB.UTF-8'
May  7 09:27:07 weather2 weewx[1880] INFO __main__: PID file is 
/var/run/weewx.pid
May  7 09:27:07 weather2 weewx[1884] INFO __main__: Using configuration 
file /etc/weewx/weewx.conf
May  7 09:27:07 weather2 weewx[1884] INFO weewx.engine: Loading station 
type Interceptor (user.interceptor)
May  7 09:27:07 weather2 weewx[1869]: Starting weewx weather system: weewx.
May  7 09:27:07 weather2 systemd[1]: Started LSB: weewx weather system.
May  7 09:27:07 weather2 weewx[1884] INFO user.interceptor: driver version 
is 0.53
May  7 09:27:07 weather2 weewx[1884] INFO user.interceptor: device type: 
observer
May  7 09:27:07 weather2 weewx[1884] INFO user.interceptor: mode is sniff
May  7 09:27:07 weather2 weewx[1884] INFO user.interceptor: sniff 
iface=wlan0 promiscuous=0
May  7 09:27:07 weather2 weewx[1884] INFO user.interceptor: sniff filter 
'src 192.168.24.2 and dst port 80'
May  7 09:27:07 weather2 weewx[1884] INFO user.interceptor: pypcap (1.2.2)
May  7 09:27:07 weather2 weewx[1884] INFO user.interceptor: sensor map: 
{'pressure': 'pressure', 'barometer': 'barometer', 'outHumidity': 
'humidity_out', 'inHumidity': 'humidity_in', 'outTemp': 'temperature_out', 
'inTemp': 'temperature_in', 'windSpeed': 'wind_speed', 'windGust': 
'wind_gust', 'windDir': 'wind_dir', 'windGustDir': 'wind_gust_dir', 
'radiation': 'solar_radiation', 'dewpoint': 'dewpoint', 'windchill': 
'windchill', 'rain': 'rain', 'rainRate': 'rain_rate', 'UV': 'uv', 
'txBatteryStatus': 'battery', 'extraTemp1': 'temperature_1', 'extraTemp2': 
'temperature_2', 'extraTemp3': 'temperature_3', 'extraHumid1': 
'humidity_1', 'extraHumid2': 'humidity_2', 'soilTemp1': 
'soil_temperature_1', 'soilTemp2': 'soil_temperature_2', 'soilMoist1': 
'soil_moisture_1', 'soilMoist2': 'soil_moisture_2', 'soilMoist3': 
'soil_moisture_3', 'soilMoist4': 'soil_moisture_4', 'leafWet1': 
'leafwetness_1', 'leafWet2': 'leafwetness_2', 'pm2_5': 'pm2_5', 
'extraTemp4': 'temperature_4', 'extraTemp5': 'temperature_5', 'extraTemp6': 
'temperature_6', 'extraTemp7': 'temperature_7', 'extraTemp8': 
'temperature_8', 'extraHumid3': 'humidity_3', 'extraHumid4': 'humidity_4', 
'extraHumid5': 'humidity_5', 'extraHumid6': 'humidity_6', 'extraHumid7': 
'humidity_7', 'extraHumid8': 'humidity_8', 'soilTemp3': 
'soil_temperature_3', 'soilTemp4': 'soil_temperature_4'}
May  7 09:27:07 weather2 weewx[1884] INFO weewx.engine: StdConvert target 
unit is 0x1
May  7 09:27:07 weather2 weewx[1884] INFO weewx.wxservices: The following 
values will be calculated: pressure=prefer_hardware, 
altimeter=prefer_hardware, appTemp=prefer_hardware, 
barometer=prefer_hardware, beaufort=prefer_hardware, 
cloudbase=prefer_hardware, dewpoint=prefer_hardware, ET=prefer_hardware, 
heatindex=prefer_hardware, humidex=prefer_hardware, 
inDewpoint=prefer_hardware, maxSolarRad=prefer_hardware, 
rainRate=prefer_hardware, windchill=prefer_hardware, windrun=prefer_hardware
May  7 09:27:07 weather2 weewx[1884] INFO weewx.wxservices: The following 
algorithms will be used for calculations: altimeter=aaASOS, maxSolarRad=RS
May  7 09:27:07 weather2 weewx[1884] INFO weewx.engine: Archive will use 
data binding wx_binding
May  7 09:27:07 weather2 weewx[1884] INFO weewx.engine: Record generation 
will be attempted in 'hardware'
May  7 09:27:07 weather2 weewx[1884] INFO weewx.engine: Using archive 
interval of 300 seconds (specified in weewx configuration)
May  7 09:27:07 weather2 weewx[1884] INFO weewx.restx: StationRegistry: 
Registration not requested.
May  7 09:27:07 weather2 weewx[1884] INFO weewx.restx: Wunderground: 
Posting not enabled.
May  7 09:27:07 weather2 weewx[1884] INFO weewx.restx: PWSweather: Posting 
not enabled.
May  7 09:27:07 weather2 weewx[1884] INFO weewx.restx: CWOP: Posting not 
enabled.
May  7 09:27:07 weather2 weewx[1884] INFO weewx.restx: WOW: Posting not 
enabled.
May  7 09:27:07 weather2 weewx[1884] INFO weewx.restx: AWEKAS: Posting not 
enabled.
May  7 09:27:07 weather2 weewx[1884] INFO __main__: Starting up weewx 
version 4.0.0
May  7 09:27:07 weather2 weewx[1884] INFO weewx.engine: Using binding 
'wx_binding' to database 'weewx.sdb'
May  7 09:27:07 weather2 weewx[1884] INFO weewx.manager: Starting backfill 
of daily summaries
May  7 09:27:07 weather2 weewx[1884] INFO weewx.engine: Starting main 
packet loop.
May  7 09:28:00 weather2 hostapd: wlan0: STA e0:dc:ff:fb:69:49 IEEE 802.11: 
associated
May  7 09:28:00 weather2 hostapd: wlan0: STA e0:dc:ff:fb:69:49 RADIUS: 
starting accounting session 9FD2896518FB7060
May  7 09:28:00 weather2 hostapd: wlan0: STA e0:dc:ff:fb:69:49 WPA: 
pairwise key handshake completed (RSN)
May  7 09:28:38 weather2 hostapd: wlan0: STA 60:01:94:39:9f:e8 IEEE 802.11: 
associated
May  7 09:28:38 weather2 hostapd: wlan0: STA 60:01:94:39:9f:e8 RADIUS: 
starting accounting session 58CA37495B0CD638
May  7 09:28:38 weather2 hostapd: wlan0: STA 60:01:94:39:9f:e8 WPA: 
pairwise key handshake completed (RSN)
May  7 09:28:38 weather2 dnsmasq-dhcp[555]: DHCPDISCOVER(wlan0) 
60:01:94:39:9f:e8 <-- my phone connecting
May  7 09:28:38 weather2 dnsmasq-dhcp[555]: DHCPOFFER(wlan0) 192.168.24.2 
60:01:94:39:9f:e8 
May  7 09:28:39 weather2 dnsmasq-dhcp[555]: DHCPDISCOVER(wlan0) 
60:01:94:39:9f:e8 
May  7 09:28:39 weather2 dnsmasq-dhcp[555]: DHCPOFFER(wlan0) 192.168.24.2 
60:01:94:39:9f:e8 
May  7 09:28:39 weather2 dnsmasq-dhcp[555]: DHCPREQUEST(wlan0) 192.168.24.2 
60:01:94:39:9f:e8 
May  7 09:28:39 weather2 dnsmasq-dhcp[555]: DHCPACK(wlan0) 192.168.24.2 
60:01:94:39:9f:e8 ws-2902a <-- weather station connecting


then radio silence.. even doing a tcpdump to watch, there is no traffic 
happening when using the pip3 based pypcap. I know this is out of the scope 
of weewx, but anyone have ideas? I'm about to go back to v3.9.2. One thing 
i accidentally did in the very fist install was didn't update my sources, 
so got weewx4 installed with python2. I think i had my libpcap messed up 
back then so didn't dive into it as a solution. Would this possibly work? 
running v4 under python2 with the python-libpcap (py2)

-Cory

-- 
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/a7528ae6-503b-4e80-8fa6-874a096bfab2%40googlegroups.com.

Reply via email to