This step-by-step guide explains how to receive and store Teracom controller data in Microsoft SQL Server using a lightweight Node.js HTTP POST receiver. The setup does not require advanced programming knowledge. Basic experience with editing configuration files, running Command Prompt commands, and working with SQL Server Management Studio is sufficient.

The receiver processes incoming HTTP POST messages and stores the individual data items in a universal SQL Server table. The procedure covers Node.js installation, database preparation, receiver configuration, controller HTTP POST settings, and verification of the stored records.

Architecture for Storing Teracom Controller Data in SQL Server

The system consists of a supported Teracom controller, a Node.js HTTP receiver, and a Microsoft SQL Server database. The supplied receiver package includes dedicated parsers for selected TCW2xx and TCG1xx-4 models.

The Teracom controller collects measurements, input and output states, alarms, and other device data, depending on the model and its configuration.

At the configured interval, the controller sends its current monitoring data to the Node.js receiver using HTTP POST in JSON format.

The Node.js receiver accepts the incoming JSON message, selects the appropriate model-specific parser, and stores each supported data item as a separate row in the universal tcw_data table.

The overall data flow is:

Teracom controller → HTTP POST / JSON → Node.js receiver → Microsoft SQL Server

The Node.js receiver provides the interface between the controller and the database, while Microsoft SQL Server provides centralized storage for historical data, reporting, visualization, and further analysis.

The Node.js receiver and Microsoft SQL Server may run on the same computer or on separate machines. In either case, the controller must be able to reach the receiver, and the receiver must be able to connect to the configured SQL Server instance.

Required Setup and Files

This guide assumes that the following components are already available and operational:

  • A Teracom controller with the required monitoring parameters configured
  • A working Microsoft SQL Server installation
  • SQL Server Management Studio
  • An SQL Server user account with permission to create the required table and insert records
  • Network connectivity between the Teracom controller, the Node.js receiver, and Microsoft SQL Server

This guide applies to Teracom controllers that support HTTP POST in JSON format and have a corresponding model-specific parser in the receiver package.

The following sections guide you through:

  • Installing Node.js and the required packages
  • Creating the SQL Server database and table
  • Configuring the Node.js receiver
  • Starting and testing the application
  • Configuring HTTP POST in the controller
  • Verifying the stored measurements

You need the following files:

  • .env — contains the SQL Server connection details and receiver settings
  • receiver.js — receives JSON data from the Teracom controller and stores it in Microsoft SQL Server
  • create_tables.sql — creates the required database table
  • parsers folder — contains model-specific files that convert the JSON structure of each supported controller into database records

Normally, you only need to edit the .env file. You can use the receiver.js file without modification for the standard setup described in this guide.

Download the required files from the link below:

Teracom Controller Data in SQL Server Receiver Package

In the example below, this guide uses the TCW260 as the controller. However, the procedure is similar for the other controller models supported by the supplied parsers.

Step 1 – Preparing the Working Folder

First, create a dedicated working folder on the computer where the Node.js receiver will run. Keeping all project files in one location makes the receiver installation easier to manage, troubleshoot, and maintain.

For this example, create a folder named:

HTTP_Receiver

Extract the supplied archive and copy all files and folders into C:\HTTP_Receiver.

The .env file stores the SQL Server connection details and application settings. The receiver.js file runs the HTTP POST receiver, the create_tables.sql file creates the required database table and indexes, and the parsers folder contains the model-specific data parsers.

Open Command Prompt and navigate to the newly created working folder:

cd C:\HTTP_Receiver

The folder should contain:

Node.js receiver working folder for storing Teracom controller data in SQL Server

Run all Node.js commands in the following steps from this folder.

Step 2 – Installing Node.js and Required Packages

Next, install a supported Node.js LTS version. Node.js includes npm, which installs the packages that the application requires.

Download Node.js from the official website: https://nodejs.org/en/download

This example uses the Windows Installer (.msi).

After installation, open Command Prompt and verify that Node.js and npm are available:

node --version
npm --version

Both commands should return their installed version numbers.

Command Prompt showing the installed Node.js and npm versions on Windows

