Sign inSign up

joyja/tentacle

By joyja

•Updated over 5 years ago

Tentacle Edge Industrial Automation Gateway Graphql API

Image
1

689

joyja/tentacle repository overview

Tentacle

GitHub Travis (.com) Coverage Status Known Vulnerabilities

A nodejs industrial automation edge gateway with a GraphQL API.

⁠Installation

The best way to get a full featured tentacle install (which includes tentacle-ui and exposes everything on port 80) is using LXD and applying the tentacle-docker⁠ profile.

To install tentacle as a global module with all of it's dependencies:

sudo npm install -g --unsafe-perm tentacle-edge

Once installed you can run them command tentacle to start the server. You can use Ctrl-C to stop the server.

The graphql api will then be available at http://localhost:4000⁠. You can also access Graphql Playground⁠, a powerful GraphQL IDE, at that at that address.

⁠Starting Tentacle on Boot

The easiest way is to use PM2⁠.

  1. Install PM2

    sudo npm install -g pm2
    
  2. Determine the exact location of the tentacle command

    if you have installed tentacle globally, then on linux/OS X the tentacle command will probably be either: /usr/bin/tentacle or /usr/local/bin/tentacle. The command which tentacle can be used to confirm the location.

  3. Tell pm2 to run Tentacle

    The following command tells PM2 to run tentacle, assuming /usr/bin/tentacle as the location of the tentacle command.

    The -- argument must appear before any arguments you want to pass to tentacle.

    pm2 start /usr/bin/tentacle -- -v
    

    This will start tentacle in the background. You can view information about the process and access the log output using the commands:

    pm2 info tentacle
    pm2 logs tentacle
    

    More information about managing processes under PM2 is available here⁠.

  4. Tell PM2 to run on boot

    pm2 save
    pm2 startup
    

    This will generate a command that you must copy/paste and run to add the pm2 process to your services.

  5. Reboot

    Reboot and verify everything is working as expected.

⁠Protocols

⁠Services

⁠GraphQL API

⁠Schema Types

Table of Contents

⁠Query

Read only queries

FieldArgumentTypeDescription
userUser⁠

Gets user based on authentication header and returns relevant data

tags[Tag⁠!]!

Requires a valid authorization token. List of all tags configured in this gateway

scanClasses[ScanClass⁠!]!

Requires a valid authorization token. ist of all scan classes configured in this gateway

devices[Device⁠!]!

Requires a valid authorization token. List of all devices configured in this gateway

typeString⁠
services[Service⁠!]!

Requires a valid authorization token. List of all services configured in this gateway

typeString⁠

⁠Mutation

Read/Write queries

FieldArgumentTypeDescription
loginAuthPayload⁠

If a valid username and password is provided, this will return an auth payload with a java web token to be used for future requests and information about the user that successfully logged in.

usernameString⁠!
passwordString⁠!
changePasswordUser⁠

Allows the user to change their password

oldPasswordString⁠!
newPasswordString⁠!
createScanClassScanClass⁠

Requires a valid authorization token. Creates a new scan class

nameString⁠!
descriptionString⁠!
rateInt⁠!
updateScanClassScanClass⁠

Requires a valid authorization token. Updates an existing scan class

idID⁠!
nameString⁠
descriptionString⁠
rateInt⁠!
deleteScanClassScanClass⁠

Requires a valid authorization token. Deletes a scan class. Will not be successfully if there are tags currently assigned to this scan class.

idID⁠!
createTagTag⁠

Requires a valid authorization token. Creates a new tag

nameString⁠!
descriptionString⁠!
datatypeDatatype⁠!
valueString⁠!
scanClassIdID⁠!
minFloat⁠
maxFloat⁠
deadbandFloat⁠
unitsString⁠
updateTagTag⁠

Requires a valid authorization token. Updates an existing tag

idID⁠!
nameString⁠
descriptionString⁠
datatypeDatatype⁠
valueString⁠
scanClassIdID⁠
minFloat⁠
maxFloat⁠
deadbandFloat⁠
unitsString⁠
deleteTagTag⁠

Requires a valid authorization token. Deletes a tag. Will delete any source assigned to this tag, and tag will no longer be scanned.

idID⁠!
createOpcuaDevice⁠

Requires a valid authorization token. Creates a opcua device, and automatically starts a connection.

