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.
- Place a groov View Write node onto your flow.
- Connect an Inject node to the input port. You do NOT need to connect a Debug node to the output port.
- Double-click on the groov View Write node to open the “Edit groov read node” view.
- For the Data Store field, select a configured Data Store (we’re still using “TestDataStore”).
- For the Tag Name field, enter the name of Data Store tag in your groov View project. We’ll use “integerTag1” again.
- For the Value field, select Value from the dropdown and enter a number.
- Click Done.
- Click Deploy.
- Make sure the Debug tab is open in the right-hand sidebar.
- Click the Inject node’s button.
- 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:
- Double-click on the Inject node.
- 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.
- Click Done.
- Double-click on the existing groov View Write node from above..
- Change the Value field from Value to msg.payload.
- Click Done.
- Click Deploy.
- Click the Inject node’s button.
- 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 View Write node, select the node in the node palette or one in a flow, and the help will be displayed in the Info tab.
Next Step
Continue on to moving weather data into groov Viewl.