Skip to content

RaffoNin/unifi-guest-wifi-qr-portal

Repository files navigation

Unifi Wifi Info Portal

Creates a guest portal where users can see guests wifi settings with a QR code to easily join the network.

Only works if using Unifi Controller.

Features

  • See wifi password and share to guests via qr code or by copy pasting the text.
  • Change the guest wifi password with api or frontend.

Home-page-dark Home-page-light

Env variables

Env varibale Required Default Value Notes
UNIFI_CONTROLLER_HOST true none
UNIFI_CONTROLLER_PORT true none
UNIFI_CONTROLLER_USERNAME true none
UNIFI_CONTROLLER_PASSWORD true none
UNIFI_SELECTED_NETWORK_ID false none Opens a portal with wifi networks and their IDs if not provided
NEXT_PUBLIC_HEADER_NAME false Guest Wifi
CHANGE_WIFI_TOKEN false none enables wifi password change ui and api if set
DEBUG false false

Getting Started

Docker

  1. Create a docker container with this image and set the env variables listed above:

    • Docker run running on port 3030 example:
    docker run -p 3030:3000 -e UNIFI_CONTROLLER_HOST=* -e UNIFI_CONTROLLER_PORT=* -e UNIFI_CONTROLLER_USERNAME=* 
    -e UNIFI_CONTROLLER_PASSWORD=* -e UNIFI_SELECTED_NETWORK_ID=* nextjs-home-wifi:latest
    
  2. Next steps will depend if you have already set the UNIFI_SELECTED_NETWORK_ID env variable or not.

    • If with UNIFI_SELECTED_NETWORK_ID:
      • Open site on port 3030 or any port specified, and the index page ("/") will show the wifi info with the QR code.
    • If without UNIFI_SELECTED_NETWORK_ID:
      • Open site and get, and the index page will show a list of all the wifi networks with their IDs.

        Wifi ID List-darkWifi ID List-light

      • Select the wifi, copy its ID, and set the ID as the UNIFI_SELECTED_NETWORK_ID.

      • Recreate image with the new env variable, and the index page ("/") will show the wifi info with the QR code.

Running locally

  1. Open the folder directory with terminal.
  2. Create a .env file at root and insert the environmental variables mentioned above.
  3. Do step 2 of the docker installation instructions above.
  4. Run "yarn build"
  5. Run "yarn start"

Change wifi password

  • Allows changing selected Wifi network's password
  • Only available if env variable CHANGE_WIFI_TOKEN is provided
  • The wifi password set under UNIFI_SELECTED_NETWORK_ID can be changed via:
    1. API call via http://[ip]:[port]/api/wifi/change-password

      • Send a POST request with the following body:
      key Notes
      token same as the CHANGE_WIFI_TOKEN
      newPassword cannnot be less than 8 and more than 63 characters
    2. Change the password via the frontend in http://[ip]:[port]/change-password

      • Use the CHANGE_WIFI_TOKEN env variable as the authentication token

      Screen Shot 2022-07-05 at 10 12 26 PM Screen Shot 2022-07-05 at 10 13 55 PM

Built with

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published