---
description: >

  Accessing an OPC DA server

metadata:

  name: Using OPC DA Server
  version: 1.0.0
  icon: https://www.cybus.io/wp-content/uploads/2019/03/Cybus-logo-Claim-lang.svg
  provider: cybus
  homepage: https://www.cybus.io

parameters:

  opcdaHost:
    type: string
    description: Hostname or IP of the OPC DA server
    default: 192.168.0.1

  opcdaUser:
    type: string
    default: cybus

  opcdaPass:
    type: string
    default: PASSWORD

  initialReconnectDelay:
    type: integer
    default: 1000

  maxReconnectDelay:
    type: integer
    default: 30000

  factorReconnectDelay:
    type: integer
    default: 2

resources:

  opcdaConnection:
    type: Cybus::Connection
    properties:
      protocol: Opcda
      connection:
        host: !ref opcdaHost
        username: !ref opcdaUser
        password: !ref opcdaPass
        domain: 'WORKGROUP'
        classId: 'F8582CF2-88FB-11D0-B850-00C0F0104305'
        connectionStrategy:
          initialDelay: !ref initialReconnectDelay
          maxDelay: !ref maxReconnectDelay
          incrementFactor: !ref factorReconnectDelay

  multipleTags:
    type: Cybus::Endpoint
    properties:
      protocol: Opcda
      connection: !ref opcdaConnection
      subscribe:
        interval: 2000
        tags:
          - 'Triangle Waves.Int4'
          - 'Triangle Waves.Real4'

  triangleWaveReal4:
    type: Cybus::Endpoint
    properties:
      protocol: Opcda
      connection: !ref opcdaConnection
      subscribe:
        interval: 2000
        tag: 'Triangle Waves.Real4'

  writeTag:
    type: Cybus::Endpoint
    properties:
      protocol: Opcda
      connection: !ref opcdaConnection
      write:
        tag: 'Triangle Waves.Int4'
        type: 'INTEGER'

  browse:
    type: Cybus::Endpoint
    properties:
      protocol: Opcda
      connection: !ref opcdaConnection
      read:
        browse: 'flat'
