Interceptor setup

1,161 views
Skip to first unread message

Scott Grayban

unread,
Jan 2, 2019, 9:11:23 AM1/2/19
to weewx-user
Ok I got hostapd working on the same PI as weeWX and the WS is connected to the hotspot.

I edit weemx.conf and made the changes and restarted weewx.

Logs show no errors when started....FINALLY ..... :)

After 12 hours or maybe more..... because my sdcard that weemx was on decided to take a dump on me while getting this to work.

2 lesson learnt here..... no amount of coffee would have helped.... make a image of the new sdcard setup so I don't have to manually copy settings from a crappy sdcard.

Oh and buy a A1 32GB card of Amazon...... DONE.. bought 2 !!!

Scott Grayban

unread,
Jan 2, 2019, 9:14:14 AM1/2/19
to weewx-user
Very happy and tired !!!

Jan  2 06:06:10 raspberrypi weewx[1845]: restx: MQTT: Published record 2019-01-02 06:05:04 PST (1546437904)
Jan  2 06:07:10 raspberrypi weewx[1845]: interceptor: MainThread: unrecognized parameter hourlyrainin=0.00
Jan  2 06:07:10 raspberrypi weewx[1845]: interceptor: MainThread: unrecognized parameter eventrainin=0.00
Jan  2 06:07:10 raspberrypi weewx[1845]: interceptor: MainThread: unrecognized parameter totalrainin=0.00
Jan  2 06:07:10 raspberrypi weewx[1845]: interceptor: MainThread: unrecognized parameter stationtype=AMBWeatherV4.0.7
Jan  2 06:07:10 raspberrypi weewx[1845]: interceptor: MainThread: unrecognized parameter maxdailygust=1.1
Jan  2 06:07:10 raspberrypi weewx[1845]: interceptor: MainThread: unrecognized parameter baromrelin=29.91
Jan  2 06:07:10 raspberrypi weewx[1845]: restx: MQTT: Published record 2019-01-02 06:06:08 PST (1546437968)
Jan  2 06:07:10 raspberrypi weewx[1845]: manager: Added record 2019-01-02 06:05:00 PST (1546437900) to database 'weewx.sdb'
Jan  2 06:07:10 raspberrypi weewx[1845]: manager: Added record 2019-01-02 06:05:00 PST (1546437900) to daily summary in 'weewx.sdb'

G Hammer

unread,
Jan 2, 2019, 9:15:31 AM1/2/19
to weewx-user
Glad it was hardware, else the error made little sense.
Yep, the Pi and SD cards are always something to look at. And have a backup for!

Good you're up and running.

Scott Grayban

unread,
Jan 2, 2019, 9:18:23 AM1/2/19
to weewx-user
I'll do a write up on how to install and use hostapd for weeWX since I turned into a semi-pro on it today and while it's still fresh in my head.

G Hammer

unread,
Jan 2, 2019, 9:29:38 AM1/2/19
to weewx-user
That would be great. You had a shorter route than I did. Not a Pi, but same idea.

sudo xed /etc/default/grub

GRUB_CMDLINE_LINUX
="net.ifnames=0 biosdevname=0"

sudo update
-grub

sudo reboot



sudo apt
-get install hostapd



iw reg
get

sudo iw reg
set US



sudo xed
/etc/hostapd/hostapd.conf



interface=wlan1

country_code
=US

ctrl_interface
=/var/run/hostapd

ctrl_interface_group
=0

ssid
=MiSSID

hw_mode
=g

channel
=11

beacon_int
=100

dtim_period
=2

max_num_sta
=50

rts_threshold
=2347

fragm_threshold
=2346

wmm_enabled
=1

ap_isolate
=1

ieee80211n
=1

ht_capab
=[SHORT-GI-20][SHORT-GI-40]

logger_syslog
=-1

logger_syslog_level
=2

logger_stdout
=-1

logger_stdout_level
=2

ieee8021x
=0

eap_server
=0

macaddr_acl
=0

auth_algs
=1

ignore_broadcast_ssid
=0

wpa
=2

wpa_passphrase
=HappyPW2u

wpa_key_mgmt
=WPA-PSK

