{"action":"closed","issue":{"url":"https://api.github.com/repos/Cloud-Automation/node-modbus/issues/149","repository_url":"https://api.github.com/repos/Cloud-Automation/node-modbus","labels_url":"https://api.github.com/repos/Cloud-Automation/node-modbus/issues/149/labels{/name}","comments_url":"https://api.github.com/repos/Cloud-Automation/node-modbus/issues/149/comments","events_url":"https://api.github.com/repos/Cloud-Automation/node-modbus/issues/149/events","html_url":"https://github.com/Cloud-Automation/node-modbus/issues/149","id":261263942,"number":149,"title":"unitId should be a parameter of modbus functions","user":{"login":"laurbadescu","id":32358639,"avatar_url":"https://avatars1.githubusercontent.com/u/32358639?v=4","gravatar_id":"","url":"https://api.github.com/users/laurbadescu","html_url":"https://github.com/laurbadescu","followers_url":"https://api.github.com/users/laurbadescu/followers","following_url":"https://api.github.com/users/laurbadescu/following{/other_user}","gists_url":"https://api.github.com/users/laurbadescu/gists{/gist_id}","starred_url":"https://api.github.com/users/laurbadescu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laurbadescu/subscriptions","organizations_url":"https://api.github.com/users/laurbadescu/orgs","repos_url":"https://api.github.com/users/laurbadescu/repos","events_url":"https://api.github.com/users/laurbadescu/events{/privacy}","received_events_url":"https://api.github.com/users/laurbadescu/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":16,"created_at":"2017-09-28T10:09:25Z","updated_at":"2018-02-21T23:26:57Z","closed_at":"2018-02-21T23:26:57Z","author_association":"NONE","body":"Hi.\r\nI've seen that unitId is stored as a parameter in the tcp client\r\nobject on modbus-tcp-client.js. Each call to a modbus function (I am\r\ncurrently using readHoldingRegisters from ReadHoldingRegisters.js)\r\nultimately loads the buffer with the pdu and the unitId from the\r\nconnection and then sends the buffer. So, regardless of the function\r\nused, a single tcp connection will always use the same unitId.\r\nIt would be very nice if the modbus functions could receive a different\r\nunitId as parameter so each of them will load its buffer with a\r\ndifferent unitId thus addressing different devices on the same\r\nconnection. I've made some raw changes in your sources to implement this\r\nand is working perfectly.\r\n\r\nThe only alternative that I see to that is calling modbus\r\nfunctions one by one in sequence and changing the tcp connection's\r\nunitId in between. It works\r\nas well, of course, but that means that I have to manage the hassle of calling the\r\nfunctions on my own and tracking their status, defeating the whole purpose of reqFifo io\r\nmodbus-client-core.js"}}
{"actor":{"display_login":"stefanpoeter"}}