MQTT topics
This is the full list of MQTT topics LemmeKnow Server and your scripts publish, with their payloads. The LemmeSee Hub uses the same topics, so anything you build against this page works with either.
All payloads are JSON. Times (ts) are milliseconds (Unix epoch). Everything is published at QoS 1 ("delivered at least once").
Topic layout
Every topic starts with lemmeknow/, followed by the server id, followed by the topic itself:
lemmeknow/<server_id>/<topic>
The server id is a short code of 8 hexadecimal characters, such as a1b2c3d4. It's created the first time LemmeKnow Server (or the LemmeSee Hub) starts on a PC and stays the same after that. It lets several servers share one broker without mixing up their messages. The app subscribes with a wildcard in this position, so it receives every server on the broker it connects to.
Finding your server id
LemmeKnow Server prints its server id when it starts:
LemmeKnow starting host=MYPC broker=127.0.0.1:1883 server_id=a1b2c3d4
You can also find it from any machine that can reach the broker. Subscribe to the heartbeat with a wildcard. The heartbeat is retained, so the answer comes back straight away:
mosquitto_sub -h 192.168.1.10 -t 'lemmeknow/+/heartbeat' -v -C 1
lemmeknow/a1b2c3d4/heartbeat {"ts": 1761200000000}
Published by LemmeKnow Server
| Topic | Retained | Payload fields | Purpose |
|---|---|---|---|
lemmeknow/<server_id>/heartbeat | Yes | ts | Sent every HEARTBEAT_INTERVAL seconds. Shows the server is alive. |
lemmeknow/<server_id>/config | Yes | interval, hub_url (optional) | Sent each time the server connects to the broker. interval is the heartbeat interval in seconds; hub_url is the HUB_URL setting, included only when set. |
Example payloads:
{"ts": 1761200000000}
{"interval": 300, "hub_url": "https://hub.example.com"}
Logs
| Topic | Retained | Payload fields | Purpose |
|---|---|---|---|
lemmeknow/<server_id>/logs/public/<source> | No | level, source, msg, ts, media_url (optional) | Public log line. |
lemmeknow/<server_id>/logs/private/<source> | No | Same | Private log line. |
| Field | Meaning |
|---|---|
level | debug, info, warning, important, or error. Also ping:<code>, which the app treats as a ping. |
source | The source name. |
msg | The message text. |
ts | When it was sent. |
media_url | Optional image URL to show with the line. |
Levels in order of severity: debug < info < warning < important < error.
The helper sends these with debug(), info(), warning(), important() and error(). See Logs.
Pings
| Topic | Retained | Payload fields | Purpose |
|---|---|---|---|
lemmeknow/<server_id>/ping/public/<code> | No | code, source, msg, ts | Public ping. |
lemmeknow/<server_id>/ping/private/<code> | No | Same | Private ping. |
lemmeknow/<server_id>/ping/<topic_id> | No | Same | Ping for one user, addressed by their topic id. Hub only. |
The helper sends these with ping(). The app acts on a ping only when its code has a label from a LemmeSee Hub, and ignores codes that are whole numbers of zero or less. See Pings and, for the hub, Messages for one user.
States
| Topic | Retained | Payload fields | Purpose |
|---|---|---|---|
lemmeknow/<server_id>/state/<group>/<name> | Yes | label, display, value, alarm, ts, optional plugin_label, interval, fields, sort_order, hide_label | A state. An empty message removes it. Hub only. |
The helper sends these with state() and clear_state(). The app reads states only from a LemmeSee Hub, so these reach a phone only when this server is relayed through one. See Relayed servers.
Topic segments
The <source> and <code> segments have /, +, #, and whitespace stripped out, and become unknown if nothing is left. Keep source names and codes short and plain, such as backup, nas, or 200.
Who can read what
On an open broker, any connected client can read every topic above.
On a broker where phones sign in through LemmeKnow Server, every signed-in user gets the same access, because the server keeps no permissions:
| Topic | Readable by |
|---|---|
heartbeat, config | Any signed-in user. |
logs/public/<source>, ping/public/<code> | Any signed-in user. |
logs/private/<source>, ping/private/<code> | Nobody. |
ping/<topic_id> | Nobody, because topic ids come from the hub. |
With the LemmeSee Hub, public and private topics are checked per user, source and code, and ping/<topic_id> reaches only the user with that topic id. A server relayed through a hub is checked per user, source and state in the same way, and its pings aren't passed on. See MQTT and Mosquitto.
Phones never publish to these topics. Scripts publish through a broker listener that allows anonymous access, such as one on 127.0.0.1. See Setting up Mosquitto and Public and private channels.
Hub topics
The LemmeSee Hub publishes more topics of its own, for status, states, feeds, and approvals. See MQTT and Mosquitto.