wpa_pairwise
=CCMP

wpa_group_rekey
=86400



sudo xed
/etc/NetworkManager/NetworkManager.conf

[main]

plugins
=ifupdown,keyfile,ofono

dns
=dnsmasq



[ifupdown]

managed
=false



[device]

wifi
.scan-rand-mac-address=no



[keyfile]

unmanaged
-devices=mac:e8:4e:06:51:00:5d



sudo xed
/etc/network/interfaces

# interfaces(5) file used by ifup(8) and ifdown(8)

auto lo

iface lo inet loopback



allow
-hotplug eth0

iface eth0 inet dhcp



auto wlan1

iface wlan1 inet
static

address
10.0.0.1

netmask
255.255.255.0



sudo apt
-get install dnsmasq

sudo xed
/etc/dnsmasq.conf

interface=wlan1

dhcp
-range=10.0.0.2,10.0.0.10,255.255.255.0,12h

no-hosts

addn
-hosts=/etc/hosts.dnsmasq



sudo xed
/lib/systemd/system/dnsmasq.service

After=network-online.target

Wants=network-online.target



sudo xed
/etc/hosts.dnsmasq

10.0.0.1 WiAP



sudo xed
/etc/sysctl.conf

net
.ipv4.ip_forward=1



sudo iptables
-t nat -A POSTROUTING -o eth0 -j MASQUERADE

sudo iptables
-A FORWARD -i eth0 -o wlan1 -m state --state RELATED,ESTABLISHED -j ACCEPT

sudo iptables
-A FORWARD -i wlan1 -o eth0 -j ACCEPT

sudo iptables
-nvL

sudo apt
-get install iptables-persistent

sudo bash
-c "iptables-save > /etc/iptables.rules"



sudo xed
/etc/init.d/hostapd

DAEMON_CONF
=/etc/hostapd/hostapd.conf





sudo service hostapd start

sudo service dnsmasq start



sudo service hostapd status

sudo service dnsmasq status


Scott Grayban

unread,
Jan 2, 2019, 10:28:11 AM1/2/19
to weewx-user
wow I didn't go through that much at all !!

Scott Grayban

unread,
Jan 3, 2019, 12:43:21 PM1/3/19
to weewx-user
I got the hostapd how-to written. Where should I post it at ?

G Hammer

unread,
Jan 3, 2019, 1:10:53 PM1/3/19
to weewx...@googlegroups.com
The wiki

--
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/bks8RhOINP4/unsubscribe.
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.

Scott Grayban

unread,
Jan 3, 2019, 3:39:06 PM1/3/19
to weewx-user
Created https://github.com/weewx/weewx/wiki/hostapd-WiFi-setup-for-Interceptor-driver

On Thursday, January 3, 2019 at 10:10:53 AM UTC-8, G Hammer wrote:
The wiki

Zsolt Máté

unread,
Jan 4, 2019, 10:15:43 PM1/4/19
to weewx-user
I can't execute sudo iptables-save > /etc/iptables.ipv4.nat
It returns:  -bash: /etc/iptables.ipv4.nat: Permission denied

Scott Grayban

unread,
Jan 4, 2019, 10:17:32 PM1/4/19
to weewx-user
Run that as root

Zsolt Máté

unread,
Jan 4, 2019, 10:21:17 PM1/4/19
to weewx-user
Thanks, I was running it with sudo.

Scott Grayban

unread,
Jan 4, 2019, 10:28:38 PM1/4/19
to weewx-user
sudo won't work correctly for some reason for certain commands in raspbian.

gjr80

unread,
Jan 4, 2019, 11:55:34 PM1/4/19
to weewx-user
Think this might not be a raspbian issue as such. iptables-save is run with privileges but the redirection to the file is run by your existing shell which does not (necessarily) have sufficient privileges. Try using the same command and redirecting to /var/tmp/iptables.ipv4.nat (or some other widely writable directory), it will work just fine. Solution remains the same, run it as root with su.

Gary

Scott Grayban

unread,
Jan 5, 2019, 3:15:31 PM1/5/19
to weewx-user
Did you get it working ?


On Friday, January 4, 2019 at 7:21:17 PM UTC-8, Zsolt Máté wrote:

Zsolt Máté

unread,
Jan 5, 2019, 6:09:42 PM1/5/19
to weewx-user
If you're asking me, yes, I did. After reading your reply, I switched to su and ran the command as root. Tanks for the tutorial.

The only thing I don't like (but I can live with it) is the DHCP. In case the indoor unit looses DC power for any reason, it may receive a new IP address. Then someone has to either sniff the network for the new IP or log into the Pi to find it out.

Scott Grayban

unread,
Jan 5, 2019, 6:11:31 PM1/5/19
to weewx-user
Use reserved DHCP then.

Zsolt Máté

unread,
Jan 5, 2019, 6:18:33 PM1/5/19
to weewx-user
That's what I'm researching right now.

Scott Grayban

unread,
Jan 5, 2019, 6:24:48 PM1/5/19
to weewx-user
Glad you got it working !!

Most routers have reserve DHCP settings. So I'm sure yours does also.

Zsolt Máté

unread,
Jan 5, 2019, 8:34:57 PM1/5/19
to weewx-user
The issue is not the eth0, that I've reserved in my router.
The problem could be the indoor unit, that connects to wlan0 and receives the 10.*.*.* IP address.

Scott Grayban

unread,
Jan 5, 2019, 8:38:32 PM1/5/19
to weewx-user
Oh.... that IP for the LAN with hotsapd won't change. So your weather station won't get a new IP on the 10.x network.

Zsolt Máté

unread,
Jan 5, 2019, 8:45:26 PM1/5/19
to weewx-user
Good to know. Thanks for the information.

Scott Grayban

unread,
Jan 5, 2019, 9:04:06 PM1/5/19
to weewx-user
BTW that's only if your WS is the only one that's connecting to the hostapd !!

I can't say if it will change if another device connects and non should because it will cause to much interference with port 80.

G Hammer

unread,
Jan 5, 2019, 9:19:09 PM1/5/19
to weewx-user
Look in the config file for the DHCP server.
You should find something like this:
# Fixed IP addresses can also be specified for hosts.

Then, you can use the MAC address of the console and whatever IP you wish it to have.
Just be aware that the fixed IP has to be outside the DHCP range, so you'd have to edit the range when you assign the IP.

For me, I didn't do that as I've never seen a device get a completely different IP through normal expire/renew.
Especially if it the the only device on the network.

Chotechai Piyavongsiri

unread,
Apr 4, 2019, 1:12:22 AM4/4/19
to weewx-user
Hi Scott,

I've been running weewx on ubuntu for a few years using Interceptor (listening mode) to receive data direct from my IP Observer (the firmware still allows me to specify the destination server IP and Port).

As I'm setting up and testing another weewx server and would like to receive live data from the same IP Observer without changing the destination IP/port, do you think your approach would allow two weewx servers to receive same live data transmitted from the same IP Observer?

Could you also explain me in layman term the concept of your 'hostpapd-wifi…." approach.

Thank you.

Scott Grayban

unread,
Apr 4, 2019, 1:19:17 AM4/4/19
to weewx-user
I have no clue about running 2 weewx to get the same data... nothing to lose if you try.

As for the hostapd it's as close to weewx for dummies as I can get :P Just follow it step by step as many have done it without any issues.

Hostapd does require your station to connect to that WIFI to work and it has to be on the same pi running weewx and hostapd.

Scott

mwall

unread,
Apr 4, 2019, 5:54:34 AM4/4/19
to weewx-user
On Thursday, April 4, 2019 at 1:12:22 AM UTC-4, Chotechai Piyavongsiri wrote:
As I'm setting up and testing another weewx server and would like to receive live data from the same IP Observer without changing the destination IP/port, do you think your approach would allow two weewx servers to receive same live data transmitted from the same IP Observer?

you cannot have two instances of the interceptor in listen mode to the same station - the station can only talk to one server, whether it is wu or weewx-interceptor

however, you could have one weewx-interceptor instance in listen mode, then a second weewx-interceptor in sniff mode

the station communications with the first instance as it would to any server, and the second instance eavesdrops on the conversation


