Skip to content
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

Cannot write to OPC variable #2

Open
emrebekar opened this issue May 2, 2020 · 3 comments
Open

Cannot write to OPC variable #2

emrebekar opened this issue May 2, 2020 · 3 comments

Comments

@emrebekar
Copy link
Contributor

Hi.

Can you provide a sample code in order to write varible to OPC Server?

@duduyoyo
Copy link

duduyoyo commented Oct 9, 2020

Basically in write() of opcSyncIO.js it passed write.value and write.handle to construct a ComValue, which is wrong. It should pass write.value[0]/write.handle[0] instead. But there is still a glitch in return value, which shows negative value(-1073479674) as below. Look inside write() and _comObj.call(callObject) returns OK. Any idea?

`let types = [];
let values = [];
types[0] = Types.SHORT;
values[0] = 3;

let valueObj = [];
valueObj[0] = { handle: serverHandles, type: types, value: values };

let resultWrite = await opcSyncIO.write(valueObj);
console.log(resultWrite[0].getValue());`

@emrebekar
Copy link
Contributor Author

Yes. We found the solution after update node-dcom project. I updated and sent push back to repository to write variables.

Thanks for your advice

@steuck13
Copy link
Contributor

Greetings

We've been busy with lots of other projects but we plan to update the libs with the changes as soon as we have the time and we decide how to present the writing function to the user on our Node-RED node. The changes made by @emrebekar in node-dcom and node-opc-da are already merged but new releases of npm packages will only happen when we also update node-red-contrib-opc-da.

A temporary fix would be installing directly from the github repository. If you've found a new bug we missed in the last changes please open a new issue.

Ty for your understanding

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants