On Saturday, October 8, 2016 at 9:18:22 AM UTC-7, mwall wrote:
>
>
>
> On Saturday, October 8, 2016 at 11:54:20 AM UTC-4, Sam Roza wrote:
>>
>>
>> Can weewx or the interceptor read from a file? I'm guessing this can be
>> piped to a file, and the offending line could be removed or ignored by
>> weewx. Otherwise I will work on seeing if there is another step that can be
>> introduced intermediately that will essentially do the same thing every
>> getting sent off to nc.
>>
>>
> if you cannot find an option to ngrep, try filtering the piped output from
> ngrep with an egrep or grep. perhaps something like this:
>
> ngrep ... | sed -e 's/T.*//;/^\s*$/d' | curl -s -d @-
> http://localhost:9999 > /dev/null
>
>
>
>> I guess there aren't too many/any others who are using this
>> network-capture-to-interceptor arrangement, eh?
>>
>>
> most of the examples for doing this kind of thing are for the acurite
> bridge - it seems to be more common than the LW30x, and has been around
> longer than the observer.
>
> saving output to file is one approach, and the fileparse driver can read
> name-value pairs from file. but then you need something to convert the
> captures to name-value pairs in the right format.
>
> from a distance, the GW1000U, LW30x, AcuriteBridge, Observer, netatmo,
> weatherflow, and other 'bridge' hardware look the same, thus the single
> 'interceptor' driver. in fact, they differ just enough that they cannot
> use a single common implementation (especially the GW1000U).
>
> the other complicating factor for this type of hardware is integrating it
> into your network. a dns redirect is the easiest approach, but as you know
> that is not always possible, so its nice to have alternatives. also, some
> platforms have tcpdump, while others have ngrep.
>
> what we learn from the interceptor driver will be used to create
> 'official' standalone drivers for GW1000U, LW30x, AcuriteBridge, and
> Observer hardware. at that point i expect that there will be a few base
> classes that get pushed up into the weewx drivers module.
>
> thank you for being patient and working through this!
>
> m
>
OK, the sed command, seems to work:
~~~
root@raspberrypi:/home/pi/Downloads# ngrep -l -q -d eth0 '0004a369e0d6'|
sed -e 's/T.*//;/^\s*$/d'
interface: eth0 (192.168.1.0/255.255.255.0)
match: 0004a369e0d6
mac=0004a369e0d6&id=c2&pv=0&lb=0&ac=0®=1009&lost=0000&baro=1005&ptr=0&wfor=0&p=1
^C
~~~
There are no errors during the command's execution:
~~~
root@raspberrypi:/home/pi/Downloads# ngrep -l -q -d eth0 '0004a369e0d6'|
sed -e 's/T.*//;/^\s*$/d' | curl -s -d @- http://localhost:9999 > /dev/null
root@raspberrypi:/home/pi/Downloads# ngrep -l -q -d eth0 '0004a369e0d6'|
sed -e 's/T.*//;/^\s*$/d' | nc localhost 9999
^C
~~~
But it doesn't seem to capture any data. If I dig a little deeper, I see
that when the last piped command is added-either curl or nc, doesn't seem
to matter which I choose-I stop getting output. At least, I think I'm not.
Simple command: root@raspberrypi:/home/pi/Downloads# ngrep -l -q -d eth0
'0004a369e0d6'|nc localhost 9999
Output:
root@raspberrypi:/etc/weewx# nc -l 9999
interface: eth0 (192.168.1.0/255.255.255.0)
match: 0004a369e0d6
T 192.168.1.73:2992 -> 54.228.205.188:80 [AP]
mac=0004a369e0d6&id=90&rid=d0&pwr=0&gw=0&av=0&wd=225&wg=0.9&ws=0.0&ch=1&p=1
T 192.168.1.73:2993 -> 54.228.205.96:80 [AP]
mac=0004a369e0d6&id=c2&pv=0&lb=0&ac=0®=1009&lost=0000&baro=1005&ptr=0&wfor=0&p=1
Command with sed command: root@raspberrypi:/home/pi/Downloads# ngrep -l -q
-d eth0 '0004a369e0d6'| sed -e 's/T.*//;/^\s*$/d' | curl -s -d @-
http://localhost:9999 > /dev/null
Output: root@raspberrypi:/etc/weewx# nc -l 9999
--> NO DATA <--
~~~
With sed command, it strips the unwanted data from the output, but for some
reason, it's not working. I've tried with both curl and nc, but I don't see
any issues. Is there a way to debug this?
Thanks!
Sam
--
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].
For more options, visit https://groups.google.com/d/optout.