{"action":"created","issue":{"url":"https://api.github.com/repos/Cloud-Automation/node-modbus/issues/195","repository_url":"https://api.github.com/repos/Cloud-Automation/node-modbus","labels_url":"https://api.github.com/repos/Cloud-Automation/node-modbus/issues/195/labels{/name}","comments_url":"https://api.github.com/repos/Cloud-Automation/node-modbus/issues/195/comments","events_url":"https://api.github.com/repos/Cloud-Automation/node-modbus/issues/195/events","html_url":"https://github.com/Cloud-Automation/node-modbus/issues/195","id":329048316,"node_id":"MDU6SXNzdWUzMjkwNDgzMTY=","number":195,"title":"modbus rtu Request timed out","user":{"login":"Mohammed-OceanPLX","id":32494170,"node_id":"MDQ6VXNlcjMyNDk0MTcw","avatar_url":"https://avatars2.githubusercontent.com/u/32494170?v=4","gravatar_id":"","url":"https://api.github.com/users/Mohammed-OceanPLX","html_url":"https://github.com/Mohammed-OceanPLX","followers_url":"https://api.github.com/users/Mohammed-OceanPLX/followers","following_url":"https://api.github.com/users/Mohammed-OceanPLX/following{/other_user}","gists_url":"https://api.github.com/users/Mohammed-OceanPLX/gists{/gist_id}","starred_url":"https://api.github.com/users/Mohammed-OceanPLX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mohammed-OceanPLX/subscriptions","organizations_url":"https://api.github.com/users/Mohammed-OceanPLX/orgs","repos_url":"https://api.github.com/users/Mohammed-OceanPLX/repos","events_url":"https://api.github.com/users/Mohammed-OceanPLX/events{/privacy}","received_events_url":"https://api.github.com/users/Mohammed-OceanPLX/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":39,"created_at":"2018-06-04T13:08:35Z","updated_at":"2018-06-20T10:49:48Z","closed_at":null,"author_association":"NONE","body":"Hello,\r\n I am having an issue trying to connect to salve device through Modbus RTU with ReadHoldingRegisters.js using the code below,\r\n I am getting the error:\r\n{ '0': { err: 'Timeout', message: 'Request timed out' } }\r\n{ '0': null }\r\n\r\nCould you help please? thanks in advance!\r\n\r\n````let modbus = require('jsmodbus')\r\nlet SerialPort = require('serialport')\r\nlet socket = new SerialPort('COM6', {\r\n  baudRate: 19200,\r\n  Parity: 'none',\r\n  stopBits: 1,\r\n  dataBits: 8\r\n})\r\n//set Slave PLC ID\r\nlet client = new modbus.client.RTU(socket , 1)\r\n\r\nsocket.on('close', function () {\r\n  console.log(arguments)\r\n})\r\n\r\nsocket.on('open', function () {\r\n  console.log('opened');\r\n  client.readDiscreteInputs(1,1)\r\n    .then(function (resp) {\r\n      console.log(resp)\r\n      socket.close()\r\n    }).catch(function () {\r\n      console.error(arguments)\r\n      socket.close()\r\n    })\r\n})\r\n\r\nsocket.on('data', function () {\r\n  console.log(arguments)\r\n})\r\n\r\nsocket.on('error', console.error)\r\n````\r\n"},"comment":{"url":"https://api.github.com/repos/Cloud-Automation/node-modbus/issues/comments/398707385","html_url":"https://github.com/Cloud-Automation/node-modbus/issues/195#issuecomment-398707385","issue_url":"https://api.github.com/repos/Cloud-Automation/node-modbus/issues/195","id":398707385,"node_id":"MDEyOklzc3VlQ29tbWVudDM5ODcwNzM4NQ==","user":{"login":"Mohammed-OceanPLX","id":32494170,"node_id":"MDQ6VXNlcjMyNDk0MTcw","avatar_url":"https://avatars2.githubusercontent.com/u/32494170?v=4","gravatar_id":"","url":"https://api.github.com/users/Mohammed-OceanPLX","html_url":"https://github.com/Mohammed-OceanPLX","followers_url":"https://api.github.com/users/Mohammed-OceanPLX/followers","following_url":"https://api.github.com/users/Mohammed-OceanPLX/following{/other_user}","gists_url":"https://api.github.com/users/Mohammed-OceanPLX/gists{/gist_id}","starred_url":"https://api.github.com/users/Mohammed-OceanPLX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mohammed-OceanPLX/subscriptions","organizations_url":"https://api.github.com/users/Mohammed-OceanPLX/orgs","repos_url":"https://api.github.com/users/Mohammed-OceanPLX/repos","events_url":"https://api.github.com/users/Mohammed-OceanPLX/events{/privacy}","received_events_url":"https://api.github.com/users/Mohammed-OceanPLX/received_events","type":"User","site_admin":false},"created_at":"2018-06-20T10:49:48Z","updated_at":"2018-06-20T10:49:48Z","author_association":"NONE","body":"got this\r\n  serialport:binding:auto-detect loading WindowsBinding +0ms\r\n  serialport:main opening path: COM5 +0ms\r\n  serialport:bindings open +0ms\r\n  serialport:main _read queueing _read for after open +2ms\r\n  serialport:main opened path: COM5 +87ms\r\nopened\r\n  modbus-client issuing new read holding registers request +0ms\r\n  rtu-client-request-handler registrating new request +0ms\r\n  user-request creating new user request with timeout 5000 +0ms\r\n  client-request-handler flushing +0ms\r\n  client-request-handler flushing new request <Buffer 01 03 00 01 00 01 d5 ca> +2ms\r\n  serialport:main _write 8 bytes of data +10ms\r\n  serialport:bindings write 8 bytes +99ms\r\n  serialport:main _read reading +4ms\r\n  serialport:bindings read +3ms\r\n  serialport:main binding.write write finished +2ms\r\n  client-request-handler request fully flushed, ( error: undefined ) undefined +8ms\r\n  serialport:main binding.read finished +28ms\r\n  modbus-client received data +42ms\r\n  rtu-response-handler receiving new data +0ms\r\n  rtu-response-handler buffer <Buffer 01> +2ms\r\n  rtu-response address 1 buffer <Buffer 01> +0ms\r\n  response-factory when NoSuchIndex Exception, the buffer does not contain a complete message +0ms\r\n  response-factory RangeError: Index out of range\r\n  response-factory     at checkOffset (buffer.js:977:11)\r\n  response-factory     at Buffer.readUInt8 (buffer.js:1015:5)\r\n  response-factory     at Function.fromBuffer (F:\\ocnplcx\\nodeapps0\\node_modules\\jsmodbus\\src\\response\\response-factory.js:19:23)\r\n  response-factory     at Function.fromBuffer (F:\\ocnplcx\\nodeapps0\\node_modules\\jsmodbus\\src\\rtu-response.js:14:32)\r\n  response-factory     at ModbusRTUClientResponseHandler.handleData (F:\\ocnplcx\\nodeapps0\\node_modules\\jsmodbus\\src\\rtu-client-response-handler.js:17:40)\r\n  response-factory     at ModbusRTUClient._onData (F:\\ocnplcx\\nodeapps0\\node_modules\\jsmodbus\\src\\modbus-client.js:37:27)\r\n  response-factory     at emitOne (events.js:121:20)\r\n  response-factory     at SerialPort.emit (events.js:211:7)\r\n  response-factory     at addChunk (_stream_readable.js:263:12)\r\n  response-factory     at readableAddChunk (_stream_readable.js:250:11) +1ms\r\n  rtu-response-handler not enough data available to parse +4ms\r\n{ '0': <Buffer 01> }\r\n  serialport:main _read reading +11ms\r\n  serialport:bindings read +43ms\r\n  serialport:main binding.read finished +6ms\r\n  modbus-client received data +15ms\r\n  rtu-response-handler receiving new data +8ms\r\n  rtu-response-handler buffer <Buffer 01 03 02 00 32 39 91> +1ms\r\n  rtu-response address 1 buffer <Buffer 01 03 02 00 32 39 91> +13ms\r\n  response-factory fc 3 payload <Buffer 03 02 00 32 39 91> +11ms\r\n  rtu-response-handler crc 259 +2ms\r\n  rtu-response-handler reset buffer from 7 to 1 +0ms\r\n  rtu-response address 145 buffer <Buffer 91> +2ms\r\n  response-factory when NoSuchIndex Exception, the buffer does not contain a complete message +3ms\r\n  response-factory RangeError: Index out of range\r\n  response-factory     at checkOffset (buffer.js:977:11)\r\n  response-factory     at Buffer.readUInt8 (buffer.js:1015:5)\r\n  response-factory     at Function.fromBuffer (F:\\ocnplcx\\nodeapps0\\node_modules\\jsmodbus\\src\\response\\response-factory.js:19:23)\r\n  response-factory     at Function.fromBuffer (F:\\ocnplcx\\nodeapps0\\node_modules\\jsmodbus\\src\\rtu-response.js:14:32)\r\n  response-factory     at ModbusRTUClientResponseHandler.handleData (F:\\ocnplcx\\nodeapps0\\node_modules\\jsmodbus\\src\\rtu-client-response-handler.js:17:40)\r\n  response-factory     at ModbusRTUClient._onData (F:\\ocnplcx\\nodeapps0\\node_modules\\jsmodbus\\src\\modbus-client.js:37:27)\r\n  response-factory     at emitOne (events.js:121:20)\r\n  response-factory     at SerialPort.emit (events.js:211:7)\r\n  response-factory     at addChunk (_stream_readable.js:263:12)\r\n  response-factory     at readableAddChunk (_stream_readable.js:250:11) +2ms\r\n  rtu-response-handler not enough data available to parse +4ms\r\n  rtu-client-request-handler new response coming in +65ms\r\n  rtu-client-request-handler create crc from response +1ms\r\n  rtu-client-request-handler CRC does not match 259 !== 34049 +1ms\r\n{ '0': <Buffer 03 02 00 32 39 91> }\r\n  serialport:main _read reading +12ms\r\n  serialport:bindings read +20ms\r\n{ '0':\r\n   { err: 'crcMismatch',\r\n     message: 'the response payload does not match the crc' } }\r\n  serialport:main #close +9ms\r\n  serialport:bindings close +6ms\r\n  serialport:main binding.read error { Error: Reading from COM port (ReadIOCompletion): Operation aborted canceled: true } +1ms\r\n  serialport:main _read queueing _read for after open +1ms\r\n  serialport:main binding.close finished +36ms\r\n{ '0': null }\r\n"}}
{"actor":{"display_login":"Mohammed-OceanPLX"}}