Understanding the to RPI flow - langanjp/PI-NodeRED GitHub Wiki

Example PI Web API to Node-RED / Raspberry PI


This flow shows a simple flow to retrieve the value of sinusoid from PI with the PI Web API. As mentioned earlier, it is a 2 step process - first to get a WebId from the tag or attribute, next to get the value. This data can be sent to the Sense HAT or a UI mentioned later on this page.

Example of PI Web API - Batch Controller to Node-Red / Raspberry PI


The PI Web API Batch Controller allows for several PI Web API queries to be combined. Because there is only one call to the PI Web API server for multiple API calls, it is inherently faster than doing individual calls. This example takes the sinusoid example above and uses the Batch Controller to find the WebId and the value in 1 Pi Web API call, instead of 2 separate calls. More information on using the Batch Controller can be found at PI Square:

Example of PI Web API - Channel (websocket) to Node-RED / Raspberry PI


This example builds on the last 2 examples. This uses websocket technology to subscribe to a data feed. In this case, it subscribes to get updates on the same sinusoid tag. There is no need to re-query, the PI Web API server will send new values as they occur on the PI Server.

Because of Node-RED limitations, this currently requires anonymous access to the PI Web API. For warning information, see https://github.com/langanjp/PI-NodeRED/wiki/PI-Web-API-Settings#anonymous-access-warning

Displaying content on a Raspberry PI - from Node-RED

Aside from devices like the Sense HAT that can be used to display information, Node-RED can be used as a local web server, able to pull PI data (and even subscribe with PI Web API Channel functionality) and display it via a user's web browser. While there are not examples of these in this tutorial, there are 2 readily available packages that are worth mentioning.

Dashboard UI

Dashboard UI is a fully integrated UI for Node-RED, including a set of nodes to build the dashbaord. It is maintained by the same people that maintain Node-RED. While it is not installed out of the box, you can find install information at: https://flows.nodered.org/node/node-red-dashboard

Freeboard

Freeboard is a standalone dashboard application (Freeboard.io) that can be easily integrated into node red with https://www.npmjs.com/package/node-red-contrib-freeboard. This adds nodes to be able to use Node-RED as a data source for Freeboard.

Next Section

Node-RED in the Cloud