13.4.5. Exporting, Importing and Duplicating Parsers

Creating a parser for a device can be intricate and time-consuming. You may want to re-use your parser definitions in other projects, without the need to reconstruct the parsing and publishing scripts.

To save a parser configuration as a template, select the schema in the list, and then press the Save Template button below the parser list.

You will be prompted for a template name. Choose a name that represents the type of device for which this configuration applies.

The template will then be saved to disk in your DataHub configuration folder and added to the "Templates" list beneath the list of parsers.

You can create a parser configuration from this template by selecting the + button or double-clicking the template name. You can delete the template completely from disk by pressing the X button.

When you press the + button, a new parser definition is created based on the template and added to the parser list. This allows you to save a configuration and then duplicate it to make changes that would be typical of related devices from the same manufacturer. You can change the name of a parser in the parser list by double-clicking its name.

To export the template to a file, select the template in the Templates list and then press the Export... button. You will be prompted to store the template file on disk. You can copy this file to another system and use the Import... button to load that template into your Templates list on the destination system. As you work with more MQTT devices your library of templates will grow, reducing the time and effort of subsequent projects.