[homematic] Prevent the use of exponential notation (#12436)
* Prevent the use of exponential notation The CCU does not accept exponential notation in TCL scripts. Fix #12301 Signed-off-by: Martin Herbst <develop@mherbst.de>
This commit is contained in:
parent
0e0b9afe08
commit
a533b19130
@ -14,6 +14,7 @@ package org.openhab.binding.homematic.internal.communicator;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -149,7 +150,12 @@ public class CcuGateway extends AbstractHomematicGateway {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setVariable(HmDatapoint dp, Object value) throws IOException {
|
protected void setVariable(HmDatapoint dp, Object value) throws IOException {
|
||||||
String strValue = Objects.toString(value, "").replace("\"", "\\\"");
|
String strValue;
|
||||||
|
if (value instanceof Double) {
|
||||||
|
strValue = new BigDecimal((Double) value).stripTrailingZeros().toPlainString();
|
||||||
|
} else {
|
||||||
|
strValue = Objects.toString(value, "").replace("\"", "\\\"");
|
||||||
|
}
|
||||||
if (dp.isStringType()) {
|
if (dp.isStringType()) {
|
||||||
strValue = "\"" + strValue + "\"";
|
strValue = "\"" + strValue + "\"";
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user