Skip to content

Commit 5d20cba

Browse files
authored
[siemensrds] Fix setting of target temperature (openhab#17697)
Signed-off-by: AndrewFG <software@whitebear.ch>
1 parent 3fef5cc commit 5d20cba

File tree

1 file changed

+10
-4
lines changed
  • bundles/org.openhab.binding.siemensrds/src/main/java/org/openhab/binding/siemensrds/internal

1 file changed

+10
-4
lines changed

bundles/org.openhab.binding.siemensrds/src/main/java/org/openhab/binding/siemensrds/internal/RdsHandler.java

+10-4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.eclipse.jdt.annotation.NonNullByDefault;
2525
import org.eclipse.jdt.annotation.Nullable;
2626
import org.openhab.binding.siemensrds.points.BasePoint;
27+
import org.openhab.core.library.types.DecimalType;
2728
import org.openhab.core.library.types.OnOffType;
2829
import org.openhab.core.library.types.QuantityType;
2930
import org.openhab.core.library.types.StringType;
@@ -312,16 +313,21 @@ private synchronized void doHandleCommand(String channelId, Command command) {
312313
if (channelId.equals(channel.id)) {
313314
switch (channel.id) {
314315
case CHA_TARGET_TEMP: {
315-
Command doCommand = command;
316+
double targetTemperature = Double.NaN;
316317
if (command instanceof QuantityType<?> quantityCommand) {
317318
Unit<?> unit = points.getPointByClass(channel.clazz).getUnit();
318319
QuantityType<?> temp = quantityCommand.toUnit(unit);
319320
if (temp != null) {
320-
doCommand = temp;
321+
targetTemperature = temp.doubleValue();
321322
}
323+
} else if (command instanceof DecimalType decimalCommand) {
324+
targetTemperature = decimalCommand.doubleValue();
325+
}
326+
if (targetTemperature != Double.NaN) {
327+
points.setValue(apiKey, token, channel.clazz,
328+
String.format("%.1f", Math.round(targetTemperature * 2) / 2.0));
329+
debouncer.initialize(channelId);
322330
}
323-
points.setValue(apiKey, token, channel.clazz, doCommand.format("%s"));
324-
debouncer.initialize(channelId);
325331
break;
326332
}
327333
case CHA_STAT_AUTO_MODE: {

0 commit comments

Comments
 (0)