npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-opcua-mqtt-gateway

v1.0.2

Published

An IIoT Gateway application to bridge OPC UA servers and MQTT brokers by Bufferstack.IO Aanalytics Technology LLP, Pune.

Downloads

207

Readme

Node OPC UA MQTT Gateway

Description

The Bufferstack.IO OPC UA MQTT Gateway is an IIoT Gateway application that facilitates communication between an OPC UA server and an MQTT broker. This application allows you to read and write data from an OPC UA server using MQTT, enabling seamless integration of industrial automation data into IoT applications.

Features

  • Connects to an OPC UA server and retrieves data.
  • Publishes data to an MQTT broker.
  • Supports both reading from and writing to the OPC UA server via MQTT.
  • Configurable via a config.toml file for easy setup.

Installation

  1. Clone the repository:

    git clone https://github.com/hj91/node-opcua-mqtt-gateway.git
    cd node-opcua-mqtt-gateway
  2. Install dependencies:

    npm install
  3. Generate SSL certificates (if necessary):

      1.  mkdir -p ./certs/own/certs ./certs/own/private
      2. openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ./certs/own/private/private_key.pem -out ./certs/own/certs/client_selfsigned_cert.pem -subj "/CN=NodeOPCUAClient" -extensions san -config <(cat /etc/ssl/openssl.cnf \
     <(printf "[san]\nsubjectAltName=URI:urn:iiot-gateway:NodeOPCUA-Client"))
  4. Configure the application: Edit the config.toml file to set up the OPC UA and MQTT connection settings.

Configuration

config.toml

Here’s a sample configuration file:

# OPC UA connection settings
[opcua]
url = "opc.tcp://192.168.1.43:49320/KEPServerEX"
user = ""
pass = ""

# MQTT connection settings
[mqtt]
host = "localhost"
port = 1883
username = ""
password = ""

# Metrics to collect
[[metrics]]
datatype = "number"
tags = { machine = "machine_1", fields = "valid_job" }
nodeId = "ns=2;s=Painting.MachineID.Valid_job"
interval = 1000
topic = "painting/machineID/valid_job"
mode = "pub"
# Options: pub, sub, pubsub

[[metrics]]
datatype = "number"
tags = { machine = "machine_2", fields = "invalid_job" }
nodeId = "ns=2;s=Painting.MachineID.Invalid_job"
interval = 1000
topic = "painting/machineID/invalid_job"
mode = "pubsub"
# Options: pub, sub, pubsub

Usage

To start the application, run:

npm start

The application will connect to the OPC UA server, retrieve specified metrics, and publish them to the configured MQTT topics.

Docker

To run the dockerized version of application, run:

docker run -d   -v ./certs:/app/certs   -v ./config:/app/config   --name opcua-mqtt-gateway   node-opcua-mqtt-gateway

License

This project is licensed under the GPL-3.0 License. See the LICENSE file for details.

Author

Harshad Joshi
GitHub: hj91