Web page to set Wifi Settings

I've done a decent amount of research on this but haven't quite found exactly what I'm looking for yet. I'll preface by saying that the first half of this question is more of a pi-specific question and not necessarily just a NodeRED question, but I wanting to include it for context for my second, NodeRED-specific, question.

I'm working on a solution using NodeRED on a pi where the pi will first connect to a non-internet facing network via ethernet. I'd like the user to then be able to set their Wifi settings by accessing the Pi via a webserver on that closed LAN.

The idea being that the ethernet connection will stay non-internet facing, but the wifi will connect to the internet, and that wifi SSID/PW could change from day to day at different sites.

Most of the solutions I've found so far involve making the Pi a wifi hotspot to connect to first, in IoT style applications.

As an alternate, I'm currently setting various configuration options in my solution using a JSON file that NodeRED is reading. I'd be potentially open to using that same JSON to include SSID/PW information, but then would need a little guidance on how to use NodeRED to appropriately update that information in the wpa_supplicant file.

I am not exactly sure where you are getting the data, first you mention a web server that you could get it from, so presumably the server could provide a json document containing the information. Then you say you could read it from a file. Either of those is pretty trivial in node-red. Once you have the json then you can feed it through a JSON node to convert it to a javascript object, so it should then be easy to extract the information you want.

So exactly what do you need help with?

To see if I have this right,
1 - you have a router in your local LAN that has a local WiFi SSID (let's call it MY-WIFI).
2 - the Pi is hard wired to the router.
3 - a user (your significant other, kids, etc) will connect to MY-WIFI network and get the SSID of the hotel/campground/etc from node-red??

a) Why do you need the Pi to connect to the hotel/campground/etc's WiFi?
b) You will have to manually enter the locations SSID and password into NR to store it (in a DB?)
c) are you wanting the Pi to figure out which WiFi network the location is using and then automatically pass that info and the password to all your local devices (phones, tablets, etc)?

You could build a wpa_supplicant file for the Pi that contains all the WiFi hotspots you end up using and you should be able to update that list via NR but all the local devices will have to have that information manually entered at least once (depending on the device's settings) and if you go backto a HotSpot and they have changed the password, you'll have to update al the devices again.

Have I got the right idea?

Sorry, I was not clear enough in my initial post. These are two separate networks, one (ethernet) is a closed LAN with no internet and the other (wifi) is for an internet connection.

The pi/NodeRED fetches information from various APIs on the internet and then passes them along to a device inside of the closed LAN.

I guess a better way to state my question is, what's the best way, using NodeRED, to update my wpa_supplicant file on the Pi?, assuming that I already have the data that I need. I should not have included the first half of my post in my original question, it was confusing. My apologies.

Sorry for being confusing, I provided too much information and didn't get to the point. I guess my main question here is:

What's the best way, using NodeRED, to update my wpa_supplicant file on the Pi? , assuming that I already have the data that I need

You could write to it using a system command such as cat or sed, using sudo to get over the file permissions problems. Work out what you would do in a terminal and then call that in an exec node. If the pi is setup to require password entry when you use sudo then you can tell it not to need a password on the particular command you want, using visudo. I always have to google that to remind myself exactly how to do it.

I'm still unclear - maybe the question I should ask is what are you trying to do?
Build a DB or a giant wpa_supplicant file with all the hotspots you access?
What are the types of devices you are using?
Are you trying to build something that will recognize a hotspot when you return and automatically update the various devices with the SSID/Password so they can connect to the hotspot or are all the devices hard wired and you want them to access the internet via the Pi's wifi which will connect to the hotspot?

There is no internet sharing/hotspot happening. The Pi needs to be able to see the internet in order to access various API services. The pi then takes specific information from those services and sends it out to devices on the closed network using OSC messages. The closed network never sees the internet. I talk more about the specifics of use case in the comments here: Return IP from multiple NICs

I think I'm on the right track with what I need at this point. Thanks, and I'm sorry for being confusing!

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.