MENU
    Write to Machine Attributes using OPC UA/MQTT Protocols
    • 14 Feb 2025
    • 4 Minutes to read
    • Contributors

    Write to Machine Attributes using OPC UA/MQTT Protocols


    Article summary

    Learn how to write to machine attributes using OPC UA/MQTT protocols using Tulip

    In this article, you will learn:

    • How to create/edit a machine attribute that is writable?
    • How to set a machine attribute using app triggers?
    • Error/Warning Behaviours of Machine Attribute: Write

    Set up

    In order to set values to an attribute using OPC UA or MQTT protocol, you’ll need to set up a Machine and map it to a datasource so that you have data coming through. If you haven’t done this already, the following articles guide you through the process:


    Create/edit a machine attribute to be writable

    Machine Attributes in Tulip can be used across different machines. They can be either read+write (writable) or read-only. Follow these steps to create or edit a writable attribute:

    Create a Writable Attribute:

    1. Navigate to the Attributes List page.
    2. Click Create New Attribute.
    3. Enable the Write option and click Create.

    image.png

    Edit an Existing Attribute to Make it Writable

    1. Click the three dot menu next to the attribute and select Edit.

    Edit Attribute

    1. Check the the Enable write option.

    EnableWriteOption.png


    Write to a machine attribute using app triggers

    You can write to a machine attribute in trigger logic, including on buttons, when a device fires, on timers, or on Step level Triggers or App Level Triggers.

    1. In the trigger editor, add a new action.
    2. Select Write Machine Attribute from the drop-down list.
    3. Select Specific machine, variables, or machines at the desired station.
    4. Select the attribute you want to write to.
    5. Select the data value you want to write to.

    image.png

    In the above example: When a button is pressed, if the variable Speed is not blank, the trigger sets the Speed attribute for Mill #141 to the value of the Speed variable.

    When selecting a variable or machine "at the station", all of the writable attributes will be listed.

    Note: If the machine type at runtime does not include the selected writable attribute, the trigger will fail.

    Ensure the selected attribute is writable and mapped to the machine type

    If the machine type at runtime does not include the selected writable attribute, the trigger will fail.

    Machine Type Configuration Page

    When configuring a Machine Type, writable attributes determined in the Attributes List page will be marked with a Write label.


    Machine Datasources Configuration Page

    You can only write to machine datasources that are OPC-UA or MQTT. The following datasources can't be written to and the triggers will fail:

    • Edge Devices
      • Edge IO
      • Edge MC
    • APIs
    • Celos
    • CelosX

    A warning message will indicate unsupported configurations when applicable.

    Unsupported Configuration Warning


    Change Writable Attributes to Read-Only

    If a writable attribute is changed to read-only, any triggers using the Write Machine Attribute action will fail. This affects both Development Version and Published Versions of apps using the attribute.

    Example Use Cases

    Recipe Recalibration

    • Dynamically update machine parameters to ensure precise configuration for each production run. You can save your good recipes and store them in a table, then use them again in the next run.

    Process Control Integration

    • Achieve a handshake between PLC/DCS and MES (Tulip) by writing sending start, stop or confirmation signals to your machine.

    Did you find what you were looking for?

    You can also head to community.tulip.co to post your question or see if others have faced a similar question!


    Was this article helpful?