Skip to content

Customize publishing output

Jan Bouwhuis edited this page Nov 15, 2021 · 2 revisions

Renaming MQTT entities

The name of MQTT entities can be customized by config. This will override any (display)name changes in data_fields.json. See for more information the section Renaming entities in the README.md.

Renaming MQTT datalogger entity

The Omnik data logger proxy script can help to intercept the data. To enable further processing with Omnik data logger the data is can be forwarded using TCP, but better is using MQTT. Through Home Assistant MQTT Auto Discovery by default te name 'Datalogger' will be assigned to the auto created entity. The assigned entity name will then be binary_sensor.datalogger, if it did not exist yet. This as a relation when using the hassapi plugin for the localproxy client. When using the mqtt_proxy plugin the logger_sensor_name should match the datalogger name set by the proxy script.

Customizing device attributes

Through MQTT entities are grouped by devices that show up in Home Assistant through MQTT auto discovery. The name, model and brand of these devices can be be customized. Further it is possible to configure what attributes are set for the published entities. These attributes also are applied when publishing to InfluxDB. See for more information the section Device attribute settings in the README.md. The section explains how asset classes are defined en how they have have a relation with data_fields.json.

Customizing data_fields.json

If you want to customize icon or unit, the MQTT value template or you want to edit the tags or measurement you can do this in data_fields.json. When entities are removed from data_fields.json, they will no longer appear in the output. This does not effect the pvoutput output plugin. When you are planning to customize data_fields.json, I strongly advise to make a copy and place this somewhere safe in a configuration folder. Since data_fields.json is part of the software, it will be updated and overwritten when you update the software! Make sure you have no synax errors in the file, since this might break Omnik data logger. If after an update you have some trouble, try to restore the supplied data_fields.json before you report an issue. The path for the alternative data_fields.json can be set with the key data_config in the default section. By default Omnik data logger looks at the current path, of the executable, and the shared folder path when using pip3. The sections below show how the fields in data_fields.json are used by Omnik data logger. Omnik data logger will show what file it is using through the log (info).

key field in data_fields.json

This name should be unique and match one of the values read or calculated by Omnik data logger. It has no use to add values that do not exist. The default data_fields.json contains all usable fields. If you want to see what data is produced by the API's and is being send to the output, you could turn on the debugging using the command line arguments and see what data is dumped.

name

The name field is the default display name that is being used. It can be modified by config for MQTT. Changing this field also effects InfluxDB.

dev_cla

This field is set if there is a corresponding device_class in Home Assistant through MQTT auto discovery. Currently only power, temperature and timestamp are used. For each asset there should be only one timestamp field. This field is essential for output because it provides the time and date for the measurement.

ic

This field can be adapted to any valid icon. Use the icons of Material Design Icons cheat sheet. Omit the mdi- prefix.

measurement

This field must be set to enable output to InfluxDB. It is used the measurement in InfluxDB.

tags

The tag property is set as a dict containing the tags to be set using InfluxDB.

filter

The filter property is be used to append the MQTT value template send through the MQTT configuration topic. This is useful for multiplication and rounding of values send over MQTT to Home Assistant.

asset

This is the asset_class the field belongs to. The corresponding attributes are read from config. See the section Device attribute settings in the README.md for more information.