1.0.6 • Published 4 years ago

kepserverex-js v1.0.6

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

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

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago