Skip to content

Commit

Permalink
[knx] Remove workaround for DPT 14 (openhab#14503)
Browse files Browse the repository at this point in the history
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
  • Loading branch information
holgerfriedrich authored and FordPrfkt committed Apr 19, 2023
1 parent ac1949d commit 37e68e7
Showing 1 changed file with 0 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
Expand Down Expand Up @@ -899,28 +897,6 @@ private String quantityTypeToDPTValue(QuantityType<?> qt, int mainNumber, int su
case 8:
return translator3BitControlled.getControlBit() ? UpDownType.DOWN : UpDownType.UP;
}
case 14:
/*
* FIXME: Workaround for a bug in Calimero / Openhab DPTXlator4ByteFloat.makeString(): is using a
* locale when
* translating a Float to String. It could happen the a ',' is used as separator, such as
* 3,14159E20.
* Openhab's DecimalType expects this to be in US format and expects '.': 3.14159E20.
* There is no issue with DPTXlator2ByteFloat since calimero is using a non-localized translation
* there.
*/
DPTXlator4ByteFloat translator4ByteFloat = (DPTXlator4ByteFloat) translator;
Float f = translator4ByteFloat.getValueFloat();
if (Math.abs(f) < 100000) {
value = String.valueOf(f);
} else {
NumberFormat dcf = NumberFormat.getInstance(Locale.US);
if (dcf instanceof DecimalFormat) {
((DecimalFormat) dcf).applyPattern("0.#####E0");
}
value = dcf.format(f);
}
break;
case 18:
DPTXlatorSceneControl translatorSceneControl = (DPTXlatorSceneControl) translator;
int decimalValue = translatorSceneControl.getSceneNumber();
Expand Down

0 comments on commit 37e68e7

Please sign in to comment.