Create a weeve Module

What are weeve Modules?

A weeve module is a single unit in an Edge Application that is created on the weeve Platform. The concept of a module is implemented directly on the concept of a container (i.e. Docker). A module is thus a parameterizable container with the appropriate meta-data sufficient for running it in the weeve platform.
We recognize three types of modules:
  • Input - these modules input data into the edge application. Data can come from sensors attached to the host device, from subscribing to an endpoint or from any other source that the module developer can think of. Example modules: MQTT Ingress, Modbus TCP Ingress or Camera Capture.
  • Processing - these modules process data available to the edge application (ingressed by Input modules). Data can be filtered according to a query, batched, aggregated or analysed in any other way. Some processing modules can even just encode the data specifically for some gateway. Example modules: Comparison Filter, Batcher, Aggregator or McClimate Vicki Encoder.
  • Output - these modules output data from the edge application. Data can be written to a database or a file, sent as a notification, passed to a third party or any other endpoint. Example modules: Vonage Alert, AWS DynamoDB Egress, HTTP Egress or CSV Export.
The weeve Manager presents all available modules. After selecting, each module is further configurable through its 'property' pane, as displayed in the figure below.
Modules & Properties
By placing multiple modules on the canvas, and by drawing a connecting line between connection nodes on each module, an edge application can be designed.
Edge Application
Each module is responsible for a single step in the edge application's data service. For instance, the MQTT Ingress module is responsible for subscribing to MQTT topics and reading (input) data into an edge application. A Fluctuation Filter filters out unwanted spikes from input data and provide stable output. The Slack Alert module sends notifications to a selected Slack channel.
In order to be successfully implemented into a weeve Edge Application, each module should consider the following three specifications that allow it to communicate within the application:
  1. 1.
    Ingress communication
    • Allows a module to receive input data that might be passed directly from IoT device sensors
    • Allows a module to receive input data from a previous module in the edge application
  2. 2.
    Processing
    • Data are processed to produce desired output and prepare it for further passing to the next part of the data pipeline
    • Processing the data is left to the module developer, who implements the module logic, and it can be controlled with parameters exposed through the ‘properties’ pane for that module
  3. 3.
    Egress communication
    • It allows the module to pass processed data to the next module or directly output to a data partner
The interaction between modules is implemented with a REST API, and could be visualized as follows:
Modules ReST API Communication Diagram

Module creation

In order to better understand the process of creating a deployable module, we decided to provide this brief overview of steps that the module developer should undertake. Of course, it is a flexible approach, so it can be adjusted to your company’s engineering practices.
Workflow
When creating a module, some steps must be handled by a module developer, these are marked with yellow in the above module lifecycle diagram, and the other will be handled by weeve as marked with blue. Let’s look closer at what exactly should be done by a module developer:
1. Create a module with one of our Boilerplates - depending on the type of your module (Input, Processing or Output), select the right Boilerplate and implement your code. Moreover, you might want to create an icon for your module that will be displayed in weeve Platform. This icon can be an abstract representation or a reference to the brand or company this module represent.
2. Create a module YAML file - if you finish implementing your module logic and you are happy with your module performance on your test cases, it is time to implement your module YAML file. The file is used to store module metadata, configuration and data serialization. Additionally, we use YAML file to create module's properties pane in weeve Platform and to enable users parameterization of the module.
Module YAML is used to create module's properties pane which enables users parameterize the module.
3. Containerize module and deploy to the repository - the next step requires publishing your module to a repository to allow the server to pull your modules and use them in the edge application. You can choose any container framework and registry compatible with the Docker ecosystem. More details on publishing your modules to the container repository you can find here.
4. Request registration into the weeve platform - for now, we are still working on automating this process, but you need to contact us with your Module YAML file and a link to its container image repository. You will find all contact details at the bottom of the overview page
In the next chapters, you will find a "Hello weeve!" example for creating a module and a detailed description of each mentioned step.