element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Industrial Automation
  • Technologies
  • More
Industrial Automation
Blog Connect to AVNET iotconnect.io with Node-RED - part 4: set up Node-RED and first exchange
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Industrial Automation to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 9 Mar 2021 8:24 PM Date Created
  • Views 996 views
  • Likes 2 likes
  • Comments 2 comments
  • iotconnect
  • raspberry
  • avnet
  • smartedge
  • node_red
  • cloud
  • iotconnect.io
Related
Recommended

Connect to AVNET iotconnect.io with Node-RED - part 4: set up Node-RED and first exchange

Jan Cumps
Jan Cumps
9 Mar 2021

AVNET's iotconnect.io cloud platform is an online service that you can use to send data to, and then show it on a dashboard*. In this blog series I'm learning how to talk to it with Node-RED.

In this post: install the palette and test!.

image

 

Install the Node-RED SDK

 

The iotconnect module for Node-RED has two components, a connection and a command inserter.

 

image

 

To install, navigate to the Node-RED install directory.

On a Linux machine, that's often the .node-red subdir of your home.

 

Then register to the iotconnect repo

 

$ npm adduser --registry https://repo.iotconnect.io/
$ username: <retrieve from https://help.iotconnect.io/documentation/sdk-reference/device-sdks-flavors/node-red/  >
$ password: <retrieve from https://help.iotconnect.io/documentation/sdk-reference/device-sdks-flavors/node-red/  >

 

Enter an email address - I used the one from my iotnet.io subscription. AVNET informed me that if you have issues with the download account, you can reach out to https://knowledgebase.iotconnect.io/contact/

 

Then install the nodes:

 

$ npm install iotconnect-nodered-sdk --registry https://repo.iotconnect.io/

 

The nodes are added to your installation.

 

Connect for the first time

 

Start node-red and surf to the designer page.

 

Create a new flow, and place a connection:

 

image

You have to enter 3 attributes:

  • CPID. This is the customer number on the Key Vault page. Do not share this
  • Unique ID. Your device's unique ID as available on the Device page
  • ENV. Selection box. Select the Environment that's shown in the key vault.

 

Deploy the flow. If you did everything correctly, the node shows it's connected.

image

The dot coloured green:

image

 

Celebrate.

 

First Data exchange

 

Let's send the first telemetry data to the iotconnect.io cloud.

 

Add an IotConnect Injecter node and fill in the JASON package:

 

image

 

[
    {
        "uniqueId": "e14nodered1",
        "data": {
            "Temperature": "21"
        }
    }
]

 

The uniqueID is the same one you used when defining the connection.

The attribute has to be one that's registered in the template. We added Temperature.

 

I added a debug block at the end as part of the test, but that's not needed.

It shows the payload , if it's sent correctly to the cloud.

image

 

Press the Inject node's button. The message is sent to iotconnect.io:

image

 

Celebrate again.

In the next post: commands from the cloud.

 

This is the source code of my final flow.

You can import this in Node-RED by clicking the 3-bars icon in the right up corner of your Node-RED editor, then select import.

You will have to update cpID and uniqueID.

 

