First run
The first time the hub starts with an empty database, it has no users. Your first job is to create the admin account, which you then use to sign in to the web UI and to connect your phone.
Until the first user exists
While there are no users, the hub falls back to the simple sign-in settings in config.json: with require_auth off (the default) or no access_key set, anyone who can reach the hub's port is treated as an admin. Because the hub listens on every network interface by default, create the admin account right away, before you open the hub to anyone else. See Configuration.
The bootstrap key
On a start with no users, the hub prints a one-time bootstrap key:
[lemmesee] No users found.
Bootstrap key: 3Hk...Zq
POST /api/users/bootstrap {"username": "admin", "bootstrap_key": "<key>"}
(key expires when first admin is created)
If the hub runs without a console, look for these lines in logs/restart.log in the hub folder. The key changes every time the hub starts until the first user is created.
Create the admin
Send the key to the hub with the username you want, from the hub PC. In a Command Prompt:
curl -X POST http://localhost:8765/api/users/bootstrap -H "Content-Type: application/json" -d "{\"username\": \"admin\", \"bootstrap_key\": \"3Hk...Zq\"}"
In PowerShell, where curl means something else:
Invoke-RestMethod -Method Post -Uri http://localhost:8765/api/users/bootstrap -ContentType "application/json" -Body '{"username": "admin", "bootstrap_key": "3Hk...Zq"}'
The response is the user record plus an access_key field. That access key is shown once and never again, so save it somewhere safe, such as a password manager.
After the first user exists, this request answers 404, and the bootstrap key is gone for good. Create further users on the Users page. See Users and Invites.
Sign in to the web UI
On the hub PC itself, the web UI opens without signing in as long as local_admin is on (the default): a browser on the same machine counts as the admin. From any other device, open the hub's address and sign in with your username and access key. A sign-in lasts seven days and is renewed each time you use the web UI.
API calls from scripts and other programs send the same two values as headers, X-Username and X-Access-Key. See the REST API.
Connect your phone
In LemmeKnow (Premium), add the hub with its address, your username and your access key. See Connecting phones for the hub side and Connecting to a LemmeSee hub for the app side.
What to set up next
- Phones also need to reach the MQTT broker, which takes a listener with sign-in. See MQTT and Mosquitto.
- Add your first tasks: a script on a schedule, a daemon to keep running, or a web page to watch.
- Run LemmeKnow Server's
lemmeknow.pyas a daemon task, so the hub starts it and keeps it running. Phones need its heartbeat for a green status dot and itsHUB_URLsetting to find the hub's web address. See Scripts and daemons and Server configuration.