ioBroker/ioBroker.s7

String from IoB to S7 does not work

smolo-de opened this issue · 6 comments

Transfer of string from IoB to S7 does not work with following error:

s7.0 | 2021-11-07 12:18:08.504 | error | (19312) Exception-Code: ERR_INVALID_ARG_TYPE: The "size" argument must be of type number. Received type string ('202')
s7.0 | 2021-11-07 12:18:08.503 | error | (19312) TypeError [ERR_INVALID_ARG_TYPE]: The "size" argument must be of type number. Received type string ('202') at Function.alloc (buffer.js:370:3) at send (/opt/iobroker/node_modules/iobro
s7.0 | 2021-11-07 12:18:08.502 | error | (19312) uncaught exception: The "size" argument must be of type number. Received type string ('202')

S7 1500 with db element with STRING[20]

I think the error can be located at this line

buf = Buffer.alloc(data.native.len + 2);
because there could be an api change in nodejs. There was a known error in PLCHome NodeRed Adapter.

PLCHome/node-red-contrib-ads#19 (comment)

old: var stringbuf = new Buffer(val.toString().slice(0,convert.length-1) + '\0', 'binary')
wrong: var stringbuf = Buffer.alloc(val.toString().slice(0,convert.length-1) + '\0', 'binary')
new: var stringbuf = Buffer.from(val.toString().slice(0,convert.length-1) + '\0', 'binary')

And how the config looks for this? We could make sure ".len" is a number

And how the config looks for this? We could make sure ".len" is a number

PLC:
grafik

S7 Adapter:
grafik

Object:
grafik

The bug with length of 2 is known.

Ja das "len" hab ich beu mir denke schin gefickt. kann ich später pushen ... das mit "rw und poll"bezüg sich auf das andere issue ...

Bitte GitHub version versuchen, nach Installation Adapter restarten.

Please test v1.3.9

Perfect no more problems 👍

Tested with S7 1515-2pn