[
   {
      "id":"df3bfead.a2439",
      "type":"tab",
      "label":"AVNET IotConnect e14",
      "disabled":false,
      "info":""
   },
   {
      "id":"e711923e.ef5d8",
      "type":"IoTConnect",
      "z":"df3bfead.a2439",
      "cpId":"USEYOURCPID",
      "uniqueId":"e14nodered1",
      "env":"PROD",
      "offlineStorageEnable":false,
      "sizeLimit":0,
      "fileCount":0,
      "isSecure":false,
      "sslKey":"",
      "sslCert":"",
      "sslCA":"",
      "x":635,
      "y":380,
      "wires":[
         [
            "77a78d77.1e42a4"
         ],
         [
            "43b9c47.dc8b83c",
            "66d83cd3.f10e34"
         ],
         [
            
         ]
      ],
      "l":false
   },
   {
      "id":"3f1d5622.789b8a",
      "type":"IoTConnect-Injector",
      "z":"df3bfead.a2439",
      "iType":"SendData",
      "descText":"",
      "payload":"",
      "x":475,
      "y":380,
      "wires":[
         [
            "e711923e.ef5d8"
         ]
      ],
      "l":false
   },
   {
      "id":"93b6ac97.e0525",
      "type":"inject",
      "z":"df3bfead.a2439",
      "name":"",
      "props":[
         {
            "p":"payload"
         }
      ],
      "repeat":"",
      "crontab":"",
      "once":false,
      "onceDelay":0.1,
      "topic":"",
      "payload":"[{\"uniqueId\":\"e14nodered1\",\"data\":{\"Temperature\":\"-1\"}}]",
      "payloadType":"json",
      "x":175,
      "y":380,
      "wires":[
         [
            "3f1d5622.789b8a"
         ]
      ],
      "l":false
   },
   {
      "id":"80319059.b447a",
      "type":"random",
      "z":"df3bfead.a2439",
      "name":"random temperature",
      "low":"-10",
      "high":"65",
      "inte":"true",
      "property":"payload[0].data.Temperature",
      "x":235,
      "y":420,
      "wires":[
         [
            "3f1d5622.789b8a"
         ]
      ],
      "l":false
   },
   {
      "id":"358a344c.e4788c",
      "type":"inject",
      "z":"df3bfead.a2439",
      "name":"",
      "props":[
         {
            "p":"payload"
         }
      ],
      "repeat":"300",
      "crontab":"",
      "once":true,
      "onceDelay":0.1,
      "topic":"",
      "payload":"[{\"uniqueId\":\"e14nodered1\",\"data\":{\"Temperature\":\"0\"}}]",
      "payloadType":"json",
      "x":175,
      "y":420,
      "wires":[
         [
            "80319059.b447a"
         ]
      ],
      "l":false
   },
   {
      "id":"da5174df.fac2b8",
      "type":"comment",
      "z":"df3bfead.a2439",
      "name":"iotconnect.io \\n send",
      "info":"",
      "x":510,
      "y":320,
      "wires":[
         
      ]
   },
   {
      "id":"a38ec099.0860e",
      "type":"comment",
      "z":"df3bfead.a2439",
      "name":"iotconnect.io \\n communicate",
      "info":"",
      "x":690,
      "y":320,
      "wires":[
         
      ]
   },
   {
      "id":"de5e0d4f.24ad8",
      "type":"comment",
      "z":"df3bfead.a2439",
      "name":"temperature",
      "info":"",
      "x":210,
      "y":340,
      "wires":[
         
      ]
   },
   {
      "id":"fa433c1a.1f67a",
      "type":"IoTConnect-Injector",
      "z":"df3bfead.a2439",
      "iType":"SendCommandAck",
      "descText":"",
      "payload":"",
      "x":715,
      "y":460,
      "wires":[
         [
            "e711923e.ef5d8"
         ]
      ],
      "l":false
   },
   {
      "id":"43b9c47.dc8b83c",
      "type":"switch",
      "z":"df3bfead.a2439",
      "name":"ACK?",
      "property":"payload.ack",
      "propertyType":"msg",
      "rules":[
         {
            "t":"true"
         },
         {
            "t":"false"
         }
      ],
      "checkall":"false",
      "repair":false,
      "outputs":2,
      "x":610,
      "y":460,
      "wires":[
         [
            "fa433c1a.1f67a"
         ],
         [
            
         ]
      ]
   },
   {
      "id":"c8d6826d.93e39",
      "type":"comment",
      "z":"df3bfead.a2439",
      "name":"receipt mgt",
      "info":"",
      "x":640,
      "y":500,
      "wires":[
         
      ]
   },
   {
      "id":"77a78d77.1e42a4",
      "type":"debug",
      "z":"df3bfead.a2439",
      "name":"",
      "active":true,
      "tosidebar":true,
      "console":false,
      "tostatus":false,
      "complete":"true",
      "targetType":"full",
      "statusVal":"",
      "statusType":"auto",
      "x":915,
      "y":380,
      "wires":[
         
      ],
      "icon":"font-awesome/fa-bug",
      "l":false
   },
   {
      "id":"ecf3a6a7.18f888",
      "type":"comment",
      "z":"df3bfead.a2439",
      "name":"iotconnect.io \\n receive",
      "info":"",
      "x":930,
      "y":320,
      "wires":[
         
      ]
   },
   {
      "id":"66d83cd3.f10e34",
      "type":"debug",
      "z":"df3bfead.a2439",
      "name":"",
      "active":false,
      "tosidebar":true,
      "console":false,
      "tostatus":false,
      "complete":"true",
      "targetType":"full",
      "statusVal":"",
      "statusType":"auto",
      "x":735,
      "y":400,
      "wires":[
         
      ],
      "icon":"font-awesome/fa-bug",
      "l":false
   }
]



 

