Coder Social home page Coder Social logo

device-opcua-go-siemens's Introduction

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.

Read README_CN.md for Chinese version.

Features

  1. Subscribe device node
  2. Execute read command
  3. Execute write command

Prerequisite

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

Predefined configuration

Device 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, define deviceResources, deviceCommands and coreCommands. Please refer to cmd/res/OpcuaServer.yaml

Note: device profile must contains a "SubMark" string Value Descriptor and a "Subscribe" SET command if want to subscribe device node. And write mappings property. "SubMark" is used to distinguish Subscribe and other command.

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.Protocols]
      [DeviceList.Protocols.opcua]
          Protocol = "opc.tcp"
          Address = "192.168.3.165"
          Port = "53530"
          Path = "/OPCUA/SimulationServer"
          MappingStr = "{ \"Counter\": \"ns=5;s=Counter1\", \"Random\": \"ns=5;s=Random1\" }"
          Policy = "None"
          Mode = "None"
          CertFile = ""
          KeyFile = ""

Protocol, Policy, Mode, CertFile and KeyFile properties are not necessary, they all have default value as mentioned above.

Note: MappingStr property is JSON format and needs escape characters.

Installation and Execution

make build
make run
make docker

Subscribe device node

Trigger a Subscribe command through these methods:

  • Edgex UI client. Sigh in -> Add Gateway and select it -> Select one DeviceService and click its Devices button -> Click target device's Commands button -> Select "Subscribe" set Method -> Ignore "SubMark" and fill the blank near ValueDescriptor, use "on" or "off" to represent subscribe this node or not.

  • Any HTTP Client like PostMan. Use core command API to exec "subscribe" command.

Reference

Buy me a cup of coffee

If you like this repository, star it and encourage me.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.