Skip to content

Commit b955cb3

Browse files
committed
fix write unit_mod
1 parent 012dc72 commit b955cb3

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

classes/transports/modbus_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ def write_variable(self, entry : registry_map_entry, value : str, registry_type
403403

404404
#apply unit_mod before writing.
405405
if entry.unit_mod != 1:
406-
value = int(value) / entry.unit_mod # say unitmod is 0.1. 100*0.1 = 10.0. 10 / 0.1 = 100.
406+
value = int(float(value) / entry.unit_mod) # say unitmod is 0.1. 105*0.1 = 10.5. 10.5 / 0.1 = 105.
407407

408408
#results[entry.variable_name]
409409
ushortValue : int = None #ushort

0 commit comments

Comments
 (0)