Overview

If you’re new to Node-RED but have not yet worked through the Hello, world! example, please do so now.

In this section, we’ll add a SNAP PAC Read node, configure the controller’s address, and run the flow.

Step 1 - Add a SNAP PAC Read Node

  1. Drag out an Inject node, a SNAP PAC Read node, and a Debug node.
  2. Wire them together, as shown below.
Static Image
Click the image to start and stop the animation.

Step 2 - Configure the SNAP PAC Node

  1. Double-click the SNAP PAC Read node to open the Edit snap pac read node view. Since this is the first SNAP PAC node, a controller configuration must be added.
  2. Click the pencil icon to the right of the Controller field to open the Edit pac-device node view.
  3. For the PAC Address fields, select HTTPS or HTTP and enter the IP address of the controller.
  4. Enter a SNAP PAC REST API key in the API Key ID and Value fields. The key should match one of the keys entered in the controller’s Authentication Key Management page, as described in Step 4 of the controller configuration section.
  5. If using HTTPS, then also configure the SSL Certificates fields. More information on SSL certificates is available in the PAC security with Node-RED section.

    IMPORTANT: The certificate files need to be on the GROOV-AR1 or the same computer as the Node-RED installation, as it will open the certificate file directly from the file system.

    • If using a self-signed certificate, then enter the certificate’s filename in the “CA or Self-Signed” field.
      • If using a GROOV-AR1, just enter the filename of a certificate you uploaded using Node-RED Admin.
      • If using Node-RED on a computer, enter the path and filename of a certificate on the same computer.
    • If using a CA-signed certificate, then enter the CA’s certificate’s filename in the “CA or Self-Signed” field and the PAC’s public key in the “Public Key” field.
      • If using a GROOV-AR1, just enter the filenames of the certificates you uploaded using Node-RED Admin.
      • If using Node-RED on a computer, enter the path and filenames of the certificates on the same computer.
  6. Click Done to return to the “Edit snap pac read node” view.
  7. Confirm that Data Type is set to Device Details.
  8. Click Done.
Static Image
Click the image to start and stop the animation.

Step 3 - Deploy and Run

  1. Click Deploy.
  2. Make sure the Debug tab is viewable in the right-hand sidebar.
  3. Click the Inject node’s button.
  4. The Debug tab should show a new message with details about the controller, such as the type of controller, firmware details, and MAC addresses.

    For example, { “controllerType”: “SNAP-PAC-S2”, “firmwareVersion”: “R9.5a”, “firmwareDate”: “07/07/2016”, “firmwareTime”: “13:07:00”, “mac1”: “00-A0-3D-00-D2-AF”, “mac2”: “00-A0-3D-00-D2-B0”, “upTimeSeconds”: 1719 }. It’s printed out as JSON, but it’s a JavaScript object, and easily used by other nodes in the flow.

If that worked for you, then your Node-RED installation is successfully communicating with your controller!

Static Image
Click the image to start and stop the animation.

Next Step

Continue on to reading strategy variables.