The Python SDK with On Semiconductor RSL10 BLE article seriesIndustry
part 1: overview and goal
part 2: WiFi Provisioning
part 3: Adding a Module (RSL10)
part 4: Talk BLE to the On Semi RSL10 Sensor Kit
part 5: A Cloud User Experience Example
part 6: Register as a Gateway Device
part 7: Register a Gateway and Client Devices
The NODE-Red SDK article seriesIndustry
part 1: overview and goal
register a Thing and connect to IoTConnect.io cloud
part 2: create an account and log on to the portal
part 3: set up the thing and its interface in the cloud
part 4: set up Node-RED and first exchange
interact with IoTConnect.io cloud
part 5: online dashboard
part 6: rules and alerts
part 7: messages and commands from the cloud
safer connections with certificates
part 8a: safer connect with Self Signed Certificates
part 8b: safer connect with CA certificatesY
commercial and industrial scale: outsource certificate generation and programming to subcontractors and suppliers
part 9a: Outsource Certificate Signing in IIoT Supply ChainY
part 9b: IIoT supply chain and Certificates - Create Ca Root certificate, Load to IoTConnect Cloud and ValidateY
part 9c: IIoT supply chain and Certificates - Create an Intermediate CA Certificate for your SubcontractorY
part 9d: IIoT supply chain and Certificates - Subcontractor Generates a Thing Certificate for Your DeviceY
part 9e: IIoT supply chain and Certificates - Test!Y
commercial and industrial scale: Trusted Platform Module (TPM) Authentication
part 10: Trusted Platform Module (TPM) SecurityY
Infineon SLx9670 Trusted Platform Module (TPM) for IoT SecurityY
The Automate Device Provisioning and Cloud Configuration article seriesIndustry
Automatic Provisioning with REST APIY
  • Sign in to reply

