| rawPhase | Number | Read | Current phase of the program running on the appliance as raw number |
| start | DateTime | Read | Programmed start time of the program |
| end | DateTime | Read | End time of the program (programmed or running) |
-| duration | DateTime | Read | Duration of the program running on the appliance |
-| elapsed | DateTime | Read | Time elapsed in the program running on the appliance |
-| finish | DateTime | Read | Time to finish the program running on the appliance |
+| duration | Number:Time | Read | Duration of the program running on the appliance |
+| elapsed | Number:Time | Read | Time elapsed in the program running on the appliance |
+| finish | Number:Time | Read | Time to finish the program running on the appliance |
| door | Contact | Read | Current state of the door of the appliance |
| switch | Switch | Write | Switch the appliance on or off |
| powerConsumption | Number:Power | Read | Power consumption by the currently running program on the appliance |
| rawPhase | Number | Read | Current phase of the program running on the appliance as raw number |
| start | DateTime | Read | Programmed start time of the program |
| end | DateTime | Read | End time of the program (programmed or running) |
-| duration | DateTime | Read | Duration of the program running on the appliance |
-| elapsed | DateTime | Read | Time elapsed in the program running on the appliance |
-| finish | DateTime | Read | Time to finish the program running on the appliance |
+| duration | Number:Time | Read | Duration of the program running on the appliance |
+| elapsed | Number:Time | Read | Time elapsed in the program running on the appliance |
+| finish | Number:Time | Read | Time to finish the program running on the appliance |
| target | Number:Temperature | Read | Target temperature to be reached by the oven |
| measured | Number:Temperature | Read | Actual measured temperature in the oven |
| temp1 | Number:Temperature | Read | Program temperature in the oven 1 |
| rawPhase | Number | Read | Current phase of the program running on the appliance as raw number |
| start | DateTime | Read | Programmed start time of the program |
| end | DateTime | Read | End time of the program (programmed or running) |
-| duration | DateTime | Read | Duration of the program running on the appliance |
-| elapsed | DateTime | Read | Time elapsed in the program running on the appliance |
-| finish | DateTime | Read | Time to finish the program running on the appliance |
+| duration | Number:Time | Read | Duration of the program running on the appliance |
+| elapsed | Number:Time | Read | Time elapsed in the program running on the appliance |
+| finish | Number:Time | Read | Time to finish the program running on the appliance |
| door | Contact | Read | Current state of the door of the appliance |
| switch | Switch | Write | Switch the appliance on or off |
| step | Number | Read | Current step in the program running on the appliance |
| rawPhase | Number | Read | Current phase of the program running on the appliance as raw number |
| start | DateTime | Read | Programmed start time of the program |
| end | DateTime | Read | End time of the program (programmed or running) |
-| duration | DateTime | Read | Duration of the program running on the appliance |
-| elapsed | DateTime | Read | Time elapsed in the program running on the appliance |
-| finish | DateTime | Read | Time to finish the program running on the appliance |
+| duration | Number:Time | Read | Duration of the program running on the appliance |
+| elapsed | Number:Time | Read | Time elapsed in the program running on the appliance |
+| finish | Number:Time | Read | Time to finish the program running on the appliance |
| door | Contact | Read | Current state of the door of the appliance |
| switch | Switch | Write | Switch the appliance on or off |
| target | Number:Temperature | Read | Temperature of the selected program (10 °C = cold) |
import static org.openhab.binding.miele.internal.MieleBindingConstants.*;
import java.lang.reflect.Method;
-import java.text.SimpleDateFormat;
-import java.util.Date;
import java.util.Map;
-import java.util.TimeZone;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.library.types.OpenClosedType;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.types.StringType;
+import org.openhab.core.library.unit.Units;
import org.openhab.core.types.State;
import org.openhab.core.types.Type;
import org.openhab.core.types.UnDefType;
PROGRAM_PHASE(RAW_PHASE_PROPERTY_NAME, PHASE_CHANNEL_ID, DecimalType.class, false, false),
START_TIME("", START_CHANNEL_ID, DateTimeType.class, false, false),
END_TIME("", END_CHANNEL_ID, DateTimeType.class, false, false),
- DURATION("duration", "duration", DateTimeType.class, false, false) {
+ DURATION("duration", "duration", QuantityType.class, false, false) {
@Override
public State getState(String s, @Nullable DeviceMetaData dmd, MieleTranslationProvider translationProvider) {
- Date date = new Date();
- SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
- dateFormatter.setTimeZone(TimeZone.getTimeZone("GMT+0"));
try {
- date.setTime(Long.valueOf(s) * 60000);
- } catch (Exception e) {
- date.setTime(0);
+ return new QuantityType<>(Long.valueOf(s), Units.MINUTE);
+ } catch (NumberFormatException e) {
+ return UnDefType.UNDEF;
}
- return getState(dateFormatter.format(date));
}
},
- ELAPSED_TIME("elapsedTime", "elapsed", DateTimeType.class, false, false) {
+ ELAPSED_TIME("elapsedTime", "elapsed", QuantityType.class, false, false) {
@Override
public State getState(String s, @Nullable DeviceMetaData dmd, MieleTranslationProvider translationProvider) {
- Date date = new Date();
- SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
- dateFormatter.setTimeZone(TimeZone.getTimeZone("GMT+0"));
try {
- date.setTime(Long.valueOf(s) * 60000);
- } catch (Exception e) {
- date.setTime(0);
+ return new QuantityType<>(Long.valueOf(s), Units.MINUTE);
+ } catch (NumberFormatException e) {
+ return UnDefType.UNDEF;
}
- return getState(dateFormatter.format(date));
}
},
- FINISH_TIME("", FINISH_CHANNEL_ID, DateTimeType.class, false, false),
+ FINISH_TIME("", FINISH_CHANNEL_ID, QuantityType.class, false, false),
DOOR("signalDoor", "door", OpenClosedType.class, false, false) {
@Override
public State getState(String s, @Nullable DeviceMetaData dmd, MieleTranslationProvider translationProvider) {
import static org.openhab.binding.miele.internal.MieleBindingConstants.*;
import java.time.Instant;
-import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.temporal.ChronoUnit;
import java.util.HashMap;
import org.openhab.core.i18n.TranslationProvider;
import org.openhab.core.library.types.DateTimeType;
import org.openhab.core.library.types.OnOffType;
+import org.openhab.core.library.types.QuantityType;
+import org.openhab.core.library.unit.Units;
import org.openhab.core.thing.Bridge;
import org.openhab.core.thing.ChannelUID;
import org.openhab.core.thing.Thing;
try {
long minutesFromNow = Long.valueOf(value);
if (minutesFromNow > 0) {
- ZonedDateTime remaining = ZonedDateTime.ofInstant(Instant.ofEpochSecond(minutesFromNow * 60),
- ZoneId.of("UTC"));
- updateState(channelUid, new DateTimeType(remaining.withZoneSameLocal(timeZoneProvider.getTimeZone())));
+ updateState(channelUid, new QuantityType<>(minutesFromNow, Units.MINUTE));
return;
}
} catch (NumberFormatException e) {
import static org.openhab.binding.miele.internal.MieleBindingConstants.*;
import java.lang.reflect.Method;
-import java.text.SimpleDateFormat;
-import java.util.Date;
import java.util.Map;
-import java.util.TimeZone;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.library.types.OpenClosedType;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.types.StringType;
+import org.openhab.core.library.unit.Units;
import org.openhab.core.types.State;
import org.openhab.core.types.Type;
import org.openhab.core.types.UnDefType;
PROGRAM_PHASE(RAW_PHASE_PROPERTY_NAME, PHASE_CHANNEL_ID, DecimalType.class, false),
START_TIME("", START_CHANNEL_ID, DateTimeType.class, false),
END_TIME("", END_CHANNEL_ID, DateTimeType.class, false),
- DURATION("duration", "duration", DateTimeType.class, false) {
+ DURATION("duration", "duration", QuantityType.class, false) {
@Override
public State getState(String s, @Nullable DeviceMetaData dmd, MieleTranslationProvider translationProvider) {
- Date date = new Date();
- SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
- dateFormatter.setTimeZone(TimeZone.getTimeZone("GMT+0"));
try {
- date.setTime(Long.valueOf(s) * 60000);
- } catch (Exception e) {
- date.setTime(0);
+ return new QuantityType<>(Long.valueOf(s), Units.MINUTE);
+ } catch (NumberFormatException e) {
+ return UnDefType.UNDEF;
}
- return getState(dateFormatter.format(date));
}
},
- ELAPSED_TIME("elapsedTime", "elapsed", DateTimeType.class, false) {
+ ELAPSED_TIME("elapsedTime", "elapsed", QuantityType.class, false) {
@Override
public State getState(String s, @Nullable DeviceMetaData dmd, MieleTranslationProvider translationProvider) {
- Date date = new Date();
- SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
- dateFormatter.setTimeZone(TimeZone.getTimeZone("GMT+0"));
try {
- date.setTime(Long.valueOf(s) * 60000);
- } catch (Exception e) {
- date.setTime(0);
+ return new QuantityType<>(Long.valueOf(s), Units.MINUTE);
+ } catch (NumberFormatException e) {
+ return UnDefType.UNDEF;
}
- return getState(dateFormatter.format(date));
}
},
- FINISH_TIME("", FINISH_CHANNEL_ID, DateTimeType.class, false),
+ FINISH_TIME("", FINISH_CHANNEL_ID, QuantityType.class, false),
TARGET_TEMP("targetTemperature", "target", QuantityType.class, false) {
@Override
public State getState(String s, @Nullable DeviceMetaData dmd, MieleTranslationProvider translationProvider) {
import static org.openhab.binding.miele.internal.MieleBindingConstants.*;
import java.lang.reflect.Method;
-import java.text.SimpleDateFormat;
-import java.util.Date;
import java.util.Map;
-import java.util.TimeZone;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.library.types.DecimalType;
import org.openhab.core.library.types.OnOffType;
import org.openhab.core.library.types.OpenClosedType;
+import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.types.StringType;
+import org.openhab.core.library.unit.Units;
import org.openhab.core.types.State;
import org.openhab.core.types.Type;
import org.openhab.core.types.UnDefType;
PROGRAM_PHASE(RAW_PHASE_PROPERTY_NAME, PHASE_CHANNEL_ID, DecimalType.class, false),
START_TIME("", START_CHANNEL_ID, DateTimeType.class, false),
END_TIME("", END_CHANNEL_ID, DateTimeType.class, false),
- DURATION("duration", "duration", DateTimeType.class, false) {
+ DURATION("duration", "duration", QuantityType.class, false) {
@Override
public State getState(String s, @Nullable DeviceMetaData dmd, MieleTranslationProvider translationProvider) {
- Date date = new Date();
- SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
- dateFormatter.setTimeZone(TimeZone.getTimeZone("GMT+0"));
try {
- date.setTime(Long.valueOf(s) * 60000);
- } catch (Exception e) {
- date.setTime(0);
+ return new QuantityType<>(Long.valueOf(s), Units.MINUTE);
+ } catch (NumberFormatException e) {
+ return UnDefType.UNDEF;
}
- return getState(dateFormatter.format(date));
}
},
- ELAPSED_TIME("elapsedTime", "elapsed", DateTimeType.class, false) {
+ ELAPSED_TIME("elapsedTime", "elapsed", QuantityType.class, false) {
@Override
public State getState(String s, @Nullable DeviceMetaData dmd, MieleTranslationProvider translationProvider) {
- Date date = new Date();
- SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
- dateFormatter.setTimeZone(TimeZone.getTimeZone("GMT+0"));
try {
- date.setTime(Long.valueOf(s) * 60000);
- } catch (Exception e) {
- date.setTime(0);
+ return new QuantityType<>(Long.valueOf(s), Units.MINUTE);
+ } catch (NumberFormatException e) {
+ return UnDefType.UNDEF;
}
- return getState(dateFormatter.format(date));
}
},
- FINISH_TIME("", FINISH_CHANNEL_ID, DateTimeType.class, false),
+ FINISH_TIME("", FINISH_CHANNEL_ID, QuantityType.class, false),
DRYING_STEP("dryingStep", "step", DecimalType.class, false) {
@Override
public State getState(String s, @Nullable DeviceMetaData dmd, MieleTranslationProvider translationProvider) {
import static org.openhab.binding.miele.internal.MieleBindingConstants.*;
import java.lang.reflect.Method;
-import java.text.SimpleDateFormat;
-import java.util.Date;
import java.util.Map;
-import java.util.TimeZone;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.library.types.OpenClosedType;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.types.StringType;
+import org.openhab.core.library.unit.Units;
import org.openhab.core.types.State;
import org.openhab.core.types.Type;
import org.openhab.core.types.UnDefType;
PROGRAM_PHASE(RAW_PHASE_PROPERTY_NAME, PHASE_CHANNEL_ID, DecimalType.class, false, false),
START_TIME("", START_CHANNEL_ID, DateTimeType.class, false, false),
END_TIME("", END_CHANNEL_ID, DateTimeType.class, false, false),
- DURATION("duration", "duration", DateTimeType.class, false, false) {
+ DURATION("duration", "duration", QuantityType.class, false, false) {
@Override
public State getState(String s, @Nullable DeviceMetaData dmd, MieleTranslationProvider translationProvider) {
- Date date = new Date();
- SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
- dateFormatter.setTimeZone(TimeZone.getTimeZone("GMT+0"));
try {
- date.setTime(Long.valueOf(s.trim()) * 60000);
- } catch (Exception e) {
- date.setTime(0);
+ return new QuantityType<>(Long.valueOf(s), Units.MINUTE);
+ } catch (NumberFormatException e) {
+ return UnDefType.UNDEF;
}
- return getState(dateFormatter.format(date));
}
},
- ELAPSED_TIME("elapsedTime", "elapsed", DateTimeType.class, false, false) {
+ ELAPSED_TIME("elapsedTime", "elapsed", QuantityType.class, false, false) {
@Override
public State getState(String s, @Nullable DeviceMetaData dmd, MieleTranslationProvider translationProvider) {
- Date date = new Date();
- SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
- dateFormatter.setTimeZone(TimeZone.getTimeZone("GMT+0"));
try {
- date.setTime(Long.valueOf(s) * 60000);
- } catch (Exception e) {
- date.setTime(0);
+ return new QuantityType<>(Long.valueOf(s), Units.MINUTE);
+ } catch (NumberFormatException e) {
+ return UnDefType.UNDEF;
}
- return getState(dateFormatter.format(date));
}
},
- FINISH_TIME("", FINISH_CHANNEL_ID, DateTimeType.class, false, false),
+ FINISH_TIME("", FINISH_CHANNEL_ID, QuantityType.class, false, false),
TARGET_TEMP("targetTemperature", "target", QuantityType.class, false, false) {
@Override
public State getState(String s, @Nullable DeviceMetaData dmd, MieleTranslationProvider translationProvider) {
</channel-type>
<channel-type id="duration">
- <item-type>DateTime</item-type>
+ <item-type>Number:Time</item-type>
<label>Duration</label>
<description>Duration of the program running on the appliance</description>
<category>Time</category>
- <state readOnly="true" pattern="%1$tH:%1$tM"></state>
+ <state readOnly="true" pattern="%1$tR"></state>
</channel-type>
<channel-type id="elapsed">
- <item-type>DateTime</item-type>
+ <item-type>Number:Time</item-type>
<label>Elapsed Time</label>
<description>Time elapsed in the program running on the appliance</description>
<category>Time</category>
- <state readOnly="true" pattern="%1$tH:%1$tM"></state>
+ <state readOnly="true" pattern="%1$tR"></state>
</channel-type>
<channel-type id="finish">
- <item-type>DateTime</item-type>
+ <item-type>Number:Time</item-type>
<label>Finish Time</label>
<description>Time to finish the program running on the appliance</description>
<category>Time</category>
- <state readOnly="true" pattern="%1$tH:%1$tM"></state>
+ <state readOnly="true" pattern="%1$tR"></state>
</channel-type>
<channel-type id="door">