|
24 | 24 | import org.eclipse.jdt.annotation.NonNullByDefault;
|
25 | 25 | import org.eclipse.jdt.annotation.Nullable;
|
26 | 26 | import org.openhab.binding.siemensrds.points.BasePoint;
|
| 27 | +import org.openhab.core.library.types.DecimalType; |
27 | 28 | import org.openhab.core.library.types.OnOffType;
|
28 | 29 | import org.openhab.core.library.types.QuantityType;
|
29 | 30 | import org.openhab.core.library.types.StringType;
|
@@ -312,16 +313,21 @@ private synchronized void doHandleCommand(String channelId, Command command) {
|
312 | 313 | if (channelId.equals(channel.id)) {
|
313 | 314 | switch (channel.id) {
|
314 | 315 | case CHA_TARGET_TEMP: {
|
315 |
| - Command doCommand = command; |
| 316 | + double targetTemperature = Double.NaN; |
316 | 317 | if (command instanceof QuantityType<?> quantityCommand) {
|
317 | 318 | Unit<?> unit = points.getPointByClass(channel.clazz).getUnit();
|
318 | 319 | QuantityType<?> temp = quantityCommand.toUnit(unit);
|
319 | 320 | if (temp != null) {
|
320 |
| - doCommand = temp; |
| 321 | + targetTemperature = temp.doubleValue(); |
321 | 322 | }
|
| 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); |
322 | 330 | }
|
323 |
| - points.setValue(apiKey, token, channel.clazz, doCommand.format("%s")); |
324 |
| - debouncer.initialize(channelId); |
325 | 331 | break;
|
326 | 332 | }
|
327 | 333 | case CHA_STAT_AUTO_MODE: {
|
|
0 commit comments