Search code examples
node.jsraspberry-pielectronwifiubuntu-23.10

Configure wifi network from node.js


I'm working on a hardware that connects to a tv (think firestick or roku). I've built the application that runs with Electron and I've been able to get it running on a Raspberry Pi zero with Ubuntu server 23.10 installed.

However, while in development I've pre flashed my wifi settings onto the OS, this will not be an option when creating new devices for users. So now I'm trying to solve the problem of how to initially configure the wifi access on a new device.

Is there some way in Electron to show available access points and allow the user to configure them directly from the electron interface? Select SSID, enter password, etc...?

Another option I'm not sure is possible but would be ideal is if it could work like an Alexa or other iot device where the pi transmits it's own wifi network and then there is some way to connect to that and configure the wifi from a mobile app.

I'm thinking out loud a bit here but if anyone has come up against this use case and has some resources of how wifi can be configured on the host from electron that would be helpful.


Solution

  • The following package allows reading and connecting to ssid's from node.js https://www.npmjs.com/package/node-wifi

    I was able to do some basic ipc handlers to handle building a wifi manager into my Electron renderer.