Skip to main content

API that communicates with KEP server for XMPro demo machine

Project description

opc_app

This is a simple API that exposes a few routes to request information from the KEP

This app will make the following routes available at:

http://<ip_address>:5000

Depending on the router configuration you will be able to access this gateway from outside the local network as well, i.e. if it is NAT'd out.

Routes

GET / OR /api

Test if the API is alive

{
  "message": "opc http endpoint is alive"
}

GET /api/sensor/<name>

Fetch the list of available servers to connect to

{
  "quality": "Good",
  "time": "02/01/19 07:08:28",
  "value": 10614
}

GET /api/servers

Fetch the list of available servers to connect to

{
  "servers": ["Kepware.KEPServerEX.V6"]
}

GET /api/nodes/<node>

Fetch the list of nodes

{
  "nodes": [
    "_AdvancedTags",
    "_ConnectionSharing",
    "_CustomAlarms",
    "_DataLogger",
    "_EFMExporter",
    "_IDF_for_Splunk",
    "_IoT_Gateway",
    "_LocalHistorian",
    "_Redundancy",
    "_Scheduler",
    "_SecurityPolicies",
    "_SNMP Agent",
    "_System",
    "Channel1",
    "Data Type Examples",
    "Simulation Examples",
    "XMPro"
  ]
}

Pre-requisites

Make sure everything installed is 32-bit (even on a 64-bit os)

Python 2.7

Install Python 2.7 32-bit (if it is not already).

Ensure that python gets added to Path.

python-install-path

Check the installation is working by opening the command prompt and executing the following.

python.exe

Expected output.

python-command-check

Pywin32

Install the 32-bit version of pywin32 for python 2.7.

OpenOPC

Install the OpenOPC library

Git BASH

Install git BASH. We will use this terminal emulator to run our program that will communicate with the PLC server.

There is no need to change any of the default settings during the installation process except the below caveat.

When installing git BASH the installer will ask you how you would like to use it from the command line. Select the option the same as the image below.

git-bash-command-prompt

Quick Start

After all pre-requisites the following steps should get the API up and running

Install the app

Open git BASH and run the following command to install the app.

pip install opc-app

That's it!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opc_app-0.2.0.0.tar.gz (15.5 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page