Skip to content

3.3. MQTT client

John edited this page Jun 3, 2017 · 18 revisions

Introduction

ebusd supports MQTT handling by using the mosquitto library connecting to an MQTT broker. In order to use it, a running mosquitto instance is necessary (see mosquitto.org).

To enable MQTT support, a corresponding build is necessary and the MQTT port needs to be enabled (see --mqttport). The MQTT topic published to (and also subscribed to) can be adjusted by using the --mqtttopic option and defaults to "ebusd/%circuit/%name" where "%circuit" is replaced by the circuit name and "%name" by the message name.

When MQTT is activated and the broker connection was established successfully, ebusd publishes to the topic all changed messages that match the default access level or that of the user "mqtt" (see "--aclfile").

In addition to the message specific topics, ebusd also feeds the following general topics (where the "ebusd" prefix depends on how the topic is configured):

  • ebusd/global/version: the version string of ebusd (retained)
  • ebusd/global/running: true as long as ebusd is running (retained)
  • ebusd/global/uptime: the up time in seconds
  • ebusd/global/signal: true or false depending on the signal state
  • ebusd/global/updatecheck: the result of the update check (retained)

Due to the subscription to the topic, ebusd also allows actively sending messages on the eBUS. This is supported by using a specific suffix to the topic:

  • /get: initiates an active refresh of a read message from the eBUS.
    When the message was read, ebusd send the corresponding topic to MQTT.
  • /set: allows to send a write message to the eBUS (if the access level allows it, see above).