matthewwall / weewx-interceptor

weewx driver that intercepts web traffic from internet 'bridge' devices such as Acurite Access, ObserverIP, OS LW30x, LaCross GW1000U, FineOffset GW1000
GNU General Public License v3.0
105 stars 44 forks source link

wu_client with wifi console #81

Closed wrvolz closed 3 years ago

wrvolz commented 3 years ago

I have a WS-2002 which looks like a Fine Offset HP2550. The console is talking to WU with no problem. I'm running weewx on a raspberry. I'm trying to use wu_client to get the data. I also have an Apache server running on port 80. The Raspberry is at IP x.y.0.3 on eth0. The Console is at IP x.y.0.197. I can ping the console from the RPI. I tried Interceptor parameters but I'm getting nothing. The last few lines of the /var/log/messages are: Sep 14 21:32:13 raspberrypi weewx[10453] INFO weewx.engine: Loading station type Interceptor (user.interceptor) Sep 14 21:32:13 raspberrypi weewxd: interceptor: MainThread: driver version is 0.46 Sep 14 21:32:13 raspberrypi weewxd: interceptor: MainThread: device type: wu-client Sep 14 21:32:13 raspberrypi weewxd: interceptor: MainThread: sensor map: None Sep 14 21:32:13 raspberrypi weewxd: interceptor: MainThread: mode is sniff Sep 14 21:32:13 raspberrypi weewxd: interceptor: MainThread: sniff iface=eth0 promiscuous=0 Sep 14 21:32:13 raspberrypi weewxd: interceptor: MainThread: sniff filter 'src 192.168.0.197 and dst port 80'

What do I need to change to get this working? Also, once it's working will need to have weewx upload the record to WU? Thanks,

wrvolz commented 3 years ago

Update - I though pypcap was installed - it wasn't. After installing that I got this: Sep 14 22:03:46 raspberrypi weewxd: interceptor: MainThread: sniff filter 'src 192.168.0.197 and dst port 80' Sep 14 22:03:46 raspberrypi weewx[11938] ERROR weewx.engine: Import of driver failed: in method 'pcapObject_open_live', argument 2 of type 'char *' (<type 'exceptions.TypeError'>) Sep 14 22:03:46 raspberrypi weewx[11938] CRITICAL weewx.engine: Traceback (most recent call last): Sep 14 22:03:46 raspberrypi weewx[11938] CRITICAL weewx.engine: File "/usr/share/weewx/weewx/engine.py", line 103, in setupStation Sep 14 22:03:46 raspberrypi weewx[11938] CRITICAL weewx.engine: self.console = loader_function(config_dict, self) Sep 14 22:03:46 raspberrypi weewx[11938] CRITICAL weewx.engine: File "/usr/share/weewx/user/interceptor.py", line 225, in loader Sep 14 22:03:46 raspberrypi weewx[11938] CRITICAL weewx.engine: ** return InterceptorDriver(config_dict[DRIVER_NAME]) Sep 14 22:03:46 raspberrypi weewx[11938] CRITICAL weewx.engine: File "/usr/share/weewx/user/interceptor.py", line 2208, in init Sep 14 22:03:46 raspberrypi weewx[11938] CRITICAL weewx.engine: self._device = self.DEVICE_TYPES.get(self._device_type)(stn_dict) Sep 14 22:03:46 raspberrypi weewx[11938] CRITICAL weewx.engine: ** File "/usr/share/weewx/user/interceptor.py", line 584, in init Sep 14 22:03:46 raspberrypi weewx[11938] CRITICAL weewx.engine: ** WUClient.Parser(), handler=WUClient.Handler, stn_dict) Sep 14 22:03:46 raspberrypi weewx[11938] CRITICAL weewx.engine: File "/usr/share/weewx/user/interceptor.py", line 283, in init Sep 14 22:03:46 raspberrypi weewx[11938] CRITICAL weewx.engine: iface, pcap_filter, promiscuous) Sep 14 22:03:46 raspberrypi weewx[11938] CRITICAL weewx.engine: File "/usr/share/weewx/user/interceptor.py", line 325, in init Sep 14 22:03:46 raspberrypi weewx[11938] CRITICAL weewx.engine: self.sniffer.open_live(iface, snaplen, pval, timeout_ms) Sep 14 22:03:46 raspberrypi weewx[11938] CRITICAL weewx.engine: File "/usr/lib/python2.7/dist-packages/pcap.py", line 108, in open_live Sep 14 22:03:46 raspberrypi weewx[11938] CRITICAL weewx.engine: def open_live(self, args): return _pcap.pcapObject_open_live(self, args) Sep 14 22:03:46 raspberrypi weewx[11938] CRITICAL weewx.engine: TypeError: in method 'pcapObject_open_live', argument 2 of type 'char ' Sep 14 22:03:46 raspberrypi weewx[11938] CRITICAL main: Unable to load driver: in method 'pcapObject_open_live', argument 2 of type 'char ' Sep 14 22:03:46 raspberrypi weewx[11938] CRITICAL main: Waiting 60 seconds then retrying...

wrvolz commented 3 years ago

Found a solution. Uninstall python-libpcap and install python-pypcap. Now to figure out how to forward the packet to weewx.