jerrydon / device-opcua-go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OPC-UA Device Service

Overview

This repository is a Go-based EdgeX Foundry Device Service which uses OPC-UA protocol to interact with the devices or IoT objects.

Feature

  1. Subscribe data from OPCUA endpoint
  2. Execute read command
  3. Execute write command

Prerequisite

  • MongoDB
  • Edgex-go: core data, core command, core metadata
  • OPCUA Server

Predefined configuration

Pre-define Devices

Define devices for device-sdk to auto upload device profile and create device instance. Please modify configuration.toml file which under ./cmd/res folder

# Pre-define Devices
[[DeviceList]]
  Name = "SimulationServer"
  Profile = "OPCUA-Server"
  Description = "OPCUA device is created for test purpose"
  Labels = [ "test" ]
  [DeviceList.Protocols]
      [DeviceList.Protocols.opcua]
          Endpoint = "opc.tcp://Burning-Laptop:53530/OPCUA/SimulationServer"

Subscribe configuration

Modify configuration.toml file which under ./cmd/res folder if needed

# Driver configs
[Driver]
  DeviceName = "SimulationServer"   # Name of Devcice exited
  Policy = "None"                   # Security policy: None, Basic128Rsa15, Basic256, Basic256Sha256. Default: auto
  Mode = "None"                     # Security mode: None, Sign, SignAndEncrypt. Default: auto
  CertFile = ""                     # Path to cert.pem. Required for security mode/policy != None
  KeyFile = ""                      # Path to private key.pem. Required for security mode/policy != None
  NodeID = "ns=5;s=Counter1"        # Node id to subscribe to

Devic Profile

A Device Profile can be thought of as a template of a type or classification of Device.

Write device profile for your own devices, difine deviceResources, deviceCommands and coreCommands. Please refer to cmd/res/OpcuaServer.yaml

Tips: name in deviceResources should consistent with OPCUA nodeid

Installation and Execution

make build
make run

Reference

About

License:Apache License 2.0


Languages

Language:Go 91.7%Language:Dockerfile 3.6%Language:Makefile 2.8%Language:Shell 1.9%