Skip to content

ogema io_for_node red

Jan Lapp edited this page Nov 26, 2019 · 1 revision

ogema-io for node-red

Input and output nodes are provided to get access to ogema resource tree in node-red applications.

Run the following command to install the ogema node globally.

npm -g i ogema-io

The ogema - node-red setup consists of three main parts. Those are the ogema framework instance, the node-red environment and the node-red client running in a browser. These components can run on the same or diferent plattforms. The following instructions are applied to the case that the node-red environmentand the browser run on the same machine. 

The counterpart of the ogema-io node on the ogema side is an app called mqtt-server. You will need the mqtt-server app installed on the OGEMA-platform in order to use this node in node-red. The mqtt-server app is a commercial component for ogema. You can get more information about availability and pricing of mqq-server app under info@ogema.org.

Usage

 

The ogema-io node needs some configuration settings to communicate with ogema. Once an ogema in or out node is dragged to the node-red flow the configuration form is opened by double click on it. The first stage of the form looks like in the following image. The content of each field in this form is explained below:

Picture 1

  • GatewayID: The ogema gateway id is the value of the property org.ogema.secloader.gatewayidentifier on the ogema plattform. The gateway id is aimed to be unique identifier of the ogema plattform. With this id the same topic name on different ogema instances can be adressed, because the gateway id is added as prefix to each topic name.
  • Visualisation: If this feature is enabled, the node gets an additional label with the current value as an alias sticked on it's bottom side.
  • Server: This is the ogema mqtt-server adress which is the ip adress or the hostname of the plattform that the ogema instance is running on with the number of the port the mqtt server is listening on. The port number is the value of the property de.fhg.iis.ogema.mqttserver.port and it defaults to 1883.
  • Topic: This is the ogema resource id, the id of an ogema value resource that the node is connected with.
  • QoS: mqtt quality of service as defined in mqtt specification (see http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718099)
  • Name: This is the label shown in the ogema-io node. You can leave it empty to get the topic name as label.

 

The server configuration shold be processed in detail. A valid configuration of the connection to the mqtt-server is depicted in the image below.

Picture 2

If a secure connection is enabled, a TLS configuration should be setup. The certificate and key files needed for the TLS connection are generated by the mqtt-server app on the ogema side. The Three files node-red-vm_OGEMAside.pem, node-red-vm_OGEMAsidePriv.key and rootCert.pem are stored in the localRoot directory within the run directory of the ogema framework. These files are set in the TLS configuration as Certificate, Private Key and CA Certificate in the same order. The following picture shows a valid TLS configutation. This configuration is valid for the case that Ogema and node-red (not the browser but the nodejs process started with the command like "node-red -v flow_file") run on the same host. Otherwise the files node-red-vm_Browserside.* should be used.

 

Picture 3

On the 'Security' tab in the Picture 2 the login data of a valid ofgema user is entered. The permissions of this user are considered during the access to the ogema resources over node-red.

An example flow showing the usage of the ogema-io nodes can be downloaded here. Supposing you put the example flow into the local file /home/user/ogema-io-flow.json you can than start node-red like

node-red -v /home/user/ogema-io-flow.json

and the node-red environment looks like in the following image.

 

Attachments:

{width="8" height="8"} image2017-12-21 13:28:36.png (image/png) {width="8" height="8"} ogema-io-node-config-1.png (image/png) {width="8" height="8"} ogema-io-node-config-1_ohne beschriftung.png (image/png) {width="8" height="8"} ogema-io-node-config-2.png (image/png) {width="8" height="8"} ogema-io-node-tls-config.png (image/png) {width="8" height="8"} ogema-io-node-tls-config.png (image/png) {width="8" height="8"} example-flow.png (image/png)

Clone this wiki locally