Commit 618bc681 authored by Martin Manchev's avatar Martin Manchev Committed by Ivan Tyagov

[Fix] Double now works ...

parent b10eefa3
......@@ -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">
......
......@@ -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}\nValue: {v}\nValue Type: {type(v)}\n\n")
if not isinstance(v, (int, float, str)):
v = str(v)
serialized_data[k] = v
print(f"Key: {k}\nValue: {v}\nValue Type: {type(v)}\n\n")
params = urllib.parse.quote_plus(json.dumps(serialized_data))
self.session.auth = (erp5_username, erp5_password)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment