Skip to main content

Dojot flow node.

Project description

# dojot-flow-node-python

A Python library that allows you to integrate your own node on Dojot's [FlowBroker](

## How to build your own node

1) You need to create a class that extends the `DataHandlerBase` class, this
class is the responsable by implements your node behavior. The following methods
__must be__ implemented:
- get_node_representation_path
- get_metadata
- get_locale_data
- handle_message

2) Is necessary to create a `.html` file that describes your node. You can find how to create it using the [NodeRed documentation]( Dojot's FlowBroker uses the [NodeRed]( frontend.

3) You need to encapsulate your code into a docker container.

4) Publish your container in some public repository like [DockerHub]( or some private based on [DockerRegistry](

5) Call the FlowBroker endpoint to add a new node. Please check the [FlowBroker documentation]( to check
how this endpoint works.

## Sample
A sample node is attached to this package to illustrate the steps described in
the previous section. It's a simple node that converts a Celcius temperature
measure into Kelvin.

### How to build

Build the docker image:
cd sample_node
docker build -t <your dockerHub username>/kelvin .

Publish it on your DockerHub:
docker push <your dockerHub username>/kelvin

Acquire a Dojot's token:
curl -X POST \
-H 'Content-Type:application/json' \
-d '{"username": "admin", "passwd" : "admin"}'

This command will return a JWT token, you need to store it on an environment
export JWT=<the value returned>

Add the Kelvin node to Dojot.
curl -H "Authorization: Bearer ${JWT}" http://localhost:8000/flows/v1/node -H 'content-type: application/json' -d '{"image": "<your dockerHub username>/kelvin:latest", "id":"kelvin"}'

Now the Kelvin node will be available on `converters` category into the FlowBroker Dojot's interface.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for dojot-flow-node, version 0.0.10
Filename, size File type Python version Upload date Hashes
Filename, size dojot_flow_node-0.0.10-py2-none-any.whl (6.0 kB) File type Wheel Python version py2 Upload date Hashes View
Filename, size dojot_flow_node-0.0.10-py3-none-any.whl (6.0 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size dojot-flow-node-0.0.10.tar.gz (3.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page