IoTool v1 Functions

This documentation covers several independent flows contained within a single Node-RED file. Each flow serves a distinct purpose, primarily related to sensor data management and database interaction.

Flow 1: Sensor ID Management

add new sensor IDs

This flow utilizes quite a few concepts connected to database managment and error logging. Before first table operations table is created and getSID subflow is called which, this subflow is used for putting in credentials to access specific user in postgreSQL. Flow tries to find in table ID if sensor specified in http post request, if it does not find this sensor flow adds it to database, upon un/successfull operation data is outputed back to the parent flow and possible error message is generated.

Flow 2: Sensor ID Retrieval

Subflow: Get Sensor ID

This flow also uses reusable input and output node.

This subflow is used to get sensor ID from table if this id exists, simple SQL query is defined in function node which dynamically sets query to look for all instances of id where sensor name is the same as the one passed, this id is saved for later use. Error handling is implemented with catch node which checks for errors from the postgreSQL node.

Flow 3: Get sensor name

This flow is used to retreive sensor name from table based on sensor ID passed into the flow, simple SQL command is generated in the function node and then passed to the postgres node which executes it. Error handling of postgres node is implemented.

Flow 4: Get sensor name (super user)

This flow implements the same process as flow number 3, where is extracts sensor name written in table from the provided ID number, only difference is that this SQL command is issued to postgreSQL database from super user. Additional configuration is being set in DB access (su) subflow which has hardcoded username and password for super user of this instance of database.

Flow 5: set postgres configuration

This flow implements only one function node, which holds structure of code which is supposed to be used when trying to set configuration for postgres database. User credentials are passed in the msg object