Troubleshooting
Most problems come down to one of three links: the server reaching the broker, the phone reaching the broker, or your scripts reaching the broker. Check them in that order.
The server prints "connection failed" or never says "connected"
The server keeps retrying, so check the broker rather than restarting the server.
- Is Mosquitto running? On Windows,
net start mosquittostarts it, and reports if it's already running. - Do
MQTT_BROKERandMQTT_PORTinconfig.pymatch a listener on the broker? - Does that listener allow anonymous access? The server connects without a username or password. See Setting up Mosquitto.
The server says "already running" and exits
Another copy is running, perhaps started by Task Scheduler or the LemmeSee Hub. That's normal; only one copy runs at a time. Stop the other copy first if you want to run it by hand.
The status dot stays red
- Check that heartbeats reach the broker:
mosquitto_sub -h 192.168.1.10 -t 'lemmeknow/+/heartbeat' -v. If nothing comes back, the server isn't connected. - Check the Address in the app's server editor. It's the broker's address and port, not the server's.
- Make sure your PC's firewall allows the phone listener's port.
- If you lowered
HEARTBEAT_INTERVAL, nothing changes on the phone until you also adjust its Heartbeat Timeout. If you raised it, raise the timeout too, or the phone marks the PC offline between heartbeats. The timeout must be greater than the interval.
The phone can't sign in
- The Username must be the username you gave to
create, as shown bypython user_manager.py list, not the user's ID. - The Access Key must be the latest one printed by
createorrotate. Rotating a key makes the old one stop working. - The phone listener needs TLS, because the app always uses TLS when an access key is set.
- The broker must run on the same PC as LemmeKnow Server, because the sign-in check only listens there. When the server starts, it should print
[auth] serving /internal/auth on 127.0.0.1:8765. If it doesn't, check thatAUTH_ENABLEDisn'tFalseinconfig.py; otherwise something else is using port 8765. When that's the LemmeSee Hub, the hub handles sign-in instead, so manage users there. See Users and authentication.
Scripts run but nothing arrives
- Look at your script's console. The helper prints
[log_client] publish failed: ...when it can't reach the broker. - Check the broker address the helper uses. It comes from
config.pywhen your script can import it; otherwise setlog_client.MQTT_BROKERandlog_client.MQTT_PORTyourself. - On the server's PC, run your script from the server's folder and start the server at least once first. The helper reads the server id from the server's database; without it, it publishes to topics the app doesn't read. On another machine, set
log_client.SERVER_IDor theLEMMEKNOW_SERVER_IDenvironment variable. See Logs. - If you sent a private log and your phone signs in through LemmeKnow Server, the phone can't receive it. Send it with
public=True, or use the LemmeSee Hub to grant private access. See Public and private channels. - Look at the topics directly to see what's arriving:
mosquitto_sub -h 192.168.1.10 -t 'lemmeknow/#' -v.
Pings don't do anything
The app only acts on pings whose code has a label defined on a LemmeSee Hub. With LemmeKnow Server alone, pings are ignored. Codes that read as a whole number of zero or less are reserved for the app and always ignored. See Pings.
The Hub URL doesn't appear in the app
Set HUB_URL in config.py to the hub's https:// address and restart the server. The app ignores an http:// address. The config message is sent each time the server connects. See Configuration.