Skip to content

Shalijar/esp-ble-prov

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

esp-ble-prov

NPM version

An ESP32 WiFi provisioning library for the web, using WebBluetoothAPI.

Features

  • WiFi provisioning supporting Security0 and Security1.
  • Automatic discovery of provisioning and custom endpoints.

Installation

$ npm install esp-ble-prov
const textDecoder = new TextDecoder();
const textEncoder = new TextEncoder();

const provisioner = new ESPProvisioner({
    deviceNamePrefix: "PROV_",
    serviceUUID: "YOUR_SERVICE_UUID",
    security: new Security1({ pop: "test" }) // or new Security1() without PoP. Security0 is the default
})

// Scan for available devices and connect to one
await provisioner.connect();

// Establish Security0 session
await provisioner.establishSession();

// Scan for available WiFi networks
const networks = await provisioner.scan();

// Read value from custom endpoint
let deviceId = await provisioner.readValueFromEndpoint("device-id")
                                .then(value => textDecoder.decode(value));

// Write value to custom endpoint
await provisioner.writeValueToEndpoint("device-id", textEncoder.encode("test"));

// Connect to WiFi
await provisioner.sendCredentials({
    ssid,
    passphrase: textEncoder.encode(passphrase),
    bssid,
    channel
}).then(() => {
    console.log("Successfully connected to WiFi!")
}).catch(() => {
    console.log("Failed to connect to WiFi")
})

// Reset provisiong state
await provisioner.ctrlReset();

// Reprov
await provisioner.ctrlReprov();

Contributing

Feel free to contribute to the project. Currently not implemented features:

  • Security2 Session

In the Wild

  • LAN Party Seating - Real-time web application for managing gaming station reservations at LAN party events.

About

ESP32 WiFi Provisioning library over WebBluetooth

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 93.0%
  • TypeScript 7.0%