[miele] Rename channel powerConsumption to energyConsumption and set display unit to litres for waterConsumption (#15774)

* Rename channel powerConsumption to energyConsumption and set display unit to litres for waterConsumption

---------

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
Jacob Laursen 2023-10-18 12:30:18 +02:00 committed by GitHub
parent d564eb7bee
commit b92f1a241a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 104 additions and 70 deletions

View File

@ -116,23 +116,23 @@ Channels available for each appliance type are listed below.
#### 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 |
| end | DateTime | Read | End time of the program (programmed or running) |
| 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:Energy | 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 |
| 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 |
| end | DateTime | Read | End time of the program (programmed or running) |
| 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 |
| energyConsumption | Number:Energy | Read | Energy consumption by the currently running program on the appliance |
| waterConsumption | Number:Volume | Read | Water consumption by the currently running program on the appliance |
##### Programs
@ -336,26 +336,26 @@ See oven.
#### 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 |
| end | DateTime | Read | End time of the program (programmed or running) |
| 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) |
| spinningspeed | String | Read | Spinning speed in the program running on the appliance |
| powerConsumption | Number:Energy | 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 |
| 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 |
| end | DateTime | Read | End time of the program (programmed or running) |
| 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) |
| spinningspeed | String | Read | Spinning speed in the program running on the appliance |
| energyConsumption | Number:Energy | Read | Energy consumption by the currently running program on the appliance |
| waterConsumption | Number:Volume | Read | Water consumption by the currently running program on the appliance |
##### Programs
@ -432,7 +432,7 @@ String Dishwasher_Program "Program [%s]" {channel="miele:di
String Dishwasher_Phase "Phase [%s]" {channel="miele:dishwasher:home:dishwasher:phase"}
Number:Time Dishwasher_ElapsedTime "Elapsed time" <time> {channel="miele:dishwasher:home:dishwasher:elapsed"}
Number:Time Dishwasher_FinishTime "Remaining time" <time> {channel="miele:dishwasher:home:dishwasher:finish"}
Number:Energy Dishwasher_PowerConsumption {channel="miele:dishwasher:home:dishwasher:powerConsumption"}
Number:Energy Dishwasher_EnergyConsumption {channel="miele:dishwasher:home:dishwasher:energyConsumption"}
Number:Volume Dishwasher_WaterConsumption {channel="miele:dishwasher:home:dishwasher:waterConsumption"}
String Fridge_State {channel="miele:fridge:home:fridge:state"}
@ -460,7 +460,7 @@ Number:Temperature WashingMachine_Temperature <temperature> {channel="miele:wa
String WashingMachine_SpinningSpeed {channel="miele:washingmachine:home:washingmachine:spinningspeed"}
Number:Time WashingMachine_ElapsedTime "Elapsed time" <time> {channel="miele:washingmachine:home:washingmachine:elapsed"}
Number:Time WashingMachine_FinishTime "Remaining time" <time> {channel="miele:washingmachine:home:washingmachine:finish"}
Number:Energy WashingMachine_PowerConsumption {channel="miele:washingmachine:home:washingmachine:powerConsumption"}
Number:Energy WashingMachine_EnergyConsumption {channel="miele:washingmachine:home:washingmachine:energyConsumption"}
Number:Volume WashingMachine_WaterConsumption {channel="miele:washingmachine:home:washingmachine:waterConsumption"}
String TumbleDryer_State {channel="miele:tumbledryer:home:tumbledryer:state"}
@ -490,7 +490,7 @@ sitemap miele label="Miele" {
Text item=WashingMachine_Phase visibility=[WashingMachine_Phase!=UNDEF]
Text item=WashingMachine_ElapsedTime
Text item=WashingMachine_FinishTime
Text item=WashingMachine_PowerConsumption
Text item=WashingMachine_EnergyConsumption
Text item=WashingMachine_WaterConsumption
}
Text item=TumbleDryer_State label="Tumble Dryer [%s]" icon="dryer" {
@ -504,7 +504,7 @@ sitemap miele label="Miele" {
Text itemDishwasher_Phase visibility=[Dishwasher_Phase!=UNDEF]
Text item=Dishwasher_ElapsedTime
Text item=Dishwasher_FinishTime
Text item=Dishwasher_PowerConsumption
Text item=Dishwasher_EnergyConsumption
Text item=Dishwasher_WaterConsumption
}
Text item=Fridge_CurrentTemperature label="Fridge" icon="climate" {

View File

@ -58,7 +58,7 @@ public class MieleBindingConstants {
public static final String START_CHANNEL_ID = "start";
public static final String END_CHANNEL_ID = "end";
public static final String FINISH_CHANNEL_ID = "finish";
public static final String POWER_CONSUMPTION_CHANNEL_ID = "powerConsumption";
public static final String ENERGY_CONSUMPTION_CHANNEL_ID = "energyConsumption";
public static final String WATER_CONSUMPTION_CHANNEL_ID = "waterConsumption";
// List of all Thing Type UIDs

View File

@ -109,7 +109,7 @@ public enum DishwasherChannelSelector implements ApplianceChannelSelector {
}
},
SWITCH("", "switch", OnOffType.class, false, false),
POWER_CONSUMPTION(EXTENDED_DEVICE_STATE_PROPERTY_NAME, POWER_CONSUMPTION_CHANNEL_ID, QuantityType.class, false,
ENERGY_CONSUMPTION(EXTENDED_DEVICE_STATE_PROPERTY_NAME, ENERGY_CONSUMPTION_CHANNEL_ID, QuantityType.class, false,
true),
WATER_CONSUMPTION(EXTENDED_DEVICE_STATE_PROPERTY_NAME, WATER_CONSUMPTION_CHANNEL_ID, QuantityType.class, false,
true);

View File

@ -12,9 +12,7 @@
*/
package org.openhab.binding.miele.internal.handler;
import static org.openhab.binding.miele.internal.MieleBindingConstants.MIELE_DEVICE_CLASS_DISHWASHER;
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 org.openhab.binding.miele.internal.MieleBindingConstants.*;
import java.math.BigDecimal;
@ -49,7 +47,7 @@ import com.google.gson.JsonElement;
public class DishwasherHandler extends MieleApplianceHandler<DishwasherChannelSelector>
implements ExtendedDeviceStateListener {
private static final int POWER_CONSUMPTION_BYTE_POSITION = 16;
private static final int ENERGY_CONSUMPTION_BYTE_POSITION = 16;
private static final int WATER_CONSUMPTION_BYTE_POSITION = 18;
private static final int EXTENDED_STATE_MIN_SIZE_BYTES = 19;
@ -130,9 +128,9 @@ public class DishwasherHandler extends MieleApplianceHandler<DishwasherChannelSe
}
BigDecimal kiloWattHoursTenths = BigDecimal
.valueOf(extendedDeviceState[POWER_CONSUMPTION_BYTE_POSITION] & 0xff);
.valueOf(extendedDeviceState[ENERGY_CONSUMPTION_BYTE_POSITION] & 0xff);
var kiloWattHours = new QuantityType<>(kiloWattHoursTenths.divide(BigDecimal.valueOf(10)), Units.KILOWATT_HOUR);
updateExtendedState(POWER_CONSUMPTION_CHANNEL_ID, kiloWattHours);
updateExtendedState(ENERGY_CONSUMPTION_CHANNEL_ID, kiloWattHours);
BigDecimal decilitres = BigDecimal.valueOf(extendedDeviceState[WATER_CONSUMPTION_BYTE_POSITION] & 0xff);
var litres = new QuantityType<>(decilitres.divide(BigDecimal.valueOf(10)), Units.LITRE);

View File

@ -543,7 +543,7 @@ public class MieleBridgeHandler extends BaseBridgeHandler {
if (cause == null) {
logger.debug("An exception occurred while getting the home devices: '{}'", e.getMessage());
} else {
logger.debug("An exception occurred while getting the home devices: '{}' -> '{}", e.getMessage(),
logger.debug("An exception occurred while getting the home devices: '{}' -> '{}'", e.getMessage(),
cause.getMessage());
}
}

View File

@ -128,7 +128,7 @@ public enum WashingMachineChannelSelector implements ApplianceChannelSelector {
}
},
SWITCH("", "switch", OnOffType.class, false, false),
POWER_CONSUMPTION(EXTENDED_DEVICE_STATE_PROPERTY_NAME, POWER_CONSUMPTION_CHANNEL_ID, QuantityType.class, false,
ENERGY_CONSUMPTION(EXTENDED_DEVICE_STATE_PROPERTY_NAME, ENERGY_CONSUMPTION_CHANNEL_ID, QuantityType.class, false,
true),
WATER_CONSUMPTION(EXTENDED_DEVICE_STATE_PROPERTY_NAME, WATER_CONSUMPTION_CHANNEL_ID, QuantityType.class, false,
true);

View File

@ -12,9 +12,7 @@
*/
package org.openhab.binding.miele.internal.handler;
import static org.openhab.binding.miele.internal.MieleBindingConstants.MIELE_DEVICE_CLASS_WASHING_MACHINE;
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 org.openhab.binding.miele.internal.MieleBindingConstants.*;
import java.math.BigDecimal;
@ -49,7 +47,7 @@ import com.google.gson.JsonElement;
public class WashingMachineHandler extends MieleApplianceHandler<WashingMachineChannelSelector>
implements ExtendedDeviceStateListener {
private static final int POWER_CONSUMPTION_BYTE_POSITION = 51;
private static final int ENERGY_CONSUMPTION_BYTE_POSITION = 51;
private static final int WATER_CONSUMPTION_BYTE_POSITION = 53;
private static final int EXTENDED_STATE_MIN_SIZE_BYTES = 54;
@ -131,9 +129,9 @@ public class WashingMachineHandler extends MieleApplianceHandler<WashingMachineC
}
BigDecimal kiloWattHoursTenths = BigDecimal
.valueOf(extendedDeviceState[POWER_CONSUMPTION_BYTE_POSITION] & 0xff);
.valueOf(extendedDeviceState[ENERGY_CONSUMPTION_BYTE_POSITION] & 0xff);
var kiloWattHours = new QuantityType<>(kiloWattHoursTenths.divide(BigDecimal.valueOf(10)), Units.KILOWATT_HOUR);
updateExtendedState(POWER_CONSUMPTION_CHANNEL_ID, kiloWattHours);
updateExtendedState(ENERGY_CONSUMPTION_CHANNEL_ID, kiloWattHours);
var litres = new QuantityType<>(BigDecimal.valueOf(extendedDeviceState[WATER_CONSUMPTION_BYTE_POSITION] & 0xff),
Units.LITRE);

View File

@ -70,6 +70,8 @@ channel-type.miele.elapsed.description = Time elapsed in the program running on
channel-type.miele.elapsed.state.pattern = %1$tR
channel-type.miele.end.label = End Time
channel-type.miele.end.description = End time of the program (programmed or running)
channel-type.miele.energy-consumption.label = Energy Consumption
channel-type.miele.energy-consumption.description = Energy consumption by the currently running program on the appliance
channel-type.miele.finish.label = Finish Time
channel-type.miele.finish.description = Time to finish the program running on the appliance
channel-type.miele.finish.state.pattern = %1$tR
@ -85,8 +87,6 @@ channel-type.miele.plates.label = Plates
channel-type.miele.plates.description = Number of heating zones/plates on the hob
channel-type.miele.power.label = Power Step
channel-type.miele.power.description = Power level of the heating zone/plate
channel-type.miele.powerConsumption.label = Power Consumption
channel-type.miele.powerConsumption.description = Power consumption by the currently running program on the appliance
channel-type.miele.program.label = Program
channel-type.miele.program.description = Current program or function running on the appliance
channel-type.miele.rawPhase.label = Raw Phase
@ -121,8 +121,8 @@ channel-type.miele.type.label = Program Type
channel-type.miele.type.description = Type of the program running on the appliance
channel-type.miele.ventilation.label = Ventilation Power
channel-type.miele.ventilation.description = Current ventilation power
channel-type.miele.waterConsumption.label = Water Consumption
channel-type.miele.waterConsumption.description = Water consumption by the currently running program on the appliance
channel-type.miele.water-consumption.label = Water Consumption
channel-type.miele.water-consumption.description = Water consumption by the currently running program on the appliance
# thing status descriptions

View File

@ -224,10 +224,10 @@
<state readOnly="true"></state>
</channel-type>
<channel-type id="powerConsumption">
<channel-type id="energy-consumption">
<item-type>Number:Energy</item-type>
<label>Power Consumption</label>
<description>Power consumption by the currently running program on the appliance</description>
<label>Energy Consumption</label>
<description>Energy consumption by the currently running program on the appliance</description>
<category>Energy</category>
<tags>
<tag>Measurement</tag>
@ -236,7 +236,7 @@
<state readOnly="true" pattern="%.1f %unit%"/>
</channel-type>
<channel-type id="waterConsumption">
<channel-type id="water-consumption">
<item-type>Number:Volume</item-type>
<label>Water Consumption</label>
<description>Water consumption by the currently running program on the appliance</description>
@ -245,7 +245,7 @@
<tag>Measurement</tag>
<tag>Water</tag>
</tags>
<state readOnly="true" pattern="%.1f %unit%"/>
<state readOnly="true" pattern="%.1f l"/>
</channel-type>
</thing:thing-descriptions>

View File

@ -27,10 +27,14 @@
<channel id="finish" typeId="finish"/>
<channel id="door" typeId="door"/>
<channel id="switch" typeId="switch"/>
<channel id="powerConsumption" typeId="powerConsumption"/>
<channel id="waterConsumption" typeId="waterConsumption"/>
<channel id="energyConsumption" typeId="energy-consumption"/>
<channel id="waterConsumption" typeId="water-consumption"/>
</channels>
<properties>
<property name="thingTypeVersion">1</property>
</properties>
<representation-property>uid</representation-property>
<config-description-ref uri="thing-type:miele:appliance"/>

View File

@ -33,10 +33,14 @@
<description>Temperature of the selected program (10 °C = cold)</description>
</channel>
<channel id="spinningspeed" typeId="spinningspeed"/>
<channel id="powerConsumption" typeId="powerConsumption"/>
<channel id="waterConsumption" typeId="waterConsumption"/>
<channel id="energyConsumption" typeId="energy-consumption"/>
<channel id="waterConsumption" typeId="water-consumption"/>
</channels>
<properties>
<property name="thingTypeVersion">1</property>
</properties>
<representation-property>uid</representation-property>
<config-description-ref uri="thing-type:miele:appliance"/>

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<update:update-descriptions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:update="https://openhab.org/schemas/update-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/update-description/v1.0.0 https://openhab.org/schemas/update-description-1.0.0.xsd">
<thing-type uid="miele:dishwasher">
<instruction-set targetVersion="1">
<add-channel id="energyConsumption">
<type>miele:energy-consumption</type>
</add-channel>
<update-channel id="waterConsumption">
<type>miele:water-consumption</type>
</update-channel>
<remove-channel id="powerConsumption"/>
</instruction-set>
</thing-type>
<thing-type uid="miele:washingmachine">
<instruction-set targetVersion="1">
<add-channel id="energyConsumption">
<type>miele:energy-consumption</type>
</add-channel>
<update-channel id="waterConsumption">
<type>miele:water-consumption</type>
</update-channel>
<remove-channel id="powerConsumption"/>
</instruction-set>
</thing-type>
</update:update-descriptions>