> 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-3-1/getting-started/connecting-your-first-machine/your-first-service-commissioning-file.md).

# Your First Service Commissioning File

Make yourself familiar with the structure of the service commissioning file below.

* To learn how to connect your first machine using this service commissioning file, see [Connecting your First Machine](/2-3-1/getting-started/connecting-your-first-machine.md).

{% file src="/files/MXhZ1z2u8LjwHQTXoqD8" %}

{% code title="connect-your-first-machine.yaml" lineNumbers="true" expandable="true" %}

```yaml
description: >

  OPC UA Template Commissioning File
  How to connect and integrate an OPC UA server
  https://docs.cybus.io/documentation/machine-connectivity/connecting-to-an-opc-ua-server

metadata:
  name: Example OPC UA Template
  version: 1.0.0
  provider: cybus
  homepage: https://www.cybus.io

parameters:
  opcuaHost:
    type: string
    description: OPC UA Host Address
    default: opcua.demo-this.com

  opcuaPort:
    type: integer
    description: OPC UA Host Port
    default: 51210

resources:
  opcuaConnection:
    type: Cybus::Connection
    properties:
      protocol: Opcua
      connection:
        host: !ref opcuaHost
        port: !ref opcuaPort

  RandomDataExample:
    type: Cybus::Endpoint
    properties:
      protocol: Opcua
      connection: !ref opcuaConnection
      subscribe:
        nodeId: ns=2;i=11021

  mapping:
    type: Cybus::Mapping
    properties:
      mappings:
        - subscribe:
            endpoint: !ref RandomDataExample
          publish:
            topic: !sub 'example/opcua/dataexample'
```

{% endcode %}

## Structure of connect-your-first-machine.yaml

The service commissioning file contains the following elements.

#### `description`

This section contains a short description of the template.

#### `metadata`

This section contains the name, version number, provider and homepage of the provider of the service commissioning file.

#### `parameters`

This section defines the parameters for the configuration of the OPC UA connection. The following parameters are available:

* `opcuaHost`: The address of the OPC UA host (default value: [opcua.demo-this.com](http://opcua.demo-this.com/)).
* `opcuaPort`: The port of the OPC UA host (default value: 51210).

#### `resources`

This section defines the resources that are used in this example. The following resources are available:

* `opcuaConnection`: Defines the connection to the OPC UA server.
  * `type`: Defines the type of the resource. In this case, `Cybus::Connection`.
  * `properties`: Defines the properties of the connection.
    * `protocol`: The protocol used. In this case, `Opcua`.
    * `connection`: The connection details, where the parameters `host` and `port` refer to the previously defined parameters `opcuaHost` and `opcuaPort`.
* `RandomDataExample`: Defines an endpoint that subscribes to data from a specific node of the OPC UA server.
  * `type`: Defines the type of the resource. In this case, `Cybus::Endpoint`.
  * `properties`: Defines the properties of the endpoint.
    * `protocol`: The used protocol. In this case, `Opcua`.
    * `connection`: Refers to the previously defined OPC UA connection.
    * `subscribe`: Defines the node (`nodeId`) from which data is subscribed (in this case `ns=2;i=11021`).
* `mapping`: Defines a mapping that forwards the subscribed data to a specific publication target.
  * `type`: Defines the type of the resource. In this case, `Cybus::Mapping`.
    * `properties`: The properties of the mapping.
      * `mappings`: A list of mappings.
        * `subscribe`: Defines the end point from which data is subscribed (`RandomDataExample`).
        * `publish`: Defines the publication target (`topic`), whereby a topic (`example/opcua/dataexample`) is specified.


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.cybus.io/2-3-1/getting-started/connecting-your-first-machine/your-first-service-commissioning-file.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
