---
title: "Write to machine attributes using OPC UA/MQTT protocols"
slug: "write-to-machine-attributes-using-opc-ua-mqtt"
updated: 2025-02-14T17:25:30Z
published: 2025-02-14T17:25:30Z
canonical: "support.tulip.co/write-to-machine-attributes-using-opc-ua-mqtt"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://support.tulip.co/llms.txt
> Use this file to discover all available pages before exploring further.

# 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](https://support.tulip.co/docs/how-to-set-up-your-first-machine-1)
- [How to build your first MQTT data source](https://support.tulip.co/docs/how-to-build-your-first-mqtt-data-source)
- [How to build your first OPC UA Connector](https://support.tulip.co/docs/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:

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

![image.png](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/image%28847%29.png)

### Edit an Existing Attribute to Make it Writable

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

![Edit Attribute](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/image%28806%29.png)

1. Check the the **Enable write** option.

![EnableWriteOption.png](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/image%28846%29.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](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/image%28836%29.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](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/image%28808%29.png)

---

## 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](https://community.tulip.co/?utm_source=intercom&amp;utm_medium=article-link&amp;utm_campaign=all) to post your question or see if others have faced a similar question!

**OPC-UA**

**OPC Unified Architecture** is a cross-platform, open-source, IEC62541 standard for data exchange from sensors to cloud applications developed by the OPC Foundation.

**Machine**

A **Machine**is a digital representation of a physical datasource. Machines have **Attributes**that are updated through an OPC-UA Connector or the Tulip API.

**Machine Attribute**

**Machine Attributes**are setpoints and actual values for different parameters of your **Machine.**Attributes can be mapped to OPC-UA datasource Tags.

**Step-Level Trigger**

A**step-level trigger** is a trigger configured with each app step. Step-level triggers can be triggered based on 4 actions:

1. Step Opened
2. Every X seconds (Timer)
3. Machine/Device outputs data
4. Step Exited

**App-Level Triggers**

**App-level Triggers**are triggers that are configured with each app. App-level triggers can be triggered based on 3 actions:

1. App Started
2. App Cancelled
3. App Completed

**Machine Type**

**Machine Types** are global definitions of what data to expect from machines of different types. Each Machine Type will have different states, **triggers**, and **attributes**.*EX. We have 5 makes/models of CNC mill, but they all have the same set of attributes (Spindle speed, feed rate, etc.) These can all be combined into a single "CNC Mill" Machine Type*

**Development Version**

The **Dev Version**of a Tulip app is the work-in-progress of your application after an app has been published. If a **Station**is assigned to run the Development version of an application, it will see live changes as they are made in the app editor.

Generally, **Stations**running in production will be running the **Published Version**of an Application.

**PublishedVersion**

The **Published****Version**of a Tulip app is a complete version of your Application. When an app is ready to be run in production, its logic can be *frozen*by Publishing that app. One application can have multiple published versions. If a **Station**is assigned to run the Published version of an application, it will only see changes when they are published.
