Overview

In the previous example, we saw how to read a Data Store tag. Now let’s use a Write node to write to a Data Store tag.

Write to a Tag

Writing to a tag is very similar to reading.

  1. Place a groov Write node onto your flow.
  2. Connect an Inject node to the input port. You do NOT need to connect a Debug node to the output port.
  3. Double-click on the groov Write node to open the “Edit groov read node” view.
  4. For the Data Store field, select a configured Data Store (we’re still using “TestDataStore”).
  5. For the Tag Name field, enter the name of Data Store tag in your groov project. We’ll use “integerTag1” again.
  6. For the Value field, select Value from the dropdown and enter a number.
  7. Click Done.
  8. Click Deploy.
  9. Make sure the Debug tab is open in the right-hand sidebar.
  10. Click the Inject node’s button.
  11. Go to groov View and confirm that the value was written to the tag.

Write to a Tag from Message Object

The value to write can also come in a property on the msg object injected into the flow by the Inject node. Continuing from the previous section:

  1. Double-click on the Inject node.
  2. For the Payload field, select “number” from the dropdown list. In the text field, enter a number you wish to write to your groov tag.
  3. Click Done.
  4. Double-click on the existing groov Write node from above..
  5. Change the Value field from Value to msg.payload.
  6. Click Done.
  7. Click Deploy.
  8. Click the Inject node’s button.
  9. Go to groov View and confirm that the value was written to the tag.

This is just a preview of the power within Node-RED to build complex and dynamic solutions.

Further Help

Node-RED nodes include help documentation within Node-RED itself. For detailed help on the groov Write node, select the node in the node palette or one in a flow, and the help will be displayed in the Info tab.

Inline help for _groov_ Write node

Next Step

Continue on to moving weather data into groov.