kepserverex-js

1.0.6 • Public • Published

kepserverex-js

build status code coverage code style styled with prettier made with lass license npm downloads

A library to interact with KEPServerEX

Table of Contents

Install

npm:

npm install kepserverex-js

yarn:

yarn add kepserverex-js

Usage

The package is currently comprised of two modules.

  • IotGateway: A class to read and write from the IoTGateway, REST agents that KEPServerEx provides.
  • TagBuilder: A helper class to functionally create tag array to read and write using the IoTGateway class.
const {TagBuilder, IotGateway} = require('kepserverex-js');
 
const tagBuilder = new TagBuilder({ namespace: 'Channel1.Device1' });
const iotGateway = new IotGateway({
  host: '192.168.0.1',
  username: 'administrator',
  password: 'superSecretPassowrd'
});
 
// Add read tags to tag builder
// ["Channel1.Device1.TankLevel","Channel1.Device1.TankLevel"]
const myTags = tagBuilder
    .read('TankLevel')
    .read('TankTemperature')
    .get();
 
//read tags from the iotgateway agent
iotGateway.read(myTags).then((data)=>{
    console.log(data);
});
 
//clean tags from tagsbuilder
tagBuilder.clean();
 
// Add write tags to builder.
// [ {id:"Channel1.Device1.ValveOpen","v":1}, {"id":"Channel1.Device1.PumpSpeed","v":80}]
const myTags = tagBuilder
    .write("ValveOpen",1)
    .write('PumpSpeed',80)
    .get();
 
iotGateway.write(myTags).then((data) => {
    console.log(data);
 });
 

Contributors

Name
Ryan Albrecht

License

MIT © Ryan Albrecht

Package Sidebar

Install

npm i kepserverex-js

Weekly Downloads

9

Version

1.0.6

License

MIT

Unpacked Size

16.3 kB

Total Files

13

Last publish

Collaborators

  • ryanalbrecht