calimero-project / calimero-core

Core library for KNX network access and management
Other
128 stars 65 forks source link

KNX binding fails on sending PercentType to DPT 5.001 #53

Closed lewie closed 6 years ago

lewie commented 6 years ago

@bmalinowsky, could this be a bug?

"It's debatable if this is a bug in Calimero, because the Exception is originating in Calimero. It tries to decode the String to a Short, which fails for non-integer values."

Thank You!

bmalinowsky commented 6 years ago

Yes, decimals could be handled better for the scaling and angle types. I put a commit to calimero-core/fix/dpt-5.x.

The changes are that now all values (not just type 5.001) are parsed as double and rounded where required. Internally, the representation remains as-is ofc. Now, the translator also returns non-truncated values from ::getNumericValue. The return value of ::getValue I changed to FPN output but is limited to 1 decimal, because I think the standard formatting for FPNs does not really add a lot information for this DPT.

If you have time, I would appreciate feedback if the new parsing/formatting would be of any concern or cause problems for you?

Thanks for your report!