*/
package org.openhab.binding.warmup.internal.action;
+import javax.measure.quantity.Temperature;
+import javax.measure.quantity.Time;
+
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.warmup.internal.handler.RoomHandler;
@RuleAction(label = "override", description = "Overrides the thermostat state for a specified time")
public void setOverride(
- @ActionInput(name = "temperature", label = "Temperature") @Nullable QuantityType<?> temperature,
- @ActionInput(name = "duration", label = "Duration") @Nullable QuantityType<?> duration) {
+ @ActionInput(name = "temperature", label = "Temperature") @Nullable QuantityType<Temperature> temperature,
+ @ActionInput(name = "duration", label = "Duration") @Nullable QuantityType<Time> duration) {
logger.debug("setOverride action called");
RoomHandler handler = this.handler;
if (handler != null && temperature != null && duration != null) {
}
}
- public static void setOverride(@Nullable ThingActions actions, @Nullable QuantityType<?> temperature,
- @Nullable QuantityType<?> duration) {
+ public static void setOverride(@Nullable ThingActions actions, @Nullable QuantityType<Temperature> temperature,
+ @Nullable QuantityType<Time> duration) {
if (actions instanceof WarmupActions warmupActions) {
warmupActions.setOverride(temperature, duration);
} else {
import java.util.Map;
import java.util.Set;
+import javax.measure.quantity.Temperature;
+import javax.measure.quantity.Time;
+
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
+import org.openhab.binding.warmup.internal.WarmupBindingConstants.RoomMode;
import org.openhab.binding.warmup.internal.action.WarmupActions;
import org.openhab.binding.warmup.internal.api.MyWarmupApi;
import org.openhab.binding.warmup.internal.api.MyWarmupApiException;
super.handleCommand(channelUID, command);
if (CHANNEL_TARGET_TEMPERATURE.equals(channelUID.getId())
&& command instanceof QuantityType<?> quantityCommand) {
- setOverride(quantityCommand);
+ setOverride((QuantityType<Temperature>) quantityCommand);
}
if (CHANNEL_FIXED_TEMPERATURE.equals(channelUID.getId())
&& command instanceof QuantityType<?> quantityCommand) {
- setFixed(quantityCommand);
+ setFixed((QuantityType<Temperature>) quantityCommand);
}
if (CHANNEL_FROST_PROTECTION_MODE.equals(channelUID.getId()) && command instanceof OnOffType onOffCommand) {
toggleFrostProtectionMode(onOffCommand);
return Set.of(WarmupActions.class);
}
- private void setOverride(final QuantityType<?> command) {
+ private void setOverride(final QuantityType<Temperature> command) {
setOverride(command, new QuantityType<>(config.getOverrideDuration(), Units.MINUTE));
}
- public void setOverride(final QuantityType<?> temperature, final QuantityType<?> duration) {
+ public void setOverride(final QuantityType<Temperature> temperature, final QuantityType<Time> duration) {
setOverride(formatTemperature(temperature), duration.toUnit(Units.MINUTE).intValue());
}
}
}
- private void setFixed(final QuantityType<?> command) {
+ private void setFixed(final QuantityType<Temperature> command) {
try {
RoomCallout rc = getCallout();
rc.api.setFixed(rc.locationId, rc.roomId, formatTemperature(command));
*/
package org.openhab.binding.warmup.internal.handler;
+import javax.measure.quantity.Temperature;
+
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.library.types.QuantityType;
* @param temperature {@link QuantityType} a temperature
* @return the temperature as an int in degrees C * 10. i.e. 21.5 degrees C = 215
*/
- protected int formatTemperature(QuantityType<?> temperature) {
+ protected int formatTemperature(QuantityType<Temperature> temperature) {
return (int) (temperature.toUnit(SIUnits.CELSIUS).doubleValue() * 10);
}