Top Comments

  • Jan Cumps
    Jan Cumps over 4 years ago +1
    What my post does not show, is that this works well together with the common Node-RED components: The payload does not have to come from the bespoke IotConnect injector. You can keep it empty and feed…
  • Jan Cumps
    Jan Cumps over 4 years ago

    I've added the final Node-RED code to the post.

    If you want to reuse it, import it.

    Then correct the CPID and Unique ID in the Connection node and all upstream nodes.

     

    [
       {
          "id":"df3bfead.a2439",
          "type":"tab",
          "label":"AVNET IotConnect e14",
          "disabled":false,
          "info":""
       },
       {
          "id":"e711923e.ef5d8",
          "type":"IoTConnect",
          "z":"df3bfead.a2439",
          "cpId":"USEYOUROWNCPID",
          "uniqueId":"e14nodered1",
          "env":"PROD",
          "offlineStorageEnable":false,
          "sizeLimit":0,
          "fileCount":0,
          "isSecure":false,
          "sslKey":"",
          "sslCert":"",
          "sslCA":"",
          "x":635,
          "y":380,
          "wires":[
             [
                "77a78d77.1e42a4"
             ],
             [
                "43b9c47.dc8b83c",
                "66d83cd3.f10e34"
             ],
             [
                
             ]
          ],
          "l":false
       },
       {
          "id":"3f1d5622.789b8a",
          "type":"IoTConnect-Injector",
          "z":"df3bfead.a2439",
          "iType":"SendData",
          "descText":"",
          "payload":"",
          "x":475,
          "y":380,
          "wires":[
             [
                "e711923e.ef5d8"
             ]
          ],
          "l":false
       },
       {
          "id":"93b6ac97.e0525",
          "type":"inject",
          "z":"df3bfead.a2439",
          "name":"",
          "props":[
             {
                "p":"payload"
             }
          ],
          "repeat":"",
          "crontab":"",
          "once":false,
          "onceDelay":0.1,
          "topic":"",
          "payload":"[{\"uniqueId\":\"e14nodered1\",\"data\":{\"Temperature\":\"-1\"}}]",
          "payloadType":"json",
          "x":175,
          "y":380,
          "wires":[
             [
                "3f1d5622.789b8a"
             ]
          ],
          "l":false
       },
       {
          "id":"80319059.b447a",
          "type":"random",
          "z":"df3bfead.a2439",
          "name":"random temperature",
          "low":"-10",
          "high":"65",
          "inte":"true",
          "property":"payload[0].data.Temperature",
          "x":235,
          "y":420,
          "wires":[
             [
                "3f1d5622.789b8a"
             ]
          ],
          "l":false
       },
       {
          "id":"358a344c.e4788c",
          "type":"inject",
          "z":"df3bfead.a2439",
          "name":"",
          "props":[
             {
                "p":"payload"
             }
          ],
          "repeat":"300",
          "crontab":"",
          "once":true,
          "onceDelay":0.1,
          "topic":"",
          "payload":"[{\"uniqueId\":\"e14nodered1\",\"data\":{\"Temperature\":\"0\"}}]",
          "payloadType":"json",
          "x":175,
          "y":420,
          "wires":[
             [
                "80319059.b447a"
             ]
          ],
          "l":false
       },
       {
          "id":"da5174df.fac2b8",
          "type":"comment",
          "z":"df3bfead.a2439",
          "name":"iotconnect.io \\n send",
          "info":"",
          "x":510,
          "y":320,
          "wires":[
             
          ]
       },
       {
          "id":"a38ec099.0860e",
          "type":"comment",
          "z":"df3bfead.a2439",
          "name":"iotconnect.io \\n communicate",
          "info":"",
          "x":690,
          "y":320,
          "wires":[
             
          ]
       },
       {
          "id":"de5e0d4f.24ad8",
          "type":"comment",
          "z":"df3bfead.a2439",
          "name":"temperature",
          "info":"",
          "x":210,
          "y":340,
          "wires":[
             
          ]
       },
       {
          "id":"fa433c1a.1f67a",
          "type":"IoTConnect-Injector",
          "z":"df3bfead.a2439",
          "iType":"SendCommandAck",
          "descText":"",
          "payload":"",
          "x":715,
          "y":460,
          "wires":[
             [
                "e711923e.ef5d8"
             ]
          ],
          "l":false
       },
       {
          "id":"43b9c47.dc8b83c",
          "type":"switch",
          "z":"df3bfead.a2439",
          "name":"ACK?",
          "property":"payload.ack",
          "propertyType":"msg",
          "rules":[
             {
                "t":"true"
             },
             {
                "t":"false"
             }
          ],
          "checkall":"false",
          "repair":false,
          "outputs":2,
          "x":610,
          "y":460,
          "wires":[
             [
                "fa433c1a.1f67a"
             ],
             [
                
             ]
          ]
       },
       {
          "id":"c8d6826d.93e39",
          "type":"comment",
          "z":"df3bfead.a2439",
          "name":"receipt mgt",
          "info":"",
          "x":640,
          "y":500,
          "wires":[
             
          ]
       },
       {
          "id":"77a78d77.1e42a4",
          "type":"debug",
          "z":"df3bfead.a2439",
          "name":"",
          "active":true,
          "tosidebar":true,
          "console":false,
          "tostatus":false,
          "complete":"true",
          "targetType":"full",
          "statusVal":"",
          "statusType":"auto",
          "x":915,
          "y":380,
          "wires":[
             
          ],
          "icon":"font-awesome/fa-bug",
          "l":false
       },
       {
          "id":"ecf3a6a7.18f888",
          "type":"comment",
          "z":"df3bfead.a2439",
          "name":"iotconnect.io \\n receive",
          "info":"",
          "x":930,
          "y":320,
          "wires":[
             
          ]
       },
       {
          "id":"66d83cd3.f10e34",
          "type":"debug",
          "z":"df3bfead.a2439",
          "name":"",
          "active":false,
          "tosidebar":true,
          "console":false,
          "tostatus":false,
          "complete":"true",
          "targetType":"full",
          "statusVal":"",
          "statusType":"auto",
          "x":735,
          "y":400,
          "wires":[
             
          ],
          "icon":"font-awesome/fa-bug",
          "l":false
       }
    ]

     

    If you use the same Unique ID as me in your exercise, only change the CPID in the Connect node.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 4 years ago

    What my post does not show, is that this works well together with the common Node-RED components:

    image

     

    The payload does not have to come from  the bespoke IotConnect injector. You can keep it empty and feed it with a payload:

    image

     

    The payload in my little demo here comes as a JSON message from a generic component. In this case a plain Node-RED injector:

     

    image

    but it could come from any Node-RED source.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube