Skip to content

Configure MQTT output plugin

jbouwh edited this page May 20, 2021 · 1 revision

This output plugin enables you to publish your logging data to MQTT. MQTT is an IoT protocol that can be used in combination with Home Assistant, Domoticz, OpenHab or Homey. The MQTT plugin publishes all elements using the MQTT Auto discovery guidelines. When used in combination with Home Assistant this wil automatically create all sensors with appropriate units and icons within Home Assistent using the standaard MQTT integration.

To use MQTT this autodiscovery make sure you enable this in your Home Assistant configuration.yaml file like:

# Example configuration.yaml entry
mqtt:
  discovery: true
  discovery_prefix: homeassistant

If you are using the omniklogger proxy script you might notice that the settings for MQTT are in the same section [output.mqtt]. See the settings section for the MQTT output plugin.

To enable MQTT output further you will need to add mqtt in the list output in the section [plugins].

To publish to MQTT you need a MQTT server running and the permission to publish to it. The hostname is set with the key key host and is localhost by default.

Additional you need to set username and password. These are mandantory settings to enable MQTT output.

Basically MQTT is about publishing payload to topics. With MQTT auto discovery this payload can be a state, attributes or config. The topics for publishing have the format {prefix}/{class}/{devicename}[_{plant_id}][/{field_name}].

The default for prefix is homeassistant but can be changed with the key discovery_prefix.

Class is sensor or binairy_sensor for the omnikdataloggerproxy topics.

Devicename is the devicename of an asset class. Read more here about asset classes.

The omnik portal plant_id will be appended to devicename if the key append_plant_id is set to true.

The field_name is the name that is also used in the data_fields.json config file.

State and attributes (including device attributes) will be published at asset class level {prefix}/{class}/{devicename}[_{plant_id}]/ with sub topics ~/state and ~/attr. Config will be published with topic ~/{field_name}/config.

The display names of the topics default to the name tag in the data_fields.json config file but can also have an override using the config file.