psi-4ward / s7client

Hi level API for node-snap7 to communication with Siemens S7 PLCs
https://psi-4ward.github.io/s7client/
MIT License
46 stars 17 forks source link

Cannot connect to Siemens Logo8 #15

Open MartinMuzatko opened 4 years ago

MartinMuzatko commented 4 years ago

Hey there!

I was able to connect to our LOGO 8 via tools like http://www.frickelzeugs.de/logocontrol/

However via nodejs S7Client, I have no success.

This is my setup:

const { S7Client } = require('s7client')
const plcSettings = {
    name: "SLOGO8",
    host: '192.168.255.200',
    connectionCheckInterval: 20000,
    maxRetryDelay: 20000,
    alivePkgCycle: 20000,
}

const client = new S7Client(plcSettings)
client.on('error', console.error)

const start = async () => {
    await client.connect()
    // client.disconnect()
}

start()

This is my result:

(node:1597) UnhandledPromiseRejectionWarning: Error: SLOGO8:  ISO : An error occurred during recv TCP : Connection timed out    at S7Client._getErr (/mnt/c/Users/Martin Muzatko/dev/test/slogo/node_modules/s7client/src/index.js:325:12)    
    at /mnt/c/Users/Martin Muzatko/dev/test/slogo/node_modules/s7client/src/index.js:336:36
(node:1597) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1597) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

When I try to connect to another port, I get at least:

`(node:1567) UnhandledPromiseRejectionWarning: TCP : Unreachable peer

Thank you in advance!

MartinMuzatko commented 4 years ago

After enabling server connection, still no changes:

image

MartinMuzatko commented 4 years ago

So I had success with many other libs, including node-snap7, nodes7. Weird, I thought s7client is built upon node-snap7 :S

mathiask88 commented 4 years ago

I think this is because this lib does not provide a way to use SetConnectionParams() to set the local and remote TSAP.

psi-4ward commented 4 years ago

Feel free to prepare a PR :)

JeffersonJiao commented 4 years ago

So I had success with many other libs, including node-snap7, nodes7. Weird, I thought s7client is built upon node-snap7 :S

Hello there, I am also looking into communicating with LOGO using nodeJS do you have a simple example reading input and sending data back to LOGO from node server?