Skip to main content

MQTT Connection

mqtt/state

The current MQTT state.

Example
# $HOST e.g. warp-AbCd

Read

curl http://$HOST/mqtt/state
{
"connection_state": 2,
"connection_start": 27649,
"connection_end": 0,
"last_error": 0
}
NameDescription
connection_state
int

State of the connection to the MQTT broker

  • 0 - Not configured
  • 1 - Not connected
  • 2 - Connected
  • 3 - Error
last_error
int

The last error that occurred. -1 if no error has occurred.

connection_start
int (ms)

Time in milliseconds when the last connection was established.

connection_end
int (ms)

Time in milliseconds when the last connection was disconnected.




mqtt/config

The MQTT configuration.

Example
# $HOST e.g. warp-AbCd

Read

curl http://$HOST/mqtt/config
{
"enable_mqtt": false,
"broker_host": "test.mosquitto.org",
"broker_port": 1883,
"broker_username": "test",
// Not returned
"broker_password": null,
"global_topic_prefix": "warp",
"client_name": "",
"interval": 1
}

Write

curl http://$HOST/mqtt/config -d '{
"enable_mqtt": true,
"broker_host": "my_mosquitto.localdomain",
"broker_port": 1883,
"broker_username": "wallbox-garage",
"broker_password": "meinpasswort",
"global_topic_prefix": "wallbox/garage",
"client_name": "wallbox-garage",
"interval": 1,
"protocol": 0,
"cert_id": -1,
"client_cert_id": -1,
"client_key_id": -1,
"path": ""
}'
NameDescription
enable_mqtt
bool

Indicates whether an MQTT connection to the configured broker should be established.

  • true - If MQTT is enabled.
  • false - If MQTT is disabled.
read_only
bool

Indicates whether the MQTT API may only be read or also written.

  • true - If the MQTT API may only be read.
  • false - If the MQTT API may be read and written.
protocol
int

The MQTT protocol to use

  • 0 - MQTT (MQTT over TCP; unencrypted)
  • 1 - MQTTS (MQTT over TLS; encrypted)
  • 2 - WS (MQTT over WebSocket; unencrypted)
  • 3 - WSS (MQTT over WebSocket Secure or MQTT over WebSocket over TLS; encrypted)
broker_host
string

Hostname or IP address of the MQTT broker to which the device should connect.

broker_port
int

Port of the MQTT broker to which the device should connect. Typically 1883.

broker_username
string

Username to use for connecting to the broker. Empty if no authentication is used.

broker_password
string

Password to use for connecting to the broker. Empty if no authentication is used.

global_topic_prefix
string

Prefix prepended to all MQTT topics. Normally warp/[device UID] or warp2/[device UID].

client_name
string

Name under which the device registers with the broker. This is not the username for authentication.

interval
int (s)

Minimum send interval per topic in seconds. Messages are only sent when there are changes to the payload. With a send interval of x seconds, at most one message per topic is sent every x seconds. If the content changes multiple times in x seconds, only the most recent content is transmitted.

path
string

Part of the MQTT-over-WS URL after the hostname. Must start with /. Ignored if "protocol" 0 or 1 is selected.

cert_id
int

ID of the CA certificate used to verify the certificate of the MQTTS or WSS server. See certs/state

  • -1 - Use embedded certificate bundle
  • >= 0 - Use certificate with this ID
client_cert_id
int

ID of the client certificate to be used for establishing a TLS-encrypted connection. See certs/state

  • -1 - Not used
  • >= 0 - Use certificate with this ID
client_key_id
int

ID of the certificate key used to encrypt the client certificate. (Optional) See certs/state

  • -1 - Not used
  • >= 0 - Use certificate with this ID



mqtt/auto_discovery_config

The MQTT auto discovery configuration.

Example
# $HOST e.g. warp-AbCd

Read

curl http://$HOST/mqtt/auto_discovery_config
{ "auto_discovery_mode": 2, "auto_discovery_prefix": "homeassistant" }

Write

curl http://$HOST/mqtt/auto_discovery_config -d '{ "auto_discovery_mode": 2, "auto_discovery_prefix": "homeassistant" }'
NameDescription
auto_discovery_mode
int

Indicates whether an MQTT connection to the configured broker should be established.

  • 0 - Auto discovery disabled
  • 1 - Auto discovery in generic mode; Compatible with e.g. openHAB and Domoticz
  • 2 - Auto discovery in Home Assistant mode
auto_discovery_prefix
string

Prefix to which the information used for auto discovery is sent. Typically homeassistant