Skip to main content
Version: Next

MQTT

The MQTT input connects to an MQTT broker, subscribes to one or more topics, and receives real-time messages.

Configuration

FieldTypeRequiredDefaultDescription
typestringyesConstant value "mqtt"
hoststringyesMQTT broker address
portintegeryesMQTT broker port
client_idstringyesUnique client identifier
topicsarray<string>yesList of topics to subscribe to (wildcards supported)
usernamestringnoAuthentication username
passwordstringnoAuthentication password
qosintegernoQoS level (0, 1, 2)
clean_sessionbooleannoWhether to use a clean session
keep_aliveintegernoKeep-alive interval (seconds)

Examples

input:
type: "mqtt"
host: "localhost"
port: 1883
client_id: "my_client"
username: "user"
password: "pass"
topics:
- "sensors/temperature"
- "sensors/humidity"
qos: 1
clean_session: true
keep_alive: 60