MQTT BROKER ONLY¶
The box contains an MQTT broker. It connects devices and software that speak MQTT to the box. The box does not publish on its own the state of its devices or the engine's data over MQTT: to read them, use the JSON-RPC API.
The box's broker¶
On first start, nymea creates a default configuration:
| Setting | Default value |
|---|---|
| Listening address | 0.0.0.0 (all the box's interfaces) |
| Port | 1883 |
| TLS | disabled |
| Authentication | enabled |
The box announces the broker on the local network (ZeroConf, service _mqtt._tcp).
With authentication enabled, an MQTT client is accepted only if a policy exists for it. A policy is:
| Field | Role |
|---|---|
clientId |
the MQTT client identifier it applies to |
username, password |
the credentials this client must present |
allowedPublishTopicFilters |
the topics it may publish on |
allowedSubscribeTopicFilters |
the topics it may subscribe to |
Filters accept the + and # wildcards. A client without a policy, or with wrong
credentials, is rejected; so is a publication or subscription outside the filters. If you
disable authentication on a configuration, any client is accepted there, with no topic
restriction.
The default configuration has no stored policy: a client you set up yourself cannot connect until you create one for it.
Configuring it¶
There is no screen for this in the app. The broker is configured through the JSON-RPC API, and each of these methods requires the administrator permission (ADMIN):
| Method | What it does |
|---|---|
Configuration.GetMqttServerConfigurations |
lists the broker's listening configurations |
Configuration.SetMqttServerConfiguration |
creates a configuration, or changes the one with the same id (address, port, TLS, authentication) |
Configuration.DeleteMqttServerConfiguration |
deletes a configuration |
Configuration.GetMqttPolicies |
lists the stored policies |
Configuration.SetMqttPolicy |
creates a policy, or changes the one with the same clientId |
Configuration.DeleteMqttPolicy |
deletes a policy |
Who uses it¶
Three plugins use the box's broker:
- Tasmota: when a device is added, the box creates a dedicated access for it (random credentials, topics limited to its own prefix) and sets it on the device, which then exchanges with the box through the broker.
- go-eCharger, if you tick the
useMqttparameter (Use MQTT interface, off by default): the box likewise creates an access for the charger and gives it the broker's address. - MQTT client: it subscribes to a topic filter and emits a Publish received event (topic, payload) for each message; its Publish action publishes a message (topic, payload, QoS, retain). The internal client talks to the box's broker; the plain client, to the broker whose address you enter.
The accesses created by Tasmota, go-eCharger and the internal client live in memory:
Configuration.GetMqttPolicies does not show them.
What does not exist¶
- The box publishes neither device states, nor measurements, nor engine data over MQTT. The broker carries only what the plugins above and the clients you allow publish. To read these data, use the JSON-RPC API and its notifications.
- There is therefore no list of "ETM PowerSync" topics and no message format to document.