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;
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);
}
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:
<item-type>Number:Time</item-type>
<label>Next Open Duration</label>
<description>The duration the station will be opened the next time it is switched on.</description>
- <state readOnly="false" pattern="%.0f s"/>
+ <state readOnly="false" pattern="%.0f min"/>
</channel-type>
</thing:thing-descriptions>