Read and write to a Opc DA server in python

Viewed 88

I'm trying to read and write in a Opc Da server that run on localhost with 11159 port and server id 'BR.OPC.Server_3.0_V1.14.2'. This is my code:

import OpenOPC
import pywintypes

pywintypes.datetime = pywintypes.TimeType
opc=OpenOPC.open_client('localhost',11159)

I tryed also with the server id but always I get 'cannot connect .....' error.

Someone can help me?

1 Answers

There is a new approach called WebSocket4OPC to help you achieve that. As its name hints it uses websocket as network transportation so bunch of popular languages, including Python, can communicate with OPC DA seamlessly. No DCOM or OPC DA interface is exposed. Very neat solution IMO. Check out this Link if you are interested.

Related