User avatar
MortySmith
Posts: 15
Joined: Tue Aug 13, 2019 3:45 pm
Location: Cambridge, UK

Switching between an AP and Wifi client for setup

Wed Aug 21, 2019 8:12 pm

Hi.

I'm not sure if I'm using the correct terminology, but..
What I want to do is be able to check if a wi-fi network has been configured/can be connected to.
If neither of those criteria are met, then hostapd should create a wi-fi access point, which can be used to set up the configuration using a web page (I am using lighttpd for that part).
There's a lot of juggling of services, and I keep getting into a real mess with which services need starting/stopping, in what order and the spaghetti that is the config files.

Can anyone shed any light on this?

Thanking you in advance

M
"Uncertainty is inherently unsustainable. Eventually, everything either is or isn't" - Rick Sanchez

bls
Posts: 205
Joined: Mon Oct 22, 2018 11:25 pm

Re: Switching between an AP and Wifi client for setup

Thu Aug 22, 2019 1:22 am

Lots of implementations of this floating around. Here’s one; https://github.com/gitbls/autoAP and here’s another one: https://github.com/balena-io/wifi-connect

User avatar
MortySmith
Posts: 15
Joined: Tue Aug 13, 2019 3:45 pm
Location: Cambridge, UK

Re: Switching between an AP and Wifi client for setup

Thu Aug 22, 2019 6:39 am

@bls:
Thanks for that. I did have a look through the first two pages of search engine results, but nothing like that came up.
It all seemed to be making your pi into a network bridge, but these two should be a good starting point.

I see what gitbls meant about wifi-connect being a bit heavyweight. A lot of it is programmed in Rust, a language I am not really familiar with.
autoAP definitely looks worth investigating though.


Thanks
M
"Uncertainty is inherently unsustainable. Eventually, everything either is or isn't" - Rick Sanchez

bls
Posts: 205
Joined: Mon Oct 22, 2018 11:25 pm

Re: Switching between an AP and Wifi client for setup

Thu Aug 22, 2019 12:59 pm

autoAP might be a bit lightweight for you in that it doesn't have the web page part done yet, but it's straightforward to add. Sounds like you're on the right path with lighttpd so could be a fun project!

User avatar
MortySmith
Posts: 15
Joined: Tue Aug 13, 2019 3:45 pm
Location: Cambridge, UK

Re: Switching between an AP and Wifi client for setup

Thu Aug 22, 2019 3:32 pm

@bls:
It certainly will be fun. I'm planning to add this to my retro radio project to make it nice and easy to configure.
Once it's done, I hope to be able to post some links to pics, maybe even a blog.

Thanks again
M
"Uncertainty is inherently unsustainable. Eventually, everything either is or isn't" - Rick Sanchez

User avatar
MortySmith
Posts: 15
Joined: Tue Aug 13, 2019 3:45 pm
Location: Cambridge, UK

Re: Switching between an AP and Wifi client for setup [SOLVED]

Fri Aug 23, 2019 7:33 pm

Found a nice little script here, which seems to do everything needed:

http://www.raspberryconnect.com/project ... connection

I've set up lighttpd on the pi to serve a web page, both when in AP mode, and Client mode, which seems to work pretty well.
The script mentioned on that site only goes into AP mode if the SSID registered in /etc/wpa_supplicant/wpa_supplicant.conf can't be contacted, or there isn't one.

Regards
M
"Uncertainty is inherently unsustainable. Eventually, everything either is or isn't" - Rick Sanchez

bls
Posts: 205
Joined: Mon Oct 22, 2018 11:25 pm

Re: Switching between an AP and Wifi client for setup

Fri Aug 23, 2019 9:03 pm

Looks like it's less complex than balena wifi-connect and more complex than autoAP, as it requires installing hostapd and dnsmasq. Hope it works well for you!


User avatar
MortySmith
Posts: 15
Joined: Tue Aug 13, 2019 3:45 pm
Location: Cambridge, UK

Re: Switching between an AP and Wifi client for setup

Tue Aug 27, 2019 4:00 pm

@rudiratlos:

Wow!
That's a nifty looking script. Everything you'd ever want is included, AND it installs the required packages.
I'll definitely be looking more closely at it.
You seem to have included everything anyone would ever need.
it's a very tidy looking script too. You have my respect, indeed. 8-)


Thanks

M
"Uncertainty is inherently unsustainable. Eventually, everything either is or isn't" - Rick Sanchez

Return to “Networking and servers”