weewx-interceptor with sniff/capture by router

54 views
Skip to first unread message

Scott8586

unread,
May 4, 2020, 11:06:58 AM5/4/20
to weewx-user
I'm having trouble using weewx-interceptor, with WS-5000 (same as a WS-2000 with the ultrasonic anemometer).  I would like to keep WU and Ambient connections operating, and I want to catch the additional temperature sensors so I've been trying to sniff the ambient connection on the router.  Following examples in the weewx-interceptor documentation, I started off with something like the following


Router (edge router x):

sudo tcpdump -n -i switch0 dst 104.31.82.184 and port 80 | nc 192.168.35.XXX 9001


Weewx install host, Raspberry Pi:

sudo PYTHONPATH=/usr/share/weewx python /usr/share/weewx/user/interceptor.py --device=wu-client --mode=listen --port 9001 --debug


It quickly became apparent that I can't just dump the tcpdump output to the interceptor, it's expecting to be listening for the 'GET' line, and only that, so I modified my capture code to the following:

sudo tcpdump -vAls0 -i switch0 dst 104.31.82.184 and dst port 80| awk '{print $1, $2, "\n"; system("") }' | egrep --line-buffered "^GET" | nc 192.168.35.XXX 9001

I added system("") to awk, and --line-buffered to grep to keep them from buffering,  but I find that nc is also buffering, and the weewx-interceptor, is not getting data.  I have verified that echoing a test GET line string works correctly:

echo GET '/weatherstation/updateweatherstation.phpID=NopeNopeNope&PASSWORD=NadaNada&indoortempf=69.1&tempf=69.3&dewptf=40.5&windchillf=69.3&indoorhumidity=49&humidity=35&windspeedmph=4.0&windgustmph=10.7&winddir=203&absbaromin=29.315&baromin=30.115&rainin=0.000&dailyrainin=0.000&weeklyrainin=0.000&monthlyrainin=0.000&yearlyrainin=0.000&solarradiation=568.82&UV=5&dateutc=2020-05-03%2023:14:14&softwaretype=AMBWeatherV4.1.7&action=updateraw&realtime=1&rtfreq=5' 'HTTP/1.0' | nc 192.168.35.XXX 9001

I'm at my wit's end trying to figure this out, and frankly this is so jerry-rigged at this point, I'm concerned about the stability of the solution. My next step would be to write a python version of the entire pipe.

If anyone else has faced this particular setup, I or anything close, I would appreciate some example code, scripts, or setup details.  Thanks!
Reply all
Reply to author
Forward
0 new messages