nameString⁠!
descriptionString⁠!
hostString⁠!
portInt⁠!
retryRateInt⁠!
updateOpcuaDevice⁠

Requires a valid authorization token. Updates an existing opcua device and refreshes the connection.

idID⁠!
nameString⁠
descriptionString⁠
hostString⁠
portInt⁠
retryRateInt⁠
deleteOpcuaDevice⁠

Requires a valid authorization token. Deletes a opcua device. All sources assigned to this device are deleted and tags using this device as a source will have their sources set to null, making their values static.

idID⁠!
createOpcuaSourceOpcuaSource⁠

Requires a valid authorization token. Creates a OPC UA source. The tag value will then be updated to the value at the source register per the scan class

deviceIdID⁠!
tagIdID⁠!
nodeIdString⁠!
updateOpcuaSourceOpcuaSource⁠

Requires a valid authorization token. Updates a OPC UA source register. The tag value will then update per the new register at the rate of the scan class.

tagIdID⁠!
nodeIdString⁠!
deleteOpcuaSourceOpcuaSource⁠

Requires a valid authorization token. Deletes a OPC UA source. The tag value will then be static.

tagIdID⁠!
createModbusDevice⁠

Requires a valid authorization token. Creates an Modbus TCP/IP device, and automatically starts a connection.

nameString⁠!
descriptionString⁠!
hostString⁠!
portInt⁠!
reverseBitsBoolean⁠!
reverseWordsBoolean⁠!
zeroBasedBoolean⁠!
timeoutInt⁠!
retryRateInt⁠!
updateModbusDevice⁠

Requires a valid authorization token. Updates an existing modbus device and refreshes the connection.

idID⁠!
nameString⁠
descriptionString⁠
hostString⁠
portInt⁠
reverseBitsBoolean⁠
reverseWordsBoolean⁠
zeroBasedBoolean⁠
timeoutInt⁠
retryRateInt⁠
deleteModbusDevice⁠

Requires a valid authorization token. Deletes a modbus device. All sources assigned to this device are deleted and tags using this device as a source will have their sources set to null, making their values static.

idID⁠!
createModbusSourceModbusSource⁠

Requires a valid authorization token. Creates a modbus source. The tag value will then be updated to the value at the source register per the scan class

deviceIdID⁠!
tagIdID⁠!
registerInt⁠!
registerTypeModbusRegisterType⁠
updateModbusSourceModbusSource⁠

Requires a valid authorization token. Updates a modbus source register. The tag value will then update per the new register at the rate of the scan class.

tagIdID⁠!
registerInt⁠!
registerTypeModbusRegisterType⁠
deleteModbusSourceModbusSource⁠

Requires a valid authorization token. Deletes a modbus source. The tag value will then be static.

tagIdID⁠!
createEthernetIPDevice⁠

Requires a valid authorization token. Creates an Ethernet/IP device, and automatically starts a connection.

nameString⁠!
descriptionString⁠!
hostString⁠!
slotInt⁠!
updateEthernetIPDevice⁠

Requires a valid authorization token. Updates an existing Ethernet/IP device and refreshes the connection.

idID⁠!
nameString⁠
descriptionString⁠
hostString⁠
slotInt⁠
deleteEthernetIPDevice⁠

Requires a valid authorization token. Deletes an Ethernet/IP device. All sources assigned to this device are deleted and tags using this device as a source will have their sources set to null, making their values static.

idID⁠!
createEthernetIPSourceEthernetIPSource⁠

Requires a valid authorization token. Creates an Ethernet/IP source. The tag value will then be updated to the value at the source register per the scan class

deviceIdID⁠!
tagIdID⁠!
tagnameString⁠
updateEthernetIPSourceEthernetIPSource⁠

Requires a valid authorization token. Updates an Ethernet/IP source tagname. The tag value will then update per the new tagname at the rate of the scan class.

tagIdID⁠!
tagnameString⁠
deleteEthernetIPSourceEthernetIPSource⁠

Requires a valid authorization token. Deletes an Ethernet/IP source. The tag value will then be static.

tagIdID⁠!
createMqttService⁠

Requires a valid authorization token. Creates an MQTT Sparkplug B service (tied to a single MQTT broker).

name

Tag summary

Content type

Image

Digest

Size

431.7 MB

Last updated

over 5 years ago

docker pull joyja/tentacle:version-0.0.38