- Print
Write to Machine Attributes using OPC UA/MQTT Protocols
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:
- How to Set up Your First Machine
- How to build your first MQTT data source
- How to build your first OPC UA Connector
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:
- Navigate to the Attributes List page.
- Click Create New Attribute.
- Enable the Write option and click Create.
Edit an Existing Attribute to Make it Writable
- Click the three dot menu next to the attribute and select Edit.
- Check the the Enable write option.
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.
- In the trigger editor, add a new action.
- Select Write Machine Attribute from the drop-down list.
- Select Specific machine, variables, or machines at the desired station.
- Select the attribute you want to write to.
- Select the data value you want to write to.
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.
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.
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!