Next, navigate to the working folder created in the previous step:

cd C:\HTTP_Receiver

Install the required Node.js packages by running:

npm install express mssql dotenv

Command Prompt showing the installation of packages required by the Node.js HTTP receiver

The command installs the following packages:

  • express — provides the HTTP server used to receive data from the controller
  • mssql — provides the database connection and SQL query interface for Microsoft SQL Server
  • dotenv — loads the application settings from the .env file

During installation, npm creates the node_modules folder and installs the dependencies listed in package.json. It may also create or update package-lock.json.

After the installation is complete, the working folder should contain the original application files together with the newly created Node.js files and folders.

Run all subsequent Node.js commands from the same working folder.

Step 3 – Creating the SQL Server Database and Table

After installing the required packages, open SQL Server Management Studio and connect to the SQL Server instance that will store the controller measurement data.

In Object Explorer, right-click Databases and select New Database. Enter a suitable database name, for example:

TRC_Data

Click OK to create the database.

Next, open the supplied create_tables.sql file in SQL Server Management Studio. Before executing the script, select the newly created database from the database drop-down list in the SQL editor toolbar, and then click Execute.

The script creates the tcw_data table, which stores measurement and status data from supported Teracom controllers. The receiver stores each supported data item from the JSON message as a separate row.

The table uses a universal structure that can accommodate data from different controller models without requiring separate tables for each device type. It includes information such as:

  • device ID and device name;
  • firmware version;
  • data section and item identifier;
  • optional sub-item identifier;
  • channel or item description;
  • the received value in both text and numeric format;
  • engineering unit;
  • alarm state;
  • recording date and time.

The script also creates indexes for faster queries by device and timestamp, as well as by data section and item identifier.

After the script runs successfully, refresh the Tables folder under the database. The dbo.tcw_data table should appear:

SQL Server Management Studio showing the table for Teracom controller data in SQL Server

Step 4 – Configuring the .env File

Next, configure the .env file. The Node.js receiver uses this file to store the Microsoft SQL Server connection details and application settings. Keeping these values in a separate configuration file makes the setup easier to manage and avoids changing the receiver.js source code.

Open the .env file in a text editor, such as Notepad or Visual Studio Code.

The default file contains:

DB_SERVER=YOUR_SERVER
DB_DATABASE=YOUR_DATABASE
DB_USER=YOUR_USER
DB_PASSWORD=YOUR_PASSWORD
PORT=5000
TIMESTAMP_SOURCE=server

A completed configuration may look like this:

DB_SERVER=192.168.32.12
DB_DATABASE=TRC_Data
DB_USER=trc_user
DB_PASSWORD=your_password
PORT=5000
TIMESTAMP_SOURCE=server

Use the settings as follows:

  • DB_SERVER — SQL Server IP address, hostname, or instance name
  • DB_DATABASE — name of the database created in the previous step
  • DB_USER — SQL Server login used by the Node.js receiver
  • DB_PASSWORD — password for the SQL Server login
  • PORT — TCP port on which the HTTP receiver listens. Ensure that Windows Firewall allows the selected port when the controller is on another computer or network device.
  • TIMESTAMP_SOURCE — determines which timestamp the receiver stores: server — uses the date and time of the receiver computer when it receives the data. We recommend this setting. controller — uses the date and time reported by the controller.

Save the file after entering the correct settings.

The .env file must remain in the same working folder as receiver.js.

Step 5 – Starting the Node.js Receiver

After saving the .env file, start the Node.js HTTP receiver.

Open Command Prompt and navigate to the working folder:

cd C:\HTTP_Receiver

Start the application with the following command:

node receiver.js

If the application starts successfully, the following message will appear:

TCW receiver running on port 5000
Timestamp source: server
Loaded parsers: tcw260, tcw242, tcw241, tcw220, tcw210th, tcw280, tcg120-4, tcg140-4

Command Prompt showing the Teracom Node.js HTTP receiver running on port 5000

This confirms that the receiver is running and listening for incoming HTTP requests on the port specified in the .env file.

Keep the Command Prompt window open while testing the system. Closing the window will stop the Node.js application.

To stop the receiver manually, press:

Ctrl+C

At this stage, the receiver is ready to accept HTTP POST messages from the controller. Next, verify access to the application through a web browser.

Step 6 – Testing the Receiver

Before configuring HTTP POST in the controller, verify that the Node.js receiver is running and accessible over the network.

Keep the Command Prompt window from the previous step open. The following message should still be visible:

TCW receiver running on port 5000

On the same computer, open a web browser and enter:

http://localhost:5000/receiver

The receiver should return: The Node.js script is working!

This confirms that the Node.js receiver is running and that the /receiver endpoint is available locally.

Next, test the receiver using the IP address of the computer on which the application is running:

http://192.168.1.50:5000/receiver

Replace 192.168.1.50 with the actual IP address of the receiver computer.

Testing with the IP address is important because the controller will use this address when sending HTTP POST requests. If the page opens successfully from another computer on the same network, the receiver is reachable through the local network.

This test confirms only that the HTTP endpoint is reachable. The controller’s first JSON message will verify the SQL Server connection and database inserts.

Step 7 – Configuring HTTP POST in the Controller

After confirming that the Node.js receiver is accessible over the network, configure the controller to send its monitoring data using HTTP POST.

Open a web browser and log in to the controller web interface. Navigate to: Services → HTTP Post.

Enable the HTTP POST service and enter the address of the computer running the Node.js receiver in the server URL field.

Use the following format: http://SERVER_IP:5000/receiver

Replace SERVER_IP with the actual IP address of the receiver computer. The port number must match the PORT value configured in the .env file.

Set the Post period according to how often the controller should send data. For example, a value of 60 seconds causes the controller to transmit its current data once per minute.

Then, select JSON as the data format because the supplied parsers process the JSON structure generated by supported Teracom controllers.

After saving the settings, click the Test button to verify the HTTP POST connection.

If the configuration is correct and the receiver is reachable, the controller should display the response OK.

TCW260 HTTP POST settings configured to send JSON data to the Node.js receiver

This confirms that the controller can connect to the configured Node.js receiver URL.

The controller will then send its current device and monitoring data at the configured interval. The exact data items depend on the controller model, firmware version, and monitoring configuration.

Step 8 – Verifying Teracom Controller Data in SQL Server

Finally, after the controller sends at least one HTTP POST message, verify that the receiver has stored the controller data successfully in Microsoft SQL Server.

Open SQL Server Management Studio, connect to the SQL Server instance used by the Node.js receiver, and select the database configured in the .env file.

To display the most recent received data, execute:

SELECT TOP 20 *
FROM tcw_data
ORDER BY recorded_at DESC;

The query returns the most recently stored controller values.

Teracom controller data in SQL Server displayed in the tcw_data table

In the TCW260 example used in this guide, the results may include records such as:

  • Temperature
  • Relative humidity
  • Atmospheric pressure
  • CO₂ concentration
  • input, relay, or alarm states, depending on the configuration.

Each row contains information such as:

  • controller device name and device ID;
  • firmware version;
  • data section and item identifier;
  • optional sub-item identifier;
  • item or channel description;
  • received value in text and/or numeric format;
  • engineering unit, where available;
  • alarm state, where available;
  • recording date and time.

After each configured HTTP POST interval, new records should appear in the database. Run the query again to confirm that the controller continues to send data and that the Node.js inserts the records correctly.

Security

This example uses HTTP for simplicity within a trusted local network. However, use HTTPS when the selected controller model and firmware support it and the device transmits data over an untrusted network. In addition, restrict access to the receiver with appropriate firewall rules, IP filtering, VPN access, or network segmentation.

Conclusion

This integration provides a simple and flexible way to receive and store Teracom controller data in Microsoft SQL Server. The controller sends its data as JSON using HTTP POST, while the Node.js receiver processes the message with a model-specific parser and stores the supported data items in the universal tcw_data table.

As a result, you can use the stored data for historical analysis, reporting, visualization, integration with enterprise software, or the development of custom dashboards and applications.