How-To Guides
Flows Guides

Use Access to Read from a Topic

5min

You can use Flows to read a topic from a tag through the local message broker using an Access Subscribe node.

Before you Begin

Make sure you create an Access API account. See Create an API Account and Manage API Accounts for more information.

Step 1: Add a Device

Follow the steps to Connect a Device and configure the following parameters:

  • Device Type: Simulator
  • Driver Name: Generator
  • Enable Alias Topics: Select the checkbox.

Step 2: Add Tags

After connecting the device, add the following tag. See Add Tags to learn more.

Tag 1

  • Name: Select S - Random value generator.
  • Value Type: Select int64.
  • Polling Interval: Enter 5.
  • Tag Name: Enter tag 1.

After the tag is created, click the Copy icon for the topic name for the tag. You will refer to this later.

The copy icon for the tag
The copy icon for the tag


Step 3: Create Access Flow

To read a topic from a tag using Access:

  1. In Litmus Edge, navigate to the Flows Manager and create a new flow. See Create a Flow to learn more.
  2. Drag the Access Subscribe and Debug nodes to the canvas and wire them together.

    Access Subscribe node
    Access Subscribe node
    
  3. In Litmus Edge, navigate to System > Tokens.
  4. Click the Action menu for the API account you created previously and select Edit topics.

    System Tokens page
    System Tokens page
    
  5. From the Edit topics dialog box, do the following:
    • Paste the topic name from Step 2 in the Read Topics field, and click Add Read Topic. The topic name appears below the Topic Name field.
    • Click Update.

      Edit topics dialog box
      Edit topics dialog box
      
  6. Return to the Flows browser tab and double-click the Access Subscribe node. The Edit access-subscribe node dialog box appears.
    • Topic Name: Paste the topic name from Step 2. If you paste a topic from the Tags pane that has not been added to the Access Read Topic field, you will get an error.
    • Click the Edit icon next to the Access field.

      Edit access-subscribe node dialog
      Edit access-subscribe node dialog
      
  7. Return to the System > Tokens browser tab and do the following:
    • Click the Action menu for the API account and select View API Key.
    • Click the Copy icon next to the API Key.

      Access accounts table
      Access accounts table
      
  8. Return to the Add new Access Connect config node dialog box in the Flows browser tab and do the following:
    • API Key: Paste the API key you copied.
    • Click Add or Update.

      Add new Access Connect config node dialog box
      Add new Access Connect config node dialog box
      
  9. Click Done and then click Deploy.

    Edit access-subscribe node dialog box
    Edit access-subscribe node dialog box
    
  10. Expand the message window beneath the flow and click the Debug icon.

    Flows canvas debug section
    Flows canvas debug section
    
  11. Click the Debug node button to view the output in the Debug message window.

    View the output for Access Subscribe node
    View the output for Access Subscribe node