-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keep getting GatewayTargetDeviceFailedToRespond #66
Comments
Hi, I had a similar responde from a S&P Domeo. It was a very simple fix:
The problem is that the library defaults have a very large timeout value. Try changing to this: modbus.tcp.connect(502, "1.2.3.4", {
debug : null,
retries : 5, // number of tries
retry : 500, // half a second retry (default is 30 seconds or more, which does not work)
}, (err, connection) => {
// ...
}); |
Hi,
In my case, I develop the server, the client is a meter.
in the meter, I changed the timeout to 1 second, still same issue
var modbus = require("modbus-stream");
modbus.tcp.server({ debug: null }, (connection) => {
console.log("incoming connection");
connection.readInputRegisters({ address: 0, quantity: 16 }, (err, info) => {
console.error("err", err);
console.log("response", info);
});
}).listen(502);
…On Mon, Mar 22, 2021 at 11:43 AM Diogo Resende ***@***.***> wrote:
Hi,
I had a similar responde from a S&P Domeo. It was a very simple fix:
- The device is sleeping and you need to wake it up, by sending
something. A request is enough but it won't reply to that request, it will
just wake up;
- The device will get back to sleep usually under a minute.
The problem is that the library defaults have a very large timeout value.
Try changing to this:
modbus.tcp.connect(502, "1.2.3.4", {
debug : null,
retries : 5, // number of tries
retry : 500, // half a second retry (default is 30 seconds or more, which does not work)}, (err, connection) => {
// ...});
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#66 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZ3NNHRG2V5SUYKOXNWQ6DTE4GN3ANCNFSM4ZR2ODBA>
.
|
And you seen an incoming connection but the devices doesn't respond to your request? |
exactly.
connection.readInputRegistersends up in GatewayTargetDeviceFailedToRespond
…On Mon, Mar 22, 2021 at 2:22 PM Diogo Resende ***@***.***> wrote:
And you seen an incoming connection but the devices doesn't respond to
your request?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#66 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZ3NNGWLUOG6XERAIPLEHLTE4ZBDANCNFSM4ZR2ODBA>
.
|
In that case, it makes little sense. Are you sure it doesn't need any type of wake up? If it's compliant, it should respond with an error. That error is the library telling you it didn't respond. |
Still, try passing a lower |
Hi, |
TCP is handled in a lower level, we have no control. But it should handle network issues. What doesn't handle is if the hardware is sleeping and uses the first try to wake up. That's the point of retrying a few times, to give it time to wake up and respond. |
Still same :( I had a session with the hardware support (https://www.satec-global.com/PM135) Any additional methods to debug the issue?
|
You're not? Can you test your code there? Another thing, you're reading address 46081. Is that address on the specification of that device? Usually devices start input registers at 40001 but the protocol address always starts at zero. Perhaps the devices just ignores your request because of that address, try using address 6080 (46081-40001). |
I tried a different approach: I ran the code on a local machine resides on the same network as the device:
|
I believe it was the address. Now you just have to parse those registers. I would assume they are (u)int16 big endian as most are. So maybe... > Buffer.from([ 0x0b, 0xab ]).readUInt16BE(0)
2987 And perhaps that number has decimals and it's 298,7 or 29,87 |
I think you misunderstood me... It is still doesn't work when the device ping the server and the server requests from registers. |
Oh..
Perhaps the device has some kind of handshake or something? I had a bridge once that did just that. It would open a connection but before switching to modbus tcp, there was a very basic (and insecure) handshake/authentication. Perhaps the device is waiting for an hello packet or it send an hello packet..? |
Hi again, We continued the debugging, I do see the registers are sent from the meter (using wireshark) but the server cannot get them (Error: GatewayTargetDeviceFailedToRespond). Attached is the tcpdump from the server. |
Apparently the problem is in the address we read from, when we read from 0 (which holds custom registers) we get errors. any idea? |
That error usually means the other endpoint terminated connection in the meantime. Perhaps listening to |
Yes, I found one of the posts here talking about this. is there an example on how to somehow keep the socket open once connection is made? |
Hi All,
I'm using the basic example to get coils/registers from our Meter.
I keep getting GatewayTargetDeviceFailedToRespond :(
Please help,
Dekel
The text was updated successfully, but these errors were encountered: