Introduction

Node-RED is a visual programming tool that can connect groov I/O with various online services. In this tutorial, we’ll show you how to extract temperature data from a groov I/O ICTD channel and publish it into a cell in a Google Sheets spreadsheet using Node-RED.

Google Sheet Flow

Prerequisites

To use Node-RED for groov I/O, and Google Sheets, the following programs and packages must be available:

  • Node-RED
    • Node-RED is pre-installed in groov EPIC processors (GRV-EPIC-PR1), the groov Edge Appliance (GROOV-AR1), and the groov RIO.
    • You may also run your own instance of Node-RED on a computer or device, following our installation instructions.
  • groov I/O Node
    • The groov I/O node must be installed within Node-RED.
  • Google Sheets Node
  • Import Flow
    • Once both nodes are installed, you can import the flow by copying and pasting the following JSON text into the import dialog box:

      • COPY:

          [{"id":"5c47611399cb2998","type":"debug","z":"20dc47fb.76b788","name":"Debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1290,"y":280,"wires":[]},{"id":"507353f3669c4da0","type":"inject","z":"20dc47fb.76b788","name":"Inject","props":[{"p":"payload"}],"repeat":"","crontab":"0 8-17 * * 1,2,3,4,5","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":310,"y":280,"wires":[["959b0631.72b4f8"]]},{"id":"959b0631.72b4f8","type":"groov-io-read","z":"20dc47fb.76b788","device":"4a1f1f67.82653","dataType":"channel-analog","moduleIndex":"0","channelIndex":"0","mmpAddress":"0xF0D81000","mmpType":"int32","mmpLength":"1","mmpEncoding":"ascii","value":"temp","valueType":"msg","itemName":"","name":"Read Temp","x":550,"y":420,"wires":[["d65222f.2feb7e"]]},{"id":"01e3533a2e5f8510","type":"GSheet","z":"20dc47fb.76b788","creds":"f00d263defffe280","method":"append","action":"","sheet":"","cells":"Sheet1!A1:A2","flatten":false,"name":"Append Data","x":1050,"y":440,"wires":[["5c47611399cb2998"]]},{"id":"d65222f.2feb7e","type":"function","z":"20dc47fb.76b788","name":"Format Data","func":"msg.payload = \n[new Date(msg.payload).toLocaleString(),msg.temp.toFixed(2)\n       ];\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":810,"y":280,"wires":[["01e3533a2e5f8510"]]},{"id":"4a1f1f67.82653","type":"groov-io-device","address":"localhost","msgQueueFullBehavior":"DROP_OLD"},{"id":"f00d263defffe280","type":"gauth","name":"Unknown"}]
        

Overview

Beyond the above prerequisites, the following steps must be taken to use the nodes:

  1. Create a Google service account and Enable the Google Sheet API.
  2. Configure the groov I/O node to read temperature data
  3. Configure the Google Sheets node to create a new row in a spreadsheet.

Each of these steps is described in the following sections.

Next Step

Continue to Creating an API with Google.