Skip to content

Latest commit

 

History

History

node-red

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Node-RED (Device CLI)

This is directory that contains flow and settings used to create node-RED device.

Prerequisites

  • Docker

For running on host:

Running using Docker (recommended)

  • docker pull martinheinz/iot_cloud_node_red:latest
  • docker run -it --network host martinheinz/iot_cloud_node_red

Running on host

To start node-RED with prepared settings.js file

  • if you installed PBC just now (or have not logged out since) please log out and log back in, to export LD_LIBRARY_PATH globally (exporting it in one terminal session is not enough for node-RED)
  • if node-RED is installed in node_modules, then run:
    ./node_modules/node-red/bin/node-red-pi -s ./settings.js
  • if installed globally use node-red -s ./settings.js

Usage

  • After running, you can open browser flow editor at http://127.0.0.1:1880/

  • You will want to configure MQTT Broker and device credentials:

    • double click on any of the mqtt nodes (pink ones)
    • Click pencil Icon to the right of Local MQTT Broker
    • Set Server field to IP address of MQTT broker you are trying to connect to (see IoT-Cloud app config.env)
    • Optional step (Only if require_certificate true is set in mosquitto.conf): click Pencil Icon to the right of TLS Configuration and provide Certificate and CA Certificate. These should be the certs in mosquitto/certs/server/server.crt and mosquitto/certs/ca/ca.crt respectively
    • Next go to Security tab in broker settings and provide credentials to your previously registered device
    • Lastly click on each of the mqtt nodes (pink ones) and change d:<id> to ID of your device
    • Click Update and Deploy (top right)
  • At this point you should see message like this in console from which you ran node-RED:
    24 Mar 12:58:23 - [info] [mqtt-broker:Local MQTT Broker] Connected to broker: mqtts://172.26.0.8:8883

  • To see all debugging messages you can view console

  • To see triggered actions in browser click on Bug Icon in top right corner to display debug tab.

  • You can send data to server by clicking send_save_data Inject node

  • You can send/remove data to/from server by clicking send_add_fake_tuple Inject node and send_remove_fake_tuple respectively.