Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
opcua-asyncio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nikola Balog
opcua-asyncio
Commits
83bf46ad
Commit
83bf46ad
authored
Oct 28, 2015
by
olivier R-D
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update example
parent
010fbdb3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
examples/client_to_prosys.py
examples/client_to_prosys.py
+9
-5
No files found.
examples/client_to_prosys.py
View file @
83bf46ad
import
sys
sys
.
path
.
insert
(
0
,
".."
)
import
logging
from
opcua
import
Client
...
...
@@ -20,8 +22,8 @@ class SubHandler(object):
if
__name__
==
"__main__"
:
#from IPython import embed
logging
.
basicConfig
(
level
=
logging
.
WARN
)
#
client = Client("opc.tcp://localhost:53530/OPCUA/SimulationServer/")
client
=
Client
(
"opc.tcp://olivier:olivierpass@localhost:53530/OPCUA/SimulationServer/"
)
client
=
Client
(
"opc.tcp://localhost:53530/OPCUA/SimulationServer/"
)
#
client = Client("opc.tcp://olivier:olivierpass@localhost:53530/OPCUA/SimulationServer/")
try
:
client
.
connect
()
root
=
client
.
get_root_node
()
...
...
@@ -47,14 +49,16 @@ if __name__ == "__main__":
handler
=
SubHandler
()
sub
=
client
.
create_subscription
(
500
,
handler
)
sub
.
subscribe_data_change
(
var
)
handle
=
sub
.
subscribe_data_change
(
var
)
device
=
objects
.
get_child
([
"2:MyObjects"
,
"2:MyDevice"
])
method
=
device
.
get_child
(
"2:MyMethod"
)
result
=
device
.
call_method
(
method
,
ua
.
Variant
(
"sin"
),
ua
.
Variant
(
180
,
ua
.
VariantType
.
Double
))
print
(
"Mehtod result is: "
,
result
)
embed
()
client
.
close_session
()
#embed()
sub
.
unsubscribe
(
handle
)
sub
.
delete
()
#client.close_session()
finally
:
client
.
disconnect
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment