Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
osie
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
0
Merge Requests
0
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
Martin Manchev
osie
Commits
493068dc
Commit
493068dc
authored
Dec 18, 2023
by
Martin Manchev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Fix] Double now works ...
parent
576677e1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
13 deletions
+8
-13
opcua-to-http-gw/opcua-server-config.xml
opcua-to-http-gw/opcua-server-config.xml
+2
-2
opcua-to-http-gw/opcua-to-http-gw.py
opcua-to-http-gw/opcua-to-http-gw.py
+6
-11
No files found.
opcua-to-http-gw/opcua-server-config.xml
View file @
493068dc
...
...
@@ -31,14 +31,14 @@
</UAVariable>
<!-- Float example -->
<UAVariable
NodeId=
"ns=1;i=4"
BrowseName=
"1:erp5-variable-float"
ParentNodeId=
"i=85"
DataType=
"Float"
AccessLevel=
"3"
UserAccessLevel=
"3"
>
<
!-- <
UAVariable NodeId="ns=1;i=4" BrowseName="1:erp5-variable-float" ParentNodeId="i=85" DataType="Float" AccessLevel="3" UserAccessLevel="3">
<DisplayName>erp5-variable-float</DisplayName>
<Description>erp5-variable-float</Description>
<References>
<Reference ReferenceType="HasComponent" IsForward="false">ns=1;i=9</Reference>
<Reference ReferenceType="HasTypeDefinition">i=63</Reference>
</References>
</UAVariable>
</UAVariable>
-->
<!-- Double (float) example -->
<UAVariable
NodeId=
"ns=1;i=5"
BrowseName=
"1:erp5-variable-double"
ParentNodeId=
"i=85"
DataType=
"Double"
AccessLevel=
"3"
UserAccessLevel=
"3"
>
...
...
opcua-to-http-gw/opcua-to-http-gw.py
View file @
493068dc
...
...
@@ -49,18 +49,13 @@ class ERP5Handler(asyncua.common.subscription.SubHandler):
def
call
(
self
,
http_method
=
"POST"
,
**
data
):
serialized_data
=
{}
for
k
,
v
in
data
.
items
():
# Convert non-serializable types to string
if
not
isinstance
(
v
,
(
int
,
float
,
str
)):
v
=
str
(
v
)
elif
isinstance
(
v
,
float
):
# Ensure proper serialization of float values
if
v
.
is_integer
():
v
=
int
(
v
)
else
:
v
=
float
(
v
)
serialized_data
[
k
]
=
v
print
(
f"Key:
{
k
}\
n
Value:
{
v
}\
n
Value Type:
{
type
(
v
)
}\
n
\
n
"
)
if
not
isinstance
(
v
,
(
int
,
float
,
str
)):
v
=
str
(
v
)
serialized_data
[
k
]
=
v
print
(
f"Key:
{
k
}\
n
Value:
{
v
}\
n
Value Type:
{
type
(
v
)
}\
n
\
n
"
)
params
=
urllib
.
parse
.
quote_plus
(
json
.
dumps
(
serialized_data
))
self
.
session
.
auth
=
(
erp5_username
,
erp5_password
)
...
...
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