* Add raw channels for state, program and phase.
* Provide program/phase texts when missing from XGW 3000 and for multicast.
* Consistent handling of missing program/phase text across all appliance types.
* Fix tumble dryer example configuration.
* Changed tumble dryer Finished phase text for consistency.
Fixes #11335
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
## Thing Configuration
-Each appliances needs the device UID as a configuration parameter.
+Each appliance needs the device UID as a configuration parameter.
The UID is nowhere to be found on the appliances, but since the discovery works quite reliably, a manual configuration is not needed.
Once you got hold of the IDs, a manual configuration looks like this:
## Channels
-The definition of the channels in use can best be checked in the [source repository](https://github.com/openhab/openhab-addons/tree/main/bundles/org.openhab.binding.miele/src/main/resources/OH-INF/thing).
+See below which channels are available for each appliance type. Raw program and phase values are individual for each appliance type,
+while these raw state values are unique across all appliance types:
-## Example
+| State | Description | Appliances |
+|-------|------------------------------|-----------------------------------------------------------------|
+| 0 | Unknown | All |
+| 1 | Off | All |
+| 2 | Stand-By | All |
+| 3 | Programmed | Coffee Machine, Dishwasher, Oven, Tumble Dryer, Washing Machine |
+| 4 | Waiting to Start | Coffee Machine, Dishwasher, Oven, Tumble Dryer, Washing Machine |
+| 5 | Running | All |
+| 6 | Paused | Coffee Machine, Dishwasher, Oven, Tumble Dryer, Washing Machine |
+| 7 | End | Coffee Machine, Dishwasher, Oven, Tumble Dryer, Washing Machine |
+| 8 | Failure | All |
+| 9 | Abort | Coffee Machine, Dishwasher, Oven, Tumble Dryer, Washing Machine |
+| 10 | Idle | All |
+| 11 | Rinse Hold | Washing Machine, Tumble Dryer |
+| 12 | Service | All |
+| 13 | Super Freezing | Fridge/Freezer combination |
+| 14 | Super Cooling | Fridge, Fridge/Freezer combination |
+| 15 | Super Heating | Hob |
+| 144 | Default | All |
+| 145 | Locked | All |
+| 146 | Super Cooling/Super Freezing | Fridge/Freezer combination |
+| 255 | Not Connected | All |
-demo.items:
+### Coffee Machine
+| Channel | Type | Read/write | Description |
+|---------------------|----------------------|------------|---------------------------------------------------------------------|
+| state | String | Read | Current status of the appliance |
+| rawState | Number | Read | Current status of the appliance as raw number |
+| program | String | Read | Current program or function running on the appliance |
+| rawProgram | Number | Read | Current program or function running on the appliance as raw number |
+| type | String | Read | Type of the program running on the appliance |
+| phase | String | Read | Current phase of the program running on the appliance |
+| rawPhase | Number | Read | Current phase of the program running on the appliance as raw number |
+| door | Contact | Read | Current state of the door of the appliance |
+| switch | Switch | Write | Switch the appliance on or off |
+
+### Dishwasher
+
+| Channel | Type | Read/write | Description |
+|---------------------|----------------------|------------|---------------------------------------------------------------------|
+| state | String | Read | Current status of the appliance |
+| rawState | Number | Read | Current status of the appliance as raw number |
+| program | String | Read | Current program or function running on the appliance |
+| rawProgram | Number | Read | Current program or function running on the appliance as raw number |
+| phase | String | Read | Current phase of 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 |
+| 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 |
+| 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 |
+| waterConsumption | Number:Volume | Read | Water consumption by the currently running program on the appliance |
+
+### Fridge
+
+| Channel | Type | Read/write | Description |
+|---------------------|----------------------|------------|---------------------------------------------------------------------|
+| state | String | Read | Current status of the appliance |
+| rawState | Number | Read | Current status of the appliance as raw number |
+| supercool | Switch | Read/Write | Start or stop Super Cooling |
+| current | Number:Temperature | Read | Current temperature in the fridge |
+| target | Number:Temperature | Read | Target temperature to be reached by the fridge |
+| door | Contact | Read | Current state of the door of the appliance |
+| switch | Switch | Write | Switch the appliance on or off |
+
+### Fridge/Freezer combination
+
+| Channel | Type | Read/write | Description |
+|---------------------|----------------------|------------|---------------------------------------------------------------------|
+| state | String | Read | Current status of the appliance |
+| rawState | Number | Read | Current status of the appliance as raw number |
+| freezerstate | String | Read | Current status of the freezer compartment |
+| fridgestate | String | Read | Current status of the fridge compartment |
+| supercool | Switch | Read/Write | Start or stop Super Cooling |
+| superfreeze | Switch | Read/Write | Start or stop Super Freezing |
+| freezercurrent | Number:Temperature | Read | Current temperature in the freezer compartment |
+| freezertarget | Number:Temperature | Read | Target temperature to be reached by the freezer compartment |
+| fridgecurrent | Number:Temperature | Read | Current temperature in the fridge compartment |
+| fridgetarget | Number:Temperature | Read | Target temperature to be reached by the fridge compartment |
+| door | Contact | Read | Current state of the door of the appliance |
+| start | Switch | Write | Switch the appliance on or off |
+
+### Hob
+
+| Channel | Type | Read/write | Description |
+|---------------------|----------------------|------------|---------------------------------------------------------------------|
+| state | String | Read | Current status of the appliance |
+| rawState | Number | Read | Current status of the appliance as raw number |
+| plate1power | Number | Read | Power level of heating zone/plate 1 |
+| plate1heat | Number | Read | Remaining heat level of heating zone/plate 1 |
+| plate1time | String | Read | Remaining time of heating zone/plate 1 |
+| plate2power | Number | Read | Power level of heating zone/plate 2 |
+| plate2heat | Number | Read | Remaining heat level of heating zone/plate 2 |
+| plate2time | String | Read | Remaining time of heating zone/plate 2 |
+| plate3power | Number | Read | Power level of heating zone/plate 3 |
+| plate3heat | Number | Read | Remaining heat level of heating zone/plate 3 |
+| plate3time | String | Read | Remaining time of heating zone/plate 3 |
+| plate4power | Number | Read | Power level of heating zone/plate 4 |
+| plate4heat | Number | Read | Remaining heat level of heating zone/plate 4 |
+| plate4time | String | Read | Remaining time of heating zone/plate 4 |
+| plate5power | Number | Read | Power level of heating zone/plate 5 |
+| plate5heat | Number | Read | Remaining heat level of heating zone/plate 5 |
+| plate5time | String | Read | Remaining time of heating zone/plate 5 |
+| plate6power | Number | Read | Power level of heating zone/plate 6 |
+| plate6heat | Number | Read | Remaining heat level of heating zone/plate 6 |
+| plate6time | String | Read | Remaining time of heating zone/plate 6 |
+
+### Hood
+
+| Channel | Type | Read/write | Description |
+|---------------------|----------------------|------------|---------------------------------------------------------------------|
+| state | String | Read | Current status of the appliance |
+| rawState | Number | Read | Current status of the appliance as raw number |
+| light | Switch | Write | Switch the appliance on or off |
+| ventilation | Number | Read | Current ventilation power |
+| stop | Switch | Write | Stop the appliance |
+
+### Oven
+
+| Channel | Type | Read/write | Description |
+|---------------------|----------------------|------------|---------------------------------------------------------------------|
+| state | String | Read | Current status of the appliance |
+| rawState | Number | Read | Current status of the appliance as raw number |
+| program | String | Read | Current program or function running on the appliance |
+| rawProgram | Number | Read | Current program or function running on the appliance as raw number |
+| type | String | Read | Type of the program running on the appliance |
+| phase | String | Read | Current phase of 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 |
+| 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 |
+| 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 |
+| temp2 | Number:Temperature | Read | Program temperature in the oven 2 |
+| door | Contact | Read | Current state of the door of the appliance |
+| switch | Switch | Write | Switch the appliance on or off |
+| stop | Switch | Write | Stop the appliance |
+
+### Microwave/Oven combination
+
+See oven.
+
+### Tumble Dryer
+
+| Channel | Type | Read/write | Description |
+|---------------------|----------------------|------------|---------------------------------------------------------------------|
+| state | String | Read | Current status of the appliance |
+| rawState | Number | Read | Current status of the appliance as raw number |
+| program | String | Read | Current program or function running on the appliance |
+| rawProgram | Number | Read | Current program or function running on the appliance as raw number |
+| type | String | Read | Type of the program running on the appliance |
+| phase | String | Read | Current phase of 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 |
+| 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 |
+| 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 |
+
+### Washing Machine
+
+| Channel | Type | Read/write | Description |
+|---------------------|----------------------|------------|---------------------------------------------------------------------|
+| state | String | Read | Current status of the appliance |
+| rawState | Number | Read | Current status of the appliance as raw number |
+| program | String | Read | Current program or function running on the appliance |
+| rawProgram | Number | Read | Current program or function running on the appliance as raw number |
+| type | String | Read | Type of the program running on the appliance |
+| phase | String | Read | Current phase of 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 |
+| 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 |
+| 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 |
+| spinningspeed | String | Read | Spinning speed in the program running on the appliance |
+| powerConsumption | Number:Power | Read | Power consumption by the currently running program on the appliance |
+| waterConsumption | Number:Volume | Read | Water consumption by the currently running program on the appliance |
+
+# Configuration Examples
+
+## things/miele.things
+
+```
+Bridge miele:xgw3000:home [ipAddress="192.168.0.18", interface="192.168.0.5"] {
+ Things:
+ Thing fridgefreezer freezer [uid="00124b000424be44#2"]
+ Thing hood hood [uid="001d63fffe020685#210"]
+ Thing fridge fridge [uid="00124b000424bdc0#2"]
+ Thing oven oven [uid="001d63fffe020390#210"]
+ Thing oven microwave [uid="001d63fffe0206eb#210"]
+ Thing hob hob [uid="00124b000424bed7#2"]
+ Thing dishwasher dishwasher [uid="001d63fffe020683#210"]
+ Thing tumbledryer tumbledryer [uid="001d63fffe0200ba#210"]
+ Thing washingmachine washingmachine [uid="001d63fffe020505#210"]
+ Thing coffeemachine coffeemachine [uid="001d63fffe020505#190"]
+}
```
-String MieleFridgeState (gMiele,gMieleFridge) {channel="miele:fridge:dilbeek:fridge:state"}
-Switch MieleFridgeSuperCool (gMiele,gMieleFridge) {channel="miele:fridge:dilbeek:fridge:supercool"}
-Number:Temperature MieleFridgeCurrent (gMiele,gMieleFridge) {channel="miele:fridge:dilbeek:fridge:current"}
-Number:Temperature MieleFridgeTarget (gMiele,gMieleFridge) {channel="miele:fridge:dilbeek:fridge:target"}
-Contact MieleFridgeDoor (gMiele,gMieleFridge) {channel="miele:fridge:dilbeek:fridge:door"}
-Switch MieleFridgeStart (gMiele,gMieleFridge) {channel="miele:fridge:dilbeek:fridge:start"}
+
+## items/miele.items
+
+```
+String Dishwasher_State {channel="miele:dishwasher:home:dishwasher:state"}
+Number Dishwasher_RawState {channel="miele:dishwasher:home:dishwasher:rawState"}
+String Dishwasher_Program "Program [%s]" {channel="miele:dishwasher:home:dishwasher:program"}
+String Dishwasher_Phase "Phase [%s]" {channel="miele:dishwasher:home:dishwasher:phase"}
+DateTime Dishwasher_ElapsedTime "Elapsed time" <time> {channel="miele:dishwasher:home:dishwasher:elapsed"}
+DateTime Dishwasher_FinishTime "Remaining time" <time> {channel="miele:dishwasher:home:dishwasher:finish"}
+Number:Power Dishwasher_PowerConsumption {channel="miele:dishwasher:home:dishwasher:powerConsumption"}
+Number:Volume Dishwasher_WaterConsumption {channel="miele:dishwasher:home:dishwasher:waterConsumption"}
+
+String Fridge_State {channel="miele:fridge:home:fridge:state"}
+Contact Fridge_Door {channel="miele:fridge:home:fridge:door"}
+Switch Fridge_SuperCool {channel="miele:fridge:home:fridge:supercool"}
+Number:Temperature Fridge_CurrentTemperature <temperature> {channel="miele:fridge:home:fridge:current"}
+Number:Temperature Fridge_TargetTemperature <temperature> {channel="miele:fridge:home:fridge:target"}
+Switch Fridge_Start {channel="miele:fridge:home:fridge:start"}
+
+String Oven_State {channel="miele:oven:home:oven:state"}
+Number Oven_RawState {channel="miele:oven:home:oven:rawState"}
+String Oven_Program "Program [%s]" {channel="miele:oven:home:oven:program"}
+String Oven_Phase "Phase [%s]" {channel="miele:oven:home:oven:phase"}
+DateTime Oven_ElapsedTime "Elapsed time" <time> {channel="miele:oven:home:oven:elapsed"}
+DateTime Oven_FinishTime "Remaining time" <time> {channel="miele:oven:home:oven:finish"}
+Number:Temperature Oven_CurrentTemperature <temperature> {channel="miele:oven:home:oven:measured"}
+Number:Temperature Oven_TargetTemperature <temperature> {channel="miele:oven:home:oven:target"}
+Switch Oven_Stop {channel="miele:oven:home:oven:stop", autoupdate="false"}
+
+String WashingMachine_State {channel="miele:washingmachine:home:washingmachine:state"}
+Number WashingMachine_RawState {channel="miele:washingmachine:home:washingmachine:rawState"}
+String WashingMachine_Program "Program [%s]" {channel="miele:washingmachine:home:washingmachine:program"}
+String WashingMachine_Phase "Phase [%s]" {channel="miele:washingmachine:home:washingmachine:phase"}
+Number:Temperature WashingMachine_Temperature <temperature> {channel="miele:washingmachine:home:washingmachine:target"}
+String WashingMachine_SpinningSpeed {channel="miele:washingmachine:home:washingmachine:spinningspeed"}
+DateTime WashingMachine_ElapsedTime "Elapsed time" <time> {channel="miele:washingmachine:home:washingmachine:elapsed"}
+DateTime WashingMachine_FinishTime "Remaining time" <time> {channel="miele:washingmachine:home:washingmachine:finish"}
+Number:Power WashingMachine_PowerConsumption {channel="miele:washingmachine:home:washingmachine:powerConsumption"}
+Number:Volume WashingMachine_WaterConsumption {channel="miele:washingmachine:home:washingmachine:waterConsumption"}
+
+String TumbleDryer_State {channel="miele:tumbledryer:home:tumbledryer:state"}
+Number TumbleDryer_RawState {channel="miele:tumbledryer:home:tumbledryer:rawState"}
+String TumbleDryer_Program "Program [%s]" {channel="miele:tumbledryer:home:tumbledryer:program"}
+String TumbleDryer_Phase "Phase [%s]" {channel="miele:tumbledryer:home:tumbledryer:phase"}
+DateTime TumbleDryer_ElapsedTime "Elapsed time" <time> {channel="miele:tumbledryer:home:tumbledryer:elapsed"}
+DateTime TumbleDryer_FinishTime "Remaining time" <time> {channel="miele:tumbledryer:home:tumbledryer:finish"}
+```
+
+## sitemaps/miele.sitemap
+
+```
+sitemap miele label="Miele" {
+ Frame label="Miele" {
+ Text item=Oven_State label="Oven [%s]" icon="kitchen" {
+ Text item=Oven_Program visibility=[Oven_RawState>1]
+ Text item=Oven_Phase visibility=[Oven_Phase!=UNDEF]
+ Text item=Oven_ElapsedTime
+ Text item=Oven_FinishTime
+ Switch item=Oven_Stop
+ }
+ Text item=WashingMachine_State label="Washing Machine [%s]" icon="washingmachine" {
+ Text item=WashingMachine_Program visibility=[WashingMachine_RawState>1]
+ Text item=WashingMachine_Temperature visibility=[WashingMachine_Program!=UNDEF]
+ Text item=WashingMachine_SpinningSpeed visibility=[WashingMachine_Program!=UNDEF]
+ Text item=WashingMachine_Phase visibility=[WashingMachine_Phase!=UNDEF]
+ Text item=WashingMachine_ElapsedTime
+ Text item=WashingMachine_FinishTime
+ Text item=WashingMachine_PowerConsumption
+ Text item=WashingMachine_WaterConsumption
+ }
+ Text item=TumbleDryer_State label="Tumble Dryer [%s]" icon="dryer" {
+ Text item=TumbleDryer_Program visibility=[TumbleDryer_RawState>1]
+ Text item=TumbleDryer_Phase visibility=[TumbleDryer_Phase!=UNDEF]
+ Text item=TumbleDryer_ElapsedTime
+ Text item=TumbleDryer_FinishTime
+ }
+ Text item=Dishwasher_State label="Dishwasher [%s]" icon="dryer" {
+ Text item=Dishwasher_Program visibility=[Dishwasher_RawState>1]
+ Text itemDishwasher_Phase visibility=[Dishwasher_Phase!=UNDEF]
+ Text item=Dishwasher_ElapsedTime
+ Text item=Dishwasher_FinishTime
+ Text item=Dishwasher_PowerConsumption
+ Text item=Dishwasher_WaterConsumption
+ }
+ Text item=Fridge_CurrentTemperature label="Fridge" icon="climate" {
+ Text item=Fridge_CurrentTemperature
+ Text item=Fridge_TargetTemperature
+ Switch item=Fridge_SuperCool icon="snow"
+ }
+ }
+}
```
public static final String APPLIANCE_ID = "uid";
public static final String DEVICE_CLASS = "dc";
public static final String PROTOCOL_PROPERTY_NAME = "protocol";
+
+ // JSON-RPC property names
public static final String SERIAL_NUMBER_PROPERTY_NAME = "serialNumber";
public static final String EXTENDED_DEVICE_STATE_PROPERTY_NAME = "extendedDeviceState";
public static final String STATE_PROPERTY_NAME = "state";
+ public static final String PROGRAM_ID_PROPERTY_NAME = "programId";
+ public static final String PHASE_PROPERTY_NAME = "phase";
+ public static final String RAW_PHASE_PROPERTY_NAME = "rawPhase";
// Shared Channel ID's
+ public static final String STATE_TEXT_CHANNEL_ID = "state";
+ public static final String STATE_CHANNEL_ID = "rawState";
+ public static final String PROGRAM_TEXT_CHANNEL_ID = "program";
+ public static final String PROGRAM_CHANNEL_ID = "rawProgram";
+ public static final String PHASE_TEXT_CHANNEL_ID = "phase";
+ public static final String PHASE_CHANNEL_ID = "rawPhase";
public static final String SUPERCOOL_CHANNEL_ID = "supercool";
public static final String SUPERFREEZE_CHANNEL_ID = "superfreeze";
public static final String POWER_CONSUMPTION_CHANNEL_ID = "powerConsumption";
public static final int STATE_LOCKED = 145;
public static final int STATE_NOT_CONNECTED = 255;
+ // Miele missing string prefixes
+ public static final String MISSING_PROGRAM_TEXT_PREFIX = "program.";
+ public static final String MISSING_PHASE_TEXT_PREFIX = "phase.";
+
// Bridge config properties
public static final String HOST = "ipAddress";
public static final String INTERFACE = "interface";
boolean isExtendedState();
/**
- *
* Returns a State for the given string, taking into
* account the metadata provided. The meta data is sent by
* the Miele appliance and is used to decide the State type
* @param dmd - the device meta data
*/
State getState(String s, DeviceMetaData dmd);
+
+ /**
+ * Returns a raw State for the given string, not taking into
+ * account any metadata.
+ *
+ * @param s - the value to be used to instantiate the State
+ */
+ State getState(String s);
}
*/
package org.openhab.binding.miele.internal.handler;
+import static org.openhab.binding.miele.internal.MieleBindingConstants.*;
+
import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.Map;
import java.util.Map.Entry;
import org.openhab.binding.miele.internal.handler.MieleBridgeHandler.DeviceMetaData;
+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.StringType;
* The {@link ApplianceChannelSelector} for coffee machines
*
* @author Stephan Esch - Initial contribution
+ * @author Jacob Laursen - Added raw channels
*/
public enum CoffeeMachineChannelSelector implements ApplianceChannelSelector {
DEVICE_TYPE("mieleDeviceType", "deviceType", StringType.class, true),
BRAND_ID("brandId", "brandId", StringType.class, true),
COMPANY_ID("companyId", "companyId", StringType.class, true),
- STATE("state", "state", StringType.class, false),
- PROGRAMID("programId", "program", StringType.class, false),
+ STATE_TEXT(STATE_PROPERTY_NAME, STATE_TEXT_CHANNEL_ID, StringType.class, false),
+ STATE(null, STATE_CHANNEL_ID, DecimalType.class, false),
+ PROGRAM_TEXT(PROGRAM_ID_PROPERTY_NAME, PROGRAM_TEXT_CHANNEL_ID, StringType.class, false) {
+ @Override
+ public State getState(String s, DeviceMetaData dmd) {
+ State state = getTextState(s, dmd, programs, MISSING_PROGRAM_TEXT_PREFIX);
+ if (state != null) {
+ return state;
+ }
+ return super.getState(s, dmd);
+ }
+ },
+ PROGRAM(null, PROGRAM_CHANNEL_ID, DecimalType.class, false),
PROGRAMTYPE("programType", "type", StringType.class, false),
- PROGRAMPHASE("phase", "phase", StringType.class, false),
+ PROGRAM_PHASE_TEXT(PHASE_PROPERTY_NAME, PHASE_TEXT_CHANNEL_ID, StringType.class, false) {
+ @Override
+ public State getState(String s, DeviceMetaData dmd) {
+ State state = getTextState(s, dmd, phases, MISSING_PHASE_TEXT_PREFIX);
+ if (state != null) {
+ return state;
+ }
+ return super.getState(s, dmd);
+ }
+ },
+ PROGRAM_PHASE(RAW_PHASE_PROPERTY_NAME, PHASE_CHANNEL_ID, DecimalType.class, false),
// lightingStatus signalFailure signalInfo
DOOR("signalDoor", "door", OpenClosedType.class, false) {
@Override
private final Logger logger = LoggerFactory.getLogger(CoffeeMachineChannelSelector.class);
+ private final static Map<String, String> programs = Collections.<String, String> emptyMap();
+
+ private final static Map<String, String> phases = Collections.<String, String> emptyMap();
+
private final String mieleID;
private final String channelID;
private final Class<? extends Type> typeClass;
return null;
}
+ public State getTextState(String s, DeviceMetaData dmd, Map<String, String> valueMap, String prefix) {
+ if ("0".equals(s)) {
+ return UnDefType.UNDEF;
+ }
+
+ if (dmd == null || dmd.LocalizedValue == null || dmd.LocalizedValue.startsWith(prefix)) {
+ String text = valueMap.get(s);
+ if (text != null) {
+ return getState(text);
+ }
+ if (dmd == null || dmd.LocalizedValue == null) {
+ return getState(prefix + s);
+ }
+ }
+
+ return null;
+ }
+
public String getMieleEnum(String s, DeviceMetaData dmd) {
if (dmd.MieleEnum != null) {
for (Entry<String, JsonElement> enumEntry : dmd.MieleEnum.entrySet()) {
*/
package org.openhab.binding.miele.internal.handler;
-import static org.openhab.binding.miele.internal.MieleBindingConstants.EXTENDED_DEVICE_STATE_PROPERTY_NAME;
-import static org.openhab.binding.miele.internal.MieleBindingConstants.POWER_CONSUMPTION_CHANNEL_ID;
-import static org.openhab.binding.miele.internal.MieleBindingConstants.WATER_CONSUMPTION_CHANNEL_ID;
+import static java.util.Map.entry;
+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.Map.Entry;
import java.util.TimeZone;
import org.openhab.binding.miele.internal.handler.MieleBridgeHandler.DeviceMetaData;
import org.openhab.core.library.types.DateTimeType;
+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;
*
* @author Karel Goderis - Initial contribution
* @author Kai Kreuzer - Changed START_TIME to DateTimeType
- * @author Jacob Laursen - Added power/water consumption channels
+ * @author Jacob Laursen - Added power/water consumption channels, raw channels
*/
public enum DishwasherChannelSelector implements ApplianceChannelSelector {
DEVICE_TYPE("mieleDeviceType", "deviceType", StringType.class, true, false),
BRAND_ID("brandId", "brandId", StringType.class, true, false),
COMPANY_ID("companyId", "companyId", StringType.class, true, false),
- STATE("state", "state", StringType.class, false, false),
- PROGRAMID("programId", "program", StringType.class, false, false),
- PROGRAMPHASE("phase", "phase", StringType.class, false, false),
+ STATE_TEXT(STATE_PROPERTY_NAME, STATE_TEXT_CHANNEL_ID, StringType.class, false, false),
+ STATE(null, STATE_CHANNEL_ID, DecimalType.class, false, false),
+ PROGRAM_TEXT(PROGRAM_ID_PROPERTY_NAME, PROGRAM_TEXT_CHANNEL_ID, StringType.class, false, false) {
+ @Override
+ public State getState(String s, DeviceMetaData dmd) {
+ State state = getTextState(s, dmd, programs, MISSING_PROGRAM_TEXT_PREFIX);
+ if (state != null) {
+ return state;
+ }
+ return super.getState(s, dmd);
+ }
+ },
+ PROGRAM(null, PROGRAM_CHANNEL_ID, DecimalType.class, false, false),
+ PROGRAM_PHASE_TEXT(PHASE_PROPERTY_NAME, PHASE_TEXT_CHANNEL_ID, StringType.class, false, false) {
+ @Override
+ public State getState(String s, DeviceMetaData dmd) {
+ State state = getTextState(s, dmd, phases, MISSING_PHASE_TEXT_PREFIX);
+ if (state != null) {
+ return state;
+ }
+ return super.getState(s, dmd);
+ }
+ },
+ PROGRAM_PHASE(RAW_PHASE_PROPERTY_NAME, PHASE_CHANNEL_ID, DecimalType.class, false, false),
START_TIME("startTime", "start", DateTimeType.class, false, false) {
@Override
public State getState(String s, DeviceMetaData dmd) {
private final Logger logger = LoggerFactory.getLogger(DishwasherChannelSelector.class);
+ private final static Map<String, String> programs = Map.ofEntries(entry("26", "Pots & Pans"),
+ entry("27", "Clean Machine"), entry("28", "Economy"), entry("30", "Normal"), entry("32", "Sensor Wash"),
+ entry("34", "Energy Saver"), entry("35", "China & Crystal"), entry("36", "Extra Quiet"),
+ entry("37", "SaniWash"), entry("38", "QuickPowerWash"), entry("42", "Tall items"));
+
+ private final static Map<String, String> phases = Map.ofEntries(entry("2", "Pre-Wash"), entry("3", "Main Wash"),
+ entry("4", "Rinses"), entry("6", "Final rinse"), entry("7", "Drying"));
+
private final String mieleID;
private final String channelID;
private final Class<? extends Type> typeClass;
return null;
}
+ public State getTextState(String s, DeviceMetaData dmd, Map<String, String> valueMap, String prefix) {
+ if ("0".equals(s)) {
+ return UnDefType.UNDEF;
+ }
+
+ if (dmd == null || dmd.LocalizedValue == null || dmd.LocalizedValue.startsWith(prefix)) {
+ String text = valueMap.get(s);
+ if (text != null) {
+ return getState(text);
+ }
+ if (dmd == null || dmd.LocalizedValue == null) {
+ return getState(prefix + s);
+ }
+ }
+
+ return null;
+ }
+
public String getMieleEnum(String s, DeviceMetaData dmd) {
if (dmd.MieleEnum != null) {
for (Entry<String, JsonElement> enumEntry : dmd.MieleEnum.entrySet()) {
*/
package org.openhab.binding.miele.internal.handler;
-import static org.openhab.binding.miele.internal.MieleBindingConstants.SUPERCOOL_CHANNEL_ID;
+import static org.openhab.binding.miele.internal.MieleBindingConstants.*;
import java.lang.reflect.Method;
import java.util.Map.Entry;
import org.openhab.binding.miele.internal.ExtendedDeviceStateUtil;
import org.openhab.binding.miele.internal.handler.MieleBridgeHandler.DeviceMetaData;
+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;
* The {@link ApplianceChannelSelector} for fridges
*
* @author Karel Goderis - Initial contribution
+ * @author Jacob Laursen - Added UoM for temperatures, raw channels
*/
public enum FridgeChannelSelector implements ApplianceChannelSelector {
DEVICE_TYPE("mieleDeviceType", "deviceType", StringType.class, true),
BRAND_ID("brandId", "brandId", StringType.class, true),
COMPANY_ID("companyId", "companyId", StringType.class, true),
- STATE("state", "state", StringType.class, false),
+ STATE_TEXT(STATE_PROPERTY_NAME, STATE_TEXT_CHANNEL_ID, StringType.class, false),
+ STATE(null, STATE_CHANNEL_ID, DecimalType.class, false),
SUPERCOOL(null, SUPERCOOL_CHANNEL_ID, OnOffType.class, false),
FRIDGECURRENTTEMP("currentTemperature", "current", QuantityType.class, false) {
@Override
*/
package org.openhab.binding.miele.internal.handler;
-import static org.openhab.binding.miele.internal.MieleBindingConstants.SUPERCOOL_CHANNEL_ID;
-import static org.openhab.binding.miele.internal.MieleBindingConstants.SUPERFREEZE_CHANNEL_ID;
+import static org.openhab.binding.miele.internal.MieleBindingConstants.*;
import java.lang.reflect.Method;
import java.util.Map.Entry;
import org.openhab.binding.miele.internal.ExtendedDeviceStateUtil;
import org.openhab.binding.miele.internal.handler.MieleBridgeHandler.DeviceMetaData;
+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;
* a freezer compartment
*
* @author Karel Goderis - Initial contribution
+ * @author Jacob Laursen - Added UoM for temperatures, raw channels
*/
public enum FridgeFreezerChannelSelector implements ApplianceChannelSelector {
DEVICE_TYPE("mieleDeviceType", "deviceType", StringType.class, true),
BRAND_ID("brandId", "brandId", StringType.class, true),
COMPANY_ID("companyId", "companyId", StringType.class, true),
- STATE("state", "state", StringType.class, false),
+ STATE_TEXT(STATE_PROPERTY_NAME, STATE_TEXT_CHANNEL_ID, StringType.class, false),
+ STATE(null, STATE_CHANNEL_ID, DecimalType.class, false),
FREEZERSTATE("freezerState", "freezerstate", StringType.class, false),
FRIDGESTATE("fridgeState", "fridgestate", StringType.class, false),
SUPERCOOL(null, SUPERCOOL_CHANNEL_ID, OnOffType.class, false),
*/
package org.openhab.binding.miele.internal.handler;
+import static org.openhab.binding.miele.internal.MieleBindingConstants.*;
+
import java.lang.reflect.Method;
import java.util.Map.Entry;
* The {@link ApplianceChannelSelector} for hobs
*
* @author Karel Goderis - Initial contribution
+ * @author Jacob Laursen - Added raw channels
*/
public enum HobChannelSelector implements ApplianceChannelSelector {
DEVICE_TYPE("mieleDeviceType", "deviceType", StringType.class, true),
BRAND_ID("brandId", "brandId", StringType.class, true),
COMPANY_ID("companyId", "companyId", StringType.class, true),
- STATE("state", "state", StringType.class, false),
+ STATE_TEXT(STATE_PROPERTY_NAME, STATE_TEXT_CHANNEL_ID, StringType.class, false),
+ STATE(null, STATE_CHANNEL_ID, DecimalType.class, false),
PLATES("plateNumbers", "plates", DecimalType.class, true),
PLATE1_POWER("plate1PowerStep", "plate1power", DecimalType.class, false),
PLATE1_HEAT("plate1RemainingHeat", "plate1heat", DecimalType.class, false) {
*/
package org.openhab.binding.miele.internal.handler;
+import static org.openhab.binding.miele.internal.MieleBindingConstants.*;
+
import java.lang.reflect.Method;
import java.util.Map.Entry;
* The {@link ApplianceChannelSelector} for ventilation hoods
*
* @author Karel Goderis - Initial contribution
+ * @author Jacob Laursen - Added raw channels
*/
public enum HoodChannelSelector implements ApplianceChannelSelector {
DEVICE_TYPE("mieleDeviceType", "deviceType", StringType.class, true),
BRAND_ID("brandId", "brandId", StringType.class, true),
COMPANY_ID("companyId", "companyId", StringType.class, true),
- STATE("state", "state", StringType.class, false),
+ STATE_TEXT(STATE_PROPERTY_NAME, STATE_TEXT_CHANNEL_ID, StringType.class, false),
+ STATE(null, STATE_CHANNEL_ID, DecimalType.class, false),
VENTILATION("ventilationPower", "ventilation", DecimalType.class, false),
LIGHT("lightingStatus", "light", OnOffType.class, false) {
@Override
ChannelUID theChannelUID = new ChannelUID(getThing().getUID(), selector.getChannelID());
if (dp.Value != null) {
- logger.trace("Update state of {} with getState '{}'", theChannelUID,
- selector.getState(dpValue, dmd));
- updateState(theChannelUID, selector.getState(dpValue, dmd));
+ State state = selector.getState(dpValue, dmd);
+ logger.trace("Update state of {} with getState '{}'", theChannelUID, state);
+ updateState(theChannelUID, state);
+ updateRawChannel(dp.Name, dpValue);
} else {
updateState(theChannelUID, UnDefType.UNDEF);
}
updateState(channelUid, state);
}
+ /**
+ * Update raw value channels for properties already mapped to text channels.
+ * Currently ApplianceChannelSelector only supports 1:1 mapping from property
+ * to channel.
+ */
+ private void updateRawChannel(String propertyName, String value) {
+ String channelId;
+ switch (propertyName) {
+ case STATE_PROPERTY_NAME:
+ channelId = STATE_CHANNEL_ID;
+ break;
+ case PROGRAM_ID_PROPERTY_NAME:
+ channelId = PROGRAM_CHANNEL_ID;
+ break;
+ default:
+ return;
+ }
+ ApplianceChannelSelector selector = null;
+ try {
+ selector = getValueSelectorFromChannelID(channelId);
+ } catch (IllegalArgumentException e) {
+ logger.trace("{} is not a valid channel for a {}", channelId, modelID);
+ return;
+ }
+ ChannelUID channelUid = new ChannelUID(getThing().getUID(), channelId);
+ State state = selector.getState(value);
+ logger.trace("Update state of {} with getState '{}'", channelUid, state);
+ updateState(channelUid, state);
+ }
+
@Override
public void onApplianceRemoved(HomeDevice appliance) {
if (applianceId == null) {
*/
package org.openhab.binding.miele.internal.handler;
+import static java.util.Map.entry;
+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.Map.Entry;
import java.util.TimeZone;
import org.openhab.binding.miele.internal.ExtendedDeviceStateUtil;
import org.openhab.binding.miele.internal.handler.MieleBridgeHandler.DeviceMetaData;
import org.openhab.core.library.types.DateTimeType;
+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;
*
* @author Karel Goderis - Initial contribution
* @author Kai Kreuzer - Changed START_TIME to DateTimeType
+ * @author Jacob Laursen - Added UoM for temperatures, raw channels
*/
public enum OvenChannelSelector implements ApplianceChannelSelector {
DEVICE_TYPE("mieleDeviceType", "deviceType", StringType.class, true),
BRAND_ID("brandId", "brandId", StringType.class, true),
COMPANY_ID("companyId", "companyId", StringType.class, true),
- STATE("state", "state", StringType.class, false),
- PROGRAMID("programId", "program", StringType.class, false),
+ STATE_TEXT(STATE_PROPERTY_NAME, STATE_TEXT_CHANNEL_ID, StringType.class, false),
+ STATE(null, STATE_CHANNEL_ID, DecimalType.class, false),
+ PROGRAM_TEXT(PROGRAM_ID_PROPERTY_NAME, PROGRAM_TEXT_CHANNEL_ID, StringType.class, false),
+ PROGRAM(null, PROGRAM_CHANNEL_ID, DecimalType.class, false),
PROGRAMTYPE("programType", "type", StringType.class, false),
- PROGRAMPHASE("phase", "phase", StringType.class, false),
+ PROGRAM_PHASE_TEXT(PHASE_PROPERTY_NAME, PHASE_TEXT_CHANNEL_ID, StringType.class, false) {
+ @Override
+ public State getState(String s, DeviceMetaData dmd) {
+ State state = getTextState(s, dmd, phases, MISSING_PHASE_TEXT_PREFIX);
+ if (state != null) {
+ return state;
+ }
+ return super.getState(s, dmd);
+ }
+ },
+ PROGRAM_PHASE(RAW_PHASE_PROPERTY_NAME, PHASE_CHANNEL_ID, DecimalType.class, false),
START_TIME("startTime", "start", DateTimeType.class, false) {
@Override
public State getState(String s, DeviceMetaData dmd) {
private final Logger logger = LoggerFactory.getLogger(OvenChannelSelector.class);
+ private final static Map<String, String> phases = Map.ofEntries(entry("1", "Heating"), entry("2", "Temp. hold"),
+ entry("3", "Door Open"), entry("4", "Pyrolysis"), entry("7", "Lighting"), entry("8", "Searing phase"),
+ entry("10", "Defrost"), entry("11", "Cooling down"), entry("12", "Energy save phase"));
+
private final String mieleID;
private final String channelID;
private final Class<? extends Type> typeClass;
}
}
+ public State getTextState(String s, DeviceMetaData dmd, Map<String, String> valueMap, String prefix) {
+ if ("0".equals(s)) {
+ return UnDefType.UNDEF;
+ }
+
+ if (dmd == null || dmd.LocalizedValue == null || dmd.LocalizedValue.startsWith(prefix)) {
+ String text = valueMap.get(s);
+ if (text != null) {
+ return getState(text);
+ }
+ if (dmd == null || dmd.LocalizedValue == null) {
+ return getState(prefix + s);
+ }
+ }
+
+ return null;
+ }
+
public String getMieleEnum(String s, DeviceMetaData dmd) {
if (dmd.MieleEnum != null) {
for (Entry<String, JsonElement> enumEntry : dmd.MieleEnum.entrySet()) {
*/
package org.openhab.binding.miele.internal.handler;
+import static java.util.Map.entry;
+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.Map.Entry;
import java.util.TimeZone;
*
* @author Karel Goderis - Initial contribution
* @author Kai Kreuzer - Changed START_TIME to DateTimeType
+ * @author Jacob Laursen - Added raw channels
*/
public enum TumbleDryerChannelSelector implements ApplianceChannelSelector {
DEVICE_TYPE("mieleDeviceType", "deviceType", StringType.class, true),
BRAND_ID("brandId", "brandId", StringType.class, true),
COMPANY_ID("companyId", "companyId", StringType.class, true),
- STATE("state", "state", StringType.class, false),
- PROGRAMID("programId", "program", StringType.class, false),
+ STATE_TEXT(STATE_PROPERTY_NAME, STATE_TEXT_CHANNEL_ID, StringType.class, false),
+ STATE(null, STATE_CHANNEL_ID, DecimalType.class, false),
+ PROGRAM_TEXT(PROGRAM_ID_PROPERTY_NAME, PROGRAM_TEXT_CHANNEL_ID, StringType.class, false) {
+ @Override
+ public State getState(String s, DeviceMetaData dmd) {
+ State state = getTextState(s, dmd, programs, MISSING_PROGRAM_TEXT_PREFIX);
+ if (state != null) {
+ return state;
+ }
+ return super.getState(s, dmd);
+ }
+ },
+ PROGRAM(null, PROGRAM_CHANNEL_ID, DecimalType.class, false),
PROGRAMTYPE("programType", "type", StringType.class, false),
- PROGRAMPHASE("phase", "phase", StringType.class, false),
+ PROGRAM_PHASE_TEXT(PHASE_PROPERTY_NAME, PHASE_TEXT_CHANNEL_ID, StringType.class, false) {
+ @Override
+ public State getState(String s, DeviceMetaData dmd) {
+ State state = getTextState(s, dmd, phases, MISSING_PHASE_TEXT_PREFIX);
+ if (state != null) {
+ return state;
+ }
+ return super.getState(s, dmd);
+ }
+ },
+ PROGRAM_PHASE(RAW_PHASE_PROPERTY_NAME, PHASE_CHANNEL_ID, DecimalType.class, false),
START_TIME("startTime", "start", DateTimeType.class, false) {
@Override
public State getState(String s, DeviceMetaData dmd) {
private final Logger logger = LoggerFactory.getLogger(TumbleDryerChannelSelector.class);
+ private final static Map<String, String> programs = Map.ofEntries(entry("10", "Automatic Plus"),
+ entry("23", "Cottons hygiene"), entry("30", "Minimum iron"), entry("31", "Gentle minimum iron"),
+ entry("40", "Woollens handcare"), entry("50", "Delicates"), entry("60", "Warm Air"),
+ entry("70", "Cool air"), entry("80", "Express"), entry("90", "Cottons"), entry("100", "Gentle smoothing"),
+ entry("120", "Proofing"), entry("130", "Denim"), entry("131", "Gentle denim"), entry("140", "Shirts"),
+ entry("141", "Gentle shirts"), entry("150", "Sportswear"), entry("160", "Outerwear"),
+ entry("170", "Silks handcare"), entry("190", "Standard pillows"), entry("220", "Basket programme"),
+ entry("240", "Smoothing"), entry("65000", "Cottons, auto load control"),
+ entry("65001", "Minimum iron, auto load control"));
+
+ private final static Map<String, String> phases = Map.ofEntries(entry("1", "Programme running"),
+ entry("2", "Drying"), entry("3", "Drying Machine iron"), entry("4", "Drying Hand iron"),
+ entry("5", "Drying Normal"), entry("6", "Drying Normal+"), entry("7", "Cooling down"),
+ entry("8", "Drying Hand iron"), entry("10", "Finished"));
+
private final String mieleID;
private final String channelID;
private final Class<? extends Type> typeClass;
return null;
}
+ public State getTextState(String s, DeviceMetaData dmd, Map<String, String> valueMap, String prefix) {
+ if ("0".equals(s)) {
+ return UnDefType.UNDEF;
+ }
+
+ if (dmd == null || dmd.LocalizedValue == null || dmd.LocalizedValue.startsWith(prefix)) {
+ String text = valueMap.get(s);
+ if (text != null) {
+ return getState(text);
+ }
+ if (dmd == null || dmd.LocalizedValue == null) {
+ return getState(prefix + s);
+ }
+ }
+
+ return null;
+ }
+
public String getMieleEnum(String s, DeviceMetaData dmd) {
if (dmd.MieleEnum != null) {
for (Entry<String, JsonElement> enumEntry : dmd.MieleEnum.entrySet()) {
*/
package org.openhab.binding.miele.internal.handler;
-import static org.openhab.binding.miele.internal.MieleBindingConstants.EXTENDED_DEVICE_STATE_PROPERTY_NAME;
-import static org.openhab.binding.miele.internal.MieleBindingConstants.POWER_CONSUMPTION_CHANNEL_ID;
-import static org.openhab.binding.miele.internal.MieleBindingConstants.WATER_CONSUMPTION_CHANNEL_ID;
+import static java.util.Map.entry;
+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.Map.Entry;
import java.util.TimeZone;
import org.openhab.binding.miele.internal.ExtendedDeviceStateUtil;
import org.openhab.binding.miele.internal.handler.MieleBridgeHandler.DeviceMetaData;
import org.openhab.core.library.types.DateTimeType;
+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;
*
* @author Karel Goderis - Initial contribution
* @author Kai Kreuzer - Changed START_TIME to DateTimeType
- * @author Jacob Laursen - Added power/water consumption channels
+ * @author Jacob Laursen - Added power/water consumption channels, UoM for temperatures, raw channels
*/
public enum WashingMachineChannelSelector implements ApplianceChannelSelector {
DEVICE_TYPE("mieleDeviceType", "deviceType", StringType.class, true, false),
BRAND_ID("brandId", "brandId", StringType.class, true, false),
COMPANY_ID("companyId", "companyId", StringType.class, true, false),
- STATE("state", "state", StringType.class, false, false),
- PROGRAMID("programId", "program", StringType.class, false, false),
+ STATE_TEXT(STATE_PROPERTY_NAME, STATE_TEXT_CHANNEL_ID, StringType.class, false, false),
+ STATE(null, STATE_CHANNEL_ID, DecimalType.class, false, false),
+ PROGRAM_TEXT(PROGRAM_ID_PROPERTY_NAME, PROGRAM_TEXT_CHANNEL_ID, StringType.class, false, false) {
+ @Override
+ public State getState(String s, DeviceMetaData dmd) {
+ State state = getTextState(s, dmd, programs, MISSING_PROGRAM_TEXT_PREFIX);
+ if (state != null) {
+ return state;
+ }
+ return super.getState(s, dmd);
+ }
+ },
+ PROGRAM(null, PROGRAM_CHANNEL_ID, DecimalType.class, false, false),
PROGRAMTYPE("programType", "type", StringType.class, false, false),
- PROGRAMPHASE("phase", "phase", StringType.class, false, false),
+ PROGRAM_PHASE_TEXT(PHASE_PROPERTY_NAME, PHASE_TEXT_CHANNEL_ID, StringType.class, false, false) {
+ @Override
+ public State getState(String s, DeviceMetaData dmd) {
+ State state = getTextState(s, dmd, phases, MISSING_PHASE_TEXT_PREFIX);
+ if (state != null) {
+ return state;
+ }
+ return super.getState(s, dmd);
+ }
+ },
+ PROGRAM_PHASE(RAW_PHASE_PROPERTY_NAME, PHASE_CHANNEL_ID, DecimalType.class, false, false),
START_TIME("startTime", "start", DateTimeType.class, false, false) {
@Override
public State getState(String s, DeviceMetaData dmd) {
private final Logger logger = LoggerFactory.getLogger(WashingMachineChannelSelector.class);
+ private final static Map<String, String> programs = Map.ofEntries(entry("1", "Cottons"), entry("3", "Minimum iron"),
+ entry("4", "Delicates"), entry("8", "Woollens"), entry("9", "Silks"), entry("17", "Starch"),
+ entry("18", "Rinse"), entry("21", "Drain/Spin"), entry("22", "Curtains"), entry("23", "Shirts"),
+ entry("24", "Denim"), entry("27", "Proofing"), entry("29", "Sportswear"), entry("31", "Automatic Plus"),
+ entry("37", "Outerwear"), entry("39", "Pillows"), entry("50", "Dark Garments"), entry("53", "First wash"),
+ entry("75", "Steam care"), entry("76", "Freshen up"), entry("91", "Maintenance wash"),
+ entry("95", "Down duvets"), entry("122", "Express 20"), entry("129", "Down filled items"),
+ entry("133", "Cottons Eco"), entry("146", "QuickPowerWash"), entry("65532", "Mix"));
+
+ private final static Map<String, String> phases = Map.ofEntries(entry("1", "Pre-wash"), entry("4", "Washing"),
+ entry("5", "Rinses"), entry("7", "Clean"), entry("9", "Drain"), entry("10", "Spin"),
+ entry("11", "Anti-crease"), entry("12", "Finished"));
+
private final String mieleID;
private final String channelID;
private final Class<? extends Type> typeClass;
}
}
+ public State getTextState(String s, DeviceMetaData dmd, Map<String, String> valueMap, String prefix) {
+ if ("0".equals(s)) {
+ return UnDefType.UNDEF;
+ }
+
+ if (dmd == null || dmd.LocalizedValue == null || dmd.LocalizedValue.startsWith(prefix)) {
+ String text = valueMap.get(s);
+ if (text != null) {
+ return getState(text);
+ }
+ if (dmd == null || dmd.LocalizedValue == null) {
+ return getState(prefix + s);
+ }
+ }
+
+ return null;
+ }
+
public String getMieleEnum(String s, DeviceMetaData dmd) {
if (dmd.MieleEnum != null) {
for (Entry<String, JsonElement> enumEntry : dmd.MieleEnum.entrySet()) {
<channel-type id="state">
<item-type>String</item-type>
- <label>Status</label>
+ <label>State</label>
<description>Current status of the appliance</description>
<state readOnly="true"></state>
</channel-type>
+ <channel-type id="rawState" advanced="true">
+ <item-type>Number</item-type>
+ <label>Raw State</label>
+ <description>Current status of the appliance as raw number</description>
+ <state readOnly="true"></state>
+ </channel-type>
+
<channel-type id="program">
<item-type>String</item-type>
<label>Program</label>
<state readOnly="true"></state>
</channel-type>
+ <channel-type id="rawProgram" advanced="true">
+ <item-type>Number</item-type>
+ <label>Raw Program</label>
+ <description>Current program or function running on the appliance as raw number</description>
+ <state readOnly="true"></state>
+ </channel-type>
+
<channel-type id="type" advanced="true">
<item-type>String</item-type>
<label>Program Type</label>
<state readOnly="true"></state>
</channel-type>
+ <channel-type id="rawPhase" advanced="true">
+ <item-type>Number</item-type>
+ <label>Raw Phase</label>
+ <description>Current phase of the program running on the appliance as raw number</description>
+ <state readOnly="true"></state>
+ </channel-type>
+
<channel-type id="start" advanced="true">
<item-type>DateTime</item-type>
<label>Start Time</label>
<channel-type id="supercool">
<item-type>Switch</item-type>
<label>Super Cool</label>
- <description>Start Super Cooling</description>
+ <description>Start or stop Super Cooling</description>
<state readOnly="false"></state>
</channel-type>
<channels>
<channel id="state" typeId="state"/>
+ <channel id="rawState" typeId="rawState"/>
<channel id="program" typeId="program"/>
+ <channel id="rawProgram" typeId="rawProgram"/>
<channel id="type" typeId="type"/>
<channel id="phase" typeId="phase"/>
+ <channel id="rawPhase" typeId="rawPhase"/>
<channel id="door" typeId="door"/>
<channel id="switch" typeId="switch"/>
</channels>
<channels>
<channel id="state" typeId="state"/>
+ <channel id="rawState" typeId="rawState"/>
<channel id="program" typeId="program"/>
+ <channel id="rawProgram" typeId="rawProgram"/>
<channel id="phase" typeId="phase"/>
+ <channel id="rawPhase" typeId="rawPhase"/>
<channel id="start" typeId="start"/>
<channel id="duration" typeId="duration"/>
<channel id="elapsed" typeId="elapsed"/>
<channels>
<channel id="state" typeId="state"/>
+ <channel id="rawState" typeId="rawState"/>
<channel id="supercool" typeId="supercool"/>
<channel id="current" typeId="currentTemperature">
<description>Current temperature in the fridge</description>
<channels>
<channel id="state" typeId="state"/>
+ <channel id="rawState" typeId="rawState"/>
<channel id="freezerstate" typeId="freezerstate"/>
<channel id="fridgestate" typeId="fridgestate"/>
<channel id="supercool" typeId="supercool"/>
<channels>
<channel id="state" typeId="state"/>
+ <channel id="rawState" typeId="rawState"/>
<channel id="plate1power" typeId="power"/>
<channel id="plate1heat" typeId="heat"/>
<channel id="plate1time" typeId="time"/>
<channels>
<channel id="state" typeId="state"/>
+ <channel id="rawState" typeId="rawState"/>
<channel id="light" typeId="switch"/>
<channel id="ventilation" typeId="ventilation"/>
<channel id="stop" typeId="stop"/>
<channels>
<channel id="state" typeId="state"/>
+ <channel id="rawState" typeId="rawState"/>
<channel id="program" typeId="program"/>
+ <channel id="rawProgram" typeId="rawProgram"/>
<channel id="type" typeId="type"/>
<channel id="phase" typeId="phase"/>
+ <channel id="rawPhase" typeId="rawPhase"/>
<channel id="start" typeId="start"/>
<channel id="duration" typeId="duration"/>
<channel id="elapsed" typeId="elapsed"/>
<channels>
<channel id="state" typeId="state"/>
+ <channel id="rawState" typeId="rawState"/>
<channel id="program" typeId="program"/>
+ <channel id="rawProgram" typeId="rawProgram"/>
<channel id="type" typeId="type"/>
<channel id="phase" typeId="phase"/>
+ <channel id="rawPhase" typeId="rawPhase"/>
<channel id="start" typeId="start"/>
<channel id="duration" typeId="duration"/>
<channel id="elapsed" typeId="elapsed"/>
<channels>
<channel id="state" typeId="state"/>
+ <channel id="rawState" typeId="rawState"/>
<channel id="program" typeId="program"/>
+ <channel id="rawProgram" typeId="rawProgram"/>
<channel id="type" typeId="type"/>
<channel id="phase" typeId="phase"/>
+ <channel id="rawPhase" typeId="rawPhase"/>
<channel id="start" typeId="start"/>
<channel id="duration" typeId="duration"/>
<channel id="elapsed" typeId="elapsed"/>