Skip to main content

Custom Plugins

Custom Plugins let you extend a project with your own features and blocks, without waiting for them to be built into AppBlocks. A plugin is a definition stored in the project. It declares the settings users can configure and the code AppBlocks inserts into the generated application.

Use a plugin to add support for a sensor that isn't in the library, wrap a vendor SDK, or package logic you reuse across projects.

Plugin Types​

Each plugin has a Feature Type that decides where it appears in the editor:

TypeAppears inUse it for
ServiceThe Features tab, under Custom ServicesBackground functionality such as a Modbus gateway or a protocol client.
PeripheralThe board's peripheralsA sensor, actuator or communication interface wired to the board.
BlockThe block library on the canvasAn action or event that users place in their flows.
Array Sub ItemInside another pluginRepeated entries of a Service plugin, such as one item per connected device.

Plugin Properties​

  • Name: the name shown in the editor.
  • Feature ID: a unique identifier, also used when other plugins reference this one. IDs of Block plugins must start with node_custom_. Two plugins in a project can't share an ID.
  • Version: the plugin's version.
  • Runtimes: the runtimes the plugin supports: TiOS, MicroPython and Zephyr.
  • Requirements: what the project must provide, for example Network.
  • Dependencies: built-in features or libraries the plugin needs. They are added to the project with it.
  • Provided Capabilities: what the plugin makes available to others. For example, a cellular modem plugin can provide network, which satisfies features that require a network connection.
  • Settings: the properties users configure. See below.
  • Code Blocks: the code AppBlocks generates for the plugin. See below.
  • Variables: values a Block plugin passes to the blocks connected after it, such as the result of a calculation.

Settings​

Each setting becomes a property in the plugin's panel:

  • Setting ID: identifier used to reference the value in code.
  • Name and Description: label and help text shown to users.
  • Setting Type: Name, Value, Dropdown, Array, Feature (a reference to another feature), or Pin.
  • Data Type: String, Byte, Float, Integer, Boolean, DWORD, or Long.
  • Pin Requirement: for pin settings, the capability the pin must have: GPIO, Interrupt, PWM, ADC, or a serial line (TX, RX, RTS, CTS, DTR, DSR).
  • Required, Default Value, Dropdown Options, and State (Enabled, Disabled, or Hidden).

Code Blocks​

A code block is a piece of code, or a whole file, that AppBlocks inserts into the generated project:

  • Code Type: Code inserts a snippet at a location; File adds a file, named by File Name, to the project.
  • Runtime: which runtime the block applies to.
  • Code ID: a unique identifier. Only one code block with a given ID is emitted, so shared code isn't duplicated when a plugin is used more than once.
  • Code Location: where the code goes, for example Boot, Boot Complete, System Tick, Network Connected, Global Includes, or Function Definitions. Block plugins can also use Block Triggered, which places the code where the block runs in a flow. Any other location marker found in the generated code can also be used.
  • Code: the code itself.

Code can refer to the plugin's configuration through template variables:

VariableValue
{{feature}}, {{feature.id}}The plugin instance and its ID.
{{feature.settings.SETTING_ID}}The value of one of the plugin's settings. For pin settings, .pin gives the pin.
{{parent}}, {{parent.settings.SETTING_ID}}The parent plugin, for Array Sub Item plugins.
{{project}}, {{project.device}}The project and its target device.
{{block.output}}The output of a Block plugin.

The code editor autocompletes setting IDs as you type.

See Also​