bthoven

unread,
Apr 4, 2019, 6:48:06 AM4/4/19
to weewx...@googlegroups.com
Hi m,
That was what I have been trying to do, the sniff, without success. Could you suggest how should I set the sniff thing.

Now my ObserverIP has local ip 192.168.2.122. It directs the data to my live weewx 192.168.2.3 port 55 which runs Interceptor in listening mode.

Thanks

--

Scott Grayban

unread,
Apr 4, 2019, 3:51:50 PM4/4/19
to weewx-user
Post your settings.
To unsubscribe from this group and all its topics, send an email to weewx...@googlegroups.com.

Chotechai Piyavongsiri

unread,
Apr 4, 2019, 10:14:11 PM4/4/19
to weewx-user
My 'live' weewx server ip is 192.168.2.3 (via wifi), my ObserverIP is 192.168.2.122 (wired connect to router) and its destination server is 192.168.2.3 port 55. Interceptor setting in weewx.conf:
[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 = observer
    port = 55

It has been working flawlessly.

My test weewx server ip is 192.168.2.11, wifi to router. I'm not sure with this kind of setup, how can I use Interceptor to sniff data from my ObserverIP (or from my live weewx server?).

Thanks

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

mwall

unread,
Apr 5, 2019, 12:12:47 PM4/5/19
to weewx-user
On Thursday, April 4, 2019 at 6:48:06 AM UTC-4, bthoven wrote:
That was what I have been trying to do, the sniff, without success. Could you suggest how should I set the sniff thing.

Now my ObserverIP has local ip 192.168.2.122. It directs the data to my live weewx 192.168.2.3 port 55 which runs Interceptor in listening mode.

try running a second instance of weewx with the interceptor driver on 192.168.2.3.  it should have a configuration something like this:

[Interceptor]
    driver = user.interceptor
    device_type = observer
    mode = sniff
    iface = eth1
    pcap_filter = src 192.168.2.122 and dst port 55

you will have to change eth1 to match whatever interface the first interceptor is listening on

save yourself some time and frustration by first getting it to work with a direct invocation.  assuming that weewx is installed in /home/weewx, cd to that directory then enter something like this:

PYTHONPATH=bin python bin/user/interceptor.py --device=observer --mode=sniff --iface=eth1 --filter="src 192.168.2.122 and dst port 55"

experiment with that until you see some data.  once you see data, then put the parameters into the config file and run weewx.

m

Zsolt Máté

unread,
Jun 6, 2019, 12:23:58 AM6/6/19
to weewx-user
Anyone having issues with this?
I had a power outage a few days ago and ever since I can't get hostapd to work/start.
Somehow my wlan0 is not starting up and not broadcasting it's SSID anymore.

Scott Grayban

unread,
Jun 6, 2019, 12:48:51 AM6/6/19
to Abridged recipients
Have you looked at the logs when starting hostapd?

Zsolt Máté

unread,
Jun 6, 2019, 12:57:26 AM6/6/19
to weewx-user
To be honest, I can't find anything related to hostapd in the logs.
sudo cat /var/log/syslog | grep hostapd returns nothing.
If I search my archived logs I can see the handshakes, etc, but nothing in my latest ones.

Zsolt Máté

unread,
Jun 6, 2019, 2:14:08 AM6/6/19
to weewx-user
Reinstalling hostapd solved the issue.

Zsolt Máté

unread,
Jun 30, 2020, 3:39:11 AM6/30/20
to weewx-user
Did anything change with the latest raspberry pi images? I'm trying to do a clean install, downloaded the last image (based on Debian Buster), installed and configured hostapd as per wiki.
Now the DNS is not resolving any address. I can ping external IP addresses while I'm connected to the pi via LAN or WLAN.

Zsolt Máté

unread,
Jun 30, 2020, 3:51:01 AM6/30/20
to weewx-user
There was a typo in the wiki, edited it.
Instead of domain_name_servers there was domain_name_server.

Scott Grayban

unread,
Jul 1, 2020, 5:46:25 PM7/1/20
to weewx-user
I corrected that typo. Sorry about the trouble.
Reply all
Reply to author
Forward
0 new messages