> For the complete documentation index, see [llms.txt](https://docs.cybus.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-asset.md). Agents can also search and read this documentation through its [MCP server](https://docs.cybus.io/~gitbook/mcp).

# Cybus::Asset

Give one real machine or system its attribute values, a global ID that stays the same when it moves, and a place in the Unified Namespace.

The **Cybus::Asset** resource declares one real thing, such as the pump `pump01`. An asset follows a [Cybus::Model](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-model.md) or declares its data inline. A [Cybus::Mount](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-mount.md), or the `mount` or `promote` shorthand on the asset, places it in the namespace. For how the UNS resources work together, see [Namespaces, Models, and Assets](https://docs.cybus.io/2-8-0/unified-namespace/unified-namespace.md).

## Asset Properties

| Property                    | Type               | Required                     | Default   |
| --------------------------- | ------------------ | ---------------------------- | --------- |
| [model](#model)             | `string`           | **Required** without `data`  |           |
| [data](#data)               | `object`           | **Required** without `model` |           |
| [attributes](#attributes)   | `object`           | Optional                     |           |
| [identity](#identity)       | `object`           | Optional                     |           |
| [relations](#relations)     | `object`           | Optional                     |           |
| [mount](#mount)             | `string`, `object` | Optional                     |           |
| [promote](#promote)         | `string`           | Optional                     |           |
| [targetState](#targetstate) | `enum`             | Optional                     | `enabled` |

An asset needs exactly one of `model` and `data`. `mount` and `promote` cannot be used together.

The resource ID of an asset is its asset ID. It must not contain a period, because a period separates the asset from its property in a reference such as `pump01.temperature`. Other services reference the asset by this ID, or by `srv:<serviceId>/<assetId>` when the same asset ID exists in more than one service.

Within its own service commissioning file, you can also reference the asset with `!ref`. A `!ref` resolves to the asset in the same service commissioning file, even when another service declares the same asset ID.

### model

The model that the asset follows. See [Referencing a Model](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-model.md#referencing-a-model).

* **Required** without `data`
* Type: `string`

### data

Data properties declared inline, for an asset that has no model of its own. The syntax is the same as in the [data](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-model.md#data) of a model. If a namespace has the policy `modeling: required`, an asset with inline data cannot be mounted in it.

* **Required** without `model`
* Type: `object`

### attributes

The attribute values of this asset, for example its serial number.

When you install the service, Connectware checks them against the attributes of the model, including the attributes it inherits. The installation fails in the following cases:

* A required attribute is missing.
* A value is wrong.
* The asset sets an attribute that the model does not declare.

An asset with inline `data` instead of a model gets no attribute check.

* **Optional**
* Type: `object`

### identity

The persistent identity of the asset. It stays the same when the asset moves in the namespace.

* **Optional**
* Type: `object`

| Property           | Type     | Default                                    | Description                                                                         |
| ------------------ | -------- | ------------------------------------------ | ----------------------------------------------------------------------------------- |
| `globalAssetId`    | `string` | `urn:cybus:asset:<serviceId>:<resourceId>` | The global ID of the real thing, ideally an IEC 61406 ID link.                      |
| `specificAssetIds` | `object` |                                            | Further IDs as name and value pairs, for example the address of the asset in a PLC. |

### relations

The links to other assets. Each relation name must be declared in the [relations](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-model.md#relations) of the model, and lists the IDs of the related assets. The related assets must already be installed or declared in the same service commissioning file. They do not need to be mounted.

* **Optional**
* Type: `object` (relation name → array of asset IDs)

### mount

A shorthand for a [Cybus::Mount](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-mount.md) that places the asset at a node, with the asset as its own topic segment below the node.

* **Optional**
* Type: `string` or `object`
  * As a string: the node path, starting with `uns:`, for example `uns:factory/hall1`.
  * As an object: `at` (**Required**), the node path or the ID of a parent asset, and `key`, the topic segment of the asset. The `key` defaults to the resource ID of the asset and must follow the [naming rules](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-namespace.md#naming-rules). Under the default policy, an asset ID with uppercase letters needs a `key`.

The shorthand creates a Cybus::Mount named `<assetId>Mount`. If the service already has a resource with that name, the installation fails.

### promote

A shorthand for a mount that promotes a node. The topics of the asset live at the node path itself, without a segment of their own. Use it for an asset that represents the node, such as a production line. A node can have one promoted asset.

* **Optional**
* Type: `string`
  * The node path, starting with `uns:`, for example `uns:factory/hall1/line1`. You cannot promote below a parent asset.

### targetState

Whether the resource is active. A disabled asset keeps its topics and its `$meta` topic. To stop the `$meta` topic, disable the [mount](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-mount.md#targetstate) of the asset. The mount that the `mount` or `promote` shorthand creates stays enabled, so use a separate Cybus::Mount for this.

* **Optional**
* Type: `enum`
  * Allowed values: `enabled`, `disabled`
* Default: `enabled`

## Topics of an Asset

An asset without a mount is valid but has no topics. You can mount it in a later installation.

Once an asset is mounted, each data property gets a topic below the base topic of the asset. A writable property also gets `/set` and `/res` topics. For example, `pump01` mounted at `uns:factory/hall1` publishes its temperature on `factory/hall1/pump01/temperature`.

To connect the topics to machine data, reference the property instead of writing the topic:

* An [endpoint](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-endpoint.md) uses `asset: <asset>.<property>`, for example `asset: pump01.temperature`.
* A [mapping](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-mapping.md) uses `asset:` in place of `topic:` in its `subscribe` or `publish` section. In `subscribe`, `asset: <asset>` without a property subscribes to every data property of the asset. Connectware builds this list when you install the service. When the asset gets more data properties later, for example through a new model version, Connectware updates the list automatically.

[Nodes](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-node.md) of a server do not support `asset`. To connect a node to an asset, use a mapping between them.

Connectware replaces the reference with the topic when you install the service. The asset must already be installed and mounted. The installation fails in the following cases:

* The asset or the property is unknown, or the asset ID matches more than one asset. The error names the reference or the candidates.
* The asset is not mounted yet, or is mounted in more than one namespace.
* The same resource sets both `asset` and `topic`.
* The reference has more than one dot, such as `a.b.c`.
* A `write` endpoint references a property that is not `writable`.

To grant access to the topics of an asset, use `asset:<id>` with `context: mqtt` in the permissions of a [role](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-role.md#resource) or a [user](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-user.md).

Other services can depend on an asset in the following ways:

* An endpoint or mapping references the asset.
* A mount places the asset, for example in a central placement service.
* A mount places another asset below it.
* An asset lists it in its relations.
* A role or user holds an `asset:` grant on it.

While such a dependency exists, the following changes fail with an error that names the services and resources:

* Removing the asset or changing its asset ID.
* Unmounting the asset.
* Deleting the service that declares the asset or its mount.

Disabled services count too. Moving the asset by changing the `at` or `key` of its mount is allowed. Endpoints, mappings, and grants follow it. Replacing its mount with a mount of another resource ID fails while an endpoint, mapping, or mount of another service uses it. Only a grant follows the asset to the new mount.

## The $meta Topic

Every mounted asset publishes a retained `$meta` message below its base topic, for example `factory/hall1/pump01/$meta`. Any MQTT client can read it to find out what the asset is, without a Connectware API. When the mount is removed, the retained message is cleared. A disabled mount publishes no `$meta`.

The `$meta` message is a JSON document with the following fields:

| Field         | Description                                                                                        |
| ------------- | -------------------------------------------------------------------------------------------------- |
| `generatedAt` | When the document was generated, in milliseconds since the Unix epoch.                             |
| `asset`       | The asset `id`, `resourceId`, `globalAssetId`, and `specificAssetIds`.                             |
| `model`       | The `modelId` and `version` of the model, or `null` for an asset without a model.                  |
| `properties`  | One entry per data property with its `topic`, and its `unit`, `semanticId`, and `writable` if set. |
| `attributes`  | The attribute values of the asset.                                                                 |
| `relations`   | The relations of the asset. Each related asset appears with its `resourceId`.                      |
| `namespace`   | The `root` of the namespace and the `baseTopic` of the asset.                                      |

The `id` is the asset ID, which can repeat across services. The `resourceId` combines the service ID and the asset ID as `<serviceId>-<assetId>`, so it is unique. To find the `$meta` message of a related asset, match the relation value against `asset.resourceId`.

For example, Mill 01 of the [Example Factory](https://docs.cybus.io/2-8-0/unified-namespace/example-factory.md) publishes the following `$meta` message on `acme/hamburg/assembly/line-north/mill01/$meta`:

```json
{
  "generatedAt": 1794560011986,
  "asset": {
    "id": "mill01",
    "resourceId": "acmemill01-mill01",
    "globalAssetId": "https://example.com/assets/mx-2041-0017",
    "specificAssetIds": {
      "erpNumber": "A-10045"
    }
  },
  "model": {
    "modelId": "CncMill",
    "version": 1
  },
  "properties": {
    "partCount": {
      "topic": "acme/hamburg/assembly/line-north/mill01/partCount"
    },
    "power": {
      "unit": "W",
      "topic": "acme/hamburg/assembly/line-north/mill01/power"
    },
    "recipeId": {
      "writable": true,
      "topic": "acme/hamburg/assembly/line-north/mill01/recipeId"
    },
    "spindleSpeed": {
      "unit": "rpm",
      "topic": "acme/hamburg/assembly/line-north/mill01/spindleSpeed"
    },
    "state": {
      "topic": "acme/hamburg/assembly/line-north/mill01/state"
    }
  },
  "attributes": {
    "manufacturer": "DMG Mori",
    "serialNumber": "MX-2041-0017"
  },
  "relations": {
    "measuredBy": ["acmepowermeter01-powermeter01"]
  },
  "namespace": {
    "root": "acme",
    "baseTopic": "acme/hamburg/assembly/line-north/mill01"
  }
}
```

## Example

The following asset follows the `Pump` model from the [Cybus::Model](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-model.md#example) example and mounts itself at `uns:factory/hall1`.

{% code lineNumbers="true" %}

```yaml
pump01:
  type: Cybus::Asset
  properties:
    model: !ref pumpModel
    attributes:
      serialNumber: SN-0001
      manufacturer: Cybus
    identity:
      globalAssetId: 'urn:cybus:test:pump01'
      specificAssetIds:
        plc: 'DB10.DBD0'
    mount: 'uns:factory/hall1'
```

{% endcode %}

An endpoint that reads the temperature of this pump from a PLC references the property instead of a topic:

{% code lineNumbers="true" %}

```yaml
pump01Temperature:
  type: Cybus::Endpoint
  properties:
    protocol: S7
    connection: !ref s7Connection
    subscribe:
      address: DB10,REAL0
    asset: pump01.temperature
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-asset.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
