diff --git a/bundles/org.openhab.binding.opensprinkler/src/main/java/org/openhab/binding/opensprinkler/internal/handler/OpenSprinklerStationHandler.java b/bundles/org.openhab.binding.opensprinkler/src/main/java/org/openhab/binding/opensprinkler/internal/handler/OpenSprinklerStationHandler.java
index f0b5718760e..2ce7230f17c 100644
--- a/bundles/org.openhab.binding.opensprinkler/src/main/java/org/openhab/binding/opensprinkler/internal/handler/OpenSprinklerStationHandler.java
+++ b/bundles/org.openhab.binding.opensprinkler/src/main/java/org/openhab/binding/opensprinkler/internal/handler/OpenSprinklerStationHandler.java
@@ -25,7 +25,6 @@ import org.openhab.binding.opensprinkler.internal.api.OpenSprinklerApi;
import org.openhab.binding.opensprinkler.internal.api.exception.CommunicationApiException;
import org.openhab.binding.opensprinkler.internal.api.exception.GeneralApiException;
import org.openhab.binding.opensprinkler.internal.config.OpenSprinklerStationConfig;
-import org.openhab.core.library.types.DecimalType;
import org.openhab.core.library.types.OnOffType;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.thing.Channel;
@@ -85,13 +84,14 @@ public class OpenSprinklerStationHandler extends OpenSprinklerBaseHandler {
updateChannels();
}
+ @SuppressWarnings("null")
private void handleNextDurationCommand(ChannelUID channelUID, Command command) {
if (!(command instanceof QuantityType>)) {
logger.info("Ignoring implausible non-QuantityType command for NEXT_DURATION");
return;
}
QuantityType> quantity = (QuantityType>) command;
- this.nextDurationTime = quantity.toBigDecimal();
+ this.nextDurationTime = quantity.toUnit(Units.SECOND).toBigDecimal();
updateState(channelUID, quantity);
}
@@ -204,7 +204,7 @@ public class OpenSprinklerStationHandler extends OpenSprinklerBaseHandler {
case NEXT_DURATION:
BigDecimal duration = nextDurationValue();
if (duration != null) {
- updateState(channel, new DecimalType(duration));
+ updateState(channel, new QuantityType<>(duration, Units.SECOND));
}
break;
case STATION_QUEUED:
diff --git a/bundles/org.openhab.binding.opensprinkler/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.opensprinkler/src/main/resources/OH-INF/thing/thing-types.xml
index 22afafaef1d..bea478715c3 100644
--- a/bundles/org.openhab.binding.opensprinkler/src/main/resources/OH-INF/thing/thing-types.xml
+++ b/bundles/org.openhab.binding.opensprinkler/src/main/resources/OH-INF/thing/thing-types.xml
@@ -120,6 +120,6 @@
Number:Time
The duration the station will be opened the next time it is switched on.
-
+