Configuration
This sections allows IoT configuration.
GET /iot
This method returns the list of available items.
Request parameters:
- company [mandatory]: the company name or id.
- session [mandatory]: the Id of the active session.
- process: the id of the process.
Response:
- status: returns "0" on success, and an error code in any other case.
- data: returns the list of items.
- message: "success" or a descriptive information of the error in any other case.
Example of response:
{ "status": 0, "data": [{ active: "1", consumptiontype: "", deadband: "0", description: "", device: "INIT", endpoint: "Kontron.OPCFatek.1", event: "0", function: "Production", host: "HOST", id: "343", identifier: "", item: "RS1.CTR.CTR0000", minimumcycle: "0", password: "", process: "A0L1", resetevery: "32000", senddescription: "0", storedb: "1", threshold: "50", type: "Counter", upd: "20190610130338", url: "localhost", user: "", value: "26469", variablenumber: "1", vendor: "edinnHIP" }, { active: "1", consumptiontype: "", deadband: "0", description: "", device: "INIT", endpoint: "Kontron.OPCFatek.1", event: "0", function: "Production", host: "HOST", id: "346", identifier: "", item: "RS1.CTR.CTR0000", minimumcycle: "0", password: "", process: "A0L1", resetevery: "32000", senddescription: "0", storedb: "1", threshold: "80", type: "Counter", upd: "20190610130338", url: "localhost", user: "", value: "26469", variablenumber: "0", vendor: "edinnHIP" }], "message": "Success" } |
POST /iot
This method creates a new item. The user must have administrative permission.
Please remember that for counters that you want to be monitorized you need at least 2 entries in the IoT table: 1 for variable number 0 (the total) and another for variable number 1. This applies to these elements:
- PType_Production = 0
- PType_Scrap = 1
- PType_Rework = 2
- ...
- See the complete list here in functions.
Request parameters:
- company [mandatory]: the company name or id.
- session [mandatory]: the Id of the active session.
- host: localhost if not specified.
- device [mandatory]: the device which is the source of the item.
- vendor [mandatory]: the source from which the IoT gets the data. Please see constants.
- url: in OPC UA this is where the endpoints can be found. In OPC DA this is the IP address of the OPC Server. If not specified, "localhost" will be taken.
- endpoint [mandatory]: in OPC UA this indicates the endpoint to connect to. In OPC DA this indicates the name of the DCOM.
- process: the process identifier.
- item [mandatory]: the item identifier.
- function [mandatory]: the functionality of the item, please see constants.
- type [mandatory]: if the item is a counter, a signal or a user defined logic (UDL). Please see constants.
- threshold [mandatory] [0-100]: the minimum speed to consider that the process is working. This is mandatory when inserting a production (function), counter (type) and variable is totals.
- minimumcycle [mandatory] [0-100]: the minimum cycle time that has to be reached in order to consider the production.
- description: a free text to describe the item.
- variablenumber [mandatory]: the number of the variable that this item is representing, according to the calculation type associated with the process.
- consumption_type [optional]: the id of the consumption type.
- identifier [optional]: indicates the id of the:
- result that will be automatically inserted if this item is functioning as scrap or rework item.
- status that will be automatically inserted if this item is functioning as a justify of justify all item.
- deadband [optional][0-100]: this value allows to filter and ignore the changes of the signal are smaller than a certain percentage.
- activate [mandatory]: activates (1) or disactivates (0) this item.
- storedb [mandatory]: when storedb=0 it indicates that the item will be kept only in memory. If it is 1, it indicates that the item value will be stored also in the database in real time.
- resetevery: applies only to items which are of type counters, and indicates every how many counts this counter will reset.
- senddescription [mandatory]: indicates that the description indicated before will (1) or will be not (0) sent linked to the record of the generated result.
- event [mandatory] [100-200]: indicates if the item will be sent to the Registry in the form of this number of event.
- user [mandatory]: the user to connect to the OPC UA.
- password [mandatory]: the password to connect to the OPC UA.
Response:
- status: returns "0" on success, and an error code in any other case.
- data: returns the list of items.
- message: "success" or a descriptive information of the error in any other case.
PUT /iot
This method updates an item. The user must have administrative permission. Mainly is used to update the production counter value.
Request parameters:
o company [mandatory]: the company name or id.
o session [mandatory]: the Id of the active session.
o Id [mandatory]: the id of the item.
o " value" o "inc": with "value" the item value can be changed, with "inc" (meaning increment) a determinated amount can be added to the current value of the item.
o host: localhost if not specified.
o vendor: the source from which the IoT gets the data. Please see constants.
o url: in OPC UA this is where the endpoints can be found. In OPC DA this is the IP address of the OPC Server. If not specified, "localhost" will be taken.
o endpoint: in OPC UA this indicates the endpoint to connect to. In OPC DA this indicates the name of the DCOM.
o process: the process identifier.
o item: the item identifier.
o function: the functionality of the item, please see constants.
o type: if the item is a counter, a signal or a user defined logic (UDL). Please see constants.
o threshold [0-100]: the minimum speed to consider that the process is working. This is mandatory when inserting a production (function), counter (type) and variable is totals.
o minimumcycle [0-100]: the minimum cycle time that has to be reached in order to consider the production.
o variablenumber: the number of the variable that this item is representing, according to the calculation type associated with the process.
o consumptiontype : the id of the consumption type.
o identifier: indicates the id of the:
■ result that will be automatically inserted if this item is functioning as scrap or rework item.
■ status that will be automatically inserted if this item is functioning as a justify of justify all item.
o deadband [0-100]: this value allows to filter and ignore the changes of the signal are smaller than a certain percentage.
o activate: activates (1) or disactivates (0) this item.
o storedb: when storedb=0 it indicates that the item will be kept only in memory. If it is 1, it indicates that the item value will be stored also in the database in real time.
o resetevery: applies only to items which are of type counters, and indicates every how many counts this counter will reset.
o senddescription: indicates that the description indicated before will (1) or will be not (0) sent linked to the record of the generated result.
o event [100-200]: indicates if the item will be sent to the Registry in the form of this number of event.
o user: the user to connect to the OPC UA.
o password: the password to connect to the OPC UA.
Response:
o status: returns "0" on success, and an error code in any other case.
o message: "success" or a descriptive information of the error in any other case.
DELETE /iot
Request parameters:
- company [mandatory]: the company name or id.
- session [mandatory]: the Id of the active session.
- id [mandatory]: the Id of the item to delete.
Response:
- status: returns "0" on success, and an error code in any other case.
- data: returns the list of processes and its descriptions.
- message: "success" or a descriptive information of the error in any other case.