Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mpi-s7

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mpi-s7

Node.JS library to communicate with MPI-USB adapters

  • 0.4.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2.2K
increased by11.74%
Maintainers
1
Weekly downloads
 
Created
Source

mpi-s7

This library aims to implement all the protocols needed to communicate with MPI-USB adapters, used to communicate with some older PLCs from Siemens. It does not implement the "S7 communication" protocol, leaving it to other libraries.

This software is not affiliated with Siemens in any way, nor am I. S7-300, S7-400, S7-1200 and S7-1500 are trademarks of Siemens AG.

This node was created as part of the ST-One project.

Disclaimer

This is a work in progress. Expect things to break, crash and burn. We cannot be hold liable for any damage to any equipment or issues directly or indirectly caused by this library. You've been warned.

Install

This library depends on the node-usb library, therefore their requirements apply here. Apart from that, you can currently install it by running

npm install mpi-s7

Linux

Two main topics can cause you problem on Linux: Permissions and ModemManager. To avoid them, you can copy the udev rule 90-mpi-usb.rules that is on the root folder of this project to /etc/udev/rules.d, and reload them with udevadm control --reload(or just restart your system).

The udev rule will:

  • Put the MPI-USB adapter on the dialout group, where most users already are
  • Set a flag that instructs ModemManager to ignore the adapter

Feel free to adjust the rule to your needs

Windows

On Windows, you'll need to use Zadig to install a libusb-compatible driver to the MPI-USB adapter. After installing it, the adapter should be accessible from this library, but won't be accessible from other software anymore.

Usage

Warning: this library currenlty offers a modified version of the nodes7 interface as a shortcut for the implementation of the upper "S7 communication" protocol. In the near future the efforts will be merged with them, and we'll no longer offer it anymore. Expect a complete new API to interact with.

const mpiS7 = require('.');

let conn = new mpiS7.NodeS7();

const variables = {
    TEST1: 'M0.7'
}

const opts = {
    mpiAddress: 6
}

function readAllItems() {
    conn.readAllItems((err, data) => {
        if (err) {
            console.log("Error reading values!", err);
        } else {
            console.log("Values:", data);
        }

        //don't forget to close connection before exiting!
        conn.dropConnection();
    })
}

conn.initiateConnection(opts, err => {
    if (err) {
        console.log("Error connecting to PLC!", err)
        return;
    }

    console.log("Connected to the PLC!");

    conn.setTranslationCB(tag => variables[tag]);
    conn.addItems(Object.keys(variables));

    readAllItems();
});

Documentation

TODOs

Besides all //TODOs on the code, we have:

  • PPP - resend data if we don't get an ACK
  • PPP - implement max retries if don't get an ack

License

Copyright: (c) 2019-2021, ST-One, Guilherme Francescon Cittolin guilherme@st-one.io

GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)

FAQs

Package last updated on 27 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc