diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/EnOceanBindingConstants.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/EnOceanBindingConstants.java index 075ba0d4057ae..c03063723f605 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/EnOceanBindingConstants.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/EnOceanBindingConstants.java @@ -168,6 +168,7 @@ public class EnOceanBindingConstants { public static final String CHANNEL_BATTERY_LEVEL = "batteryLevel"; public static final String CHANNEL_BATTERYLOW = "batteryLow"; + public static final String CHANNEL_PILOT_WIRE = "pilotWire"; public static final String CHANNEL_AUTOOFF = "autoOFF"; public static final String CHANNEL_DELAYRADIOOFF = "delayRadioOFF"; public static final String CHANNEL_EXTERNALINTERFACEMODE = "externalInterfaceMode"; @@ -425,6 +426,9 @@ public class EnOceanBindingConstants { Map.entry(CHANNEL_CUMULATIVEVALUE, new EnOceanChannelDescription(new ChannelTypeUID(BINDING_ID, CHANNEL_CUMULATIVEVALUE), CoreItemFactory.NUMBER + ItemUtil.EXTENSION_SEPARATOR + Volume.class.getSimpleName())), + Map.entry(CHANNEL_PILOT_WIRE, + new EnOceanChannelDescription(new ChannelTypeUID(BINDING_ID, CHANNEL_PILOT_WIRE), + CoreItemFactory.NUMBER)), Map.entry(CHANNEL_AUTOOFF, new EnOceanChannelDescription(new ChannelTypeUID(BINDING_ID, CHANNEL_AUTOOFF), CoreItemFactory.NUMBER)), diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/D2_01/D2_01_0C.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/D2_01/D2_01_0C.java index 8e3243c8b7267..c73df689e9118 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/D2_01/D2_01_0C.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/D2_01/D2_01_0C.java @@ -12,8 +12,19 @@ */ package org.openhab.binding.enocean.internal.eep.D2_01; +import static org.openhab.binding.enocean.internal.EnOceanBindingConstants.*; + +import java.util.function.Function; + import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.enocean.internal.messages.ERP1Message; +import org.openhab.core.config.core.Configuration; +import org.openhab.core.library.types.DecimalType; +import org.openhab.core.types.Command; +import org.openhab.core.types.RefreshType; +import org.openhab.core.types.State; +import org.openhab.core.types.UnDefType; /** * @@ -22,6 +33,10 @@ @NonNullByDefault public class D2_01_0C extends D2_01 { + protected static final byte CMD_ACTUATOR_SET_PILOT_WIRE = 0x08; + protected static final byte CMD_ACTUATOR_PILOT_WIRE_QUERY = 0x09; + protected static final byte CMD_ACTUATOR_PILOT_WIRE_RESPONSE = 0x0A; + public D2_01_0C() { super(); } @@ -29,4 +44,32 @@ public D2_01_0C() { public D2_01_0C(ERP1Message packet) { super(packet); } + + @Override + protected void convertFromCommandImpl(String channelId, String channelTypeId, Command command, + Function getCurrentStateFunc, @Nullable Configuration config) { + if (channelId.equals(CHANNEL_PILOT_WIRE)) { + if (command == RefreshType.REFRESH) { + setData(CMD_ACTUATOR_PILOT_WIRE_QUERY, ALL_CHANNELS_MASK); + } else if (command instanceof DecimalType decimalCommand) { + setData(CMD_ACTUATOR_SET_PILOT_WIRE, decimalCommand.byteValue()); + } + } else { + super.convertFromCommandImpl(channelId, channelTypeId, command, getCurrentStateFunc, config); + } + } + + @Override + protected State convertToStateImpl(String channelId, String channelTypeId, + Function getCurrentStateFunc, Configuration config) { + if (channelId.equals(CHANNEL_PILOT_WIRE)) { + if (getCMD() == CMD_ACTUATOR_PILOT_WIRE_RESPONSE) { + return new DecimalType(bytes[1] & 0b111); + } + + return UnDefType.UNDEF; + } else { + return super.convertToStateImpl(channelId, channelTypeId, getCurrentStateFunc, config); + } + } } diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/EEPType.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/EEPType.java index 3a0ed4dd85d8d..e4b5e0324c1fe 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/EEPType.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/EEPType.java @@ -476,7 +476,7 @@ public enum EEPType { SwitchWithEnergyMeasurment_0B(RORG.VLD, 0x01, 0x0B, true, D2_01_0B.class, THING_TYPE_MEASUREMENTSWITCH, CHANNEL_GENERAL_SWITCHING, CHANNEL_TOTALUSAGE, CHANNEL_INSTANTPOWER), SwitchWithEnergyMeasurment_0C(RORG.VLD, 0x01, 0x0C, true, D2_01_0C.class, THING_TYPE_MEASUREMENTSWITCH, - CHANNEL_GENERAL_SWITCHING, CHANNEL_TOTALUSAGE, CHANNEL_INSTANTPOWER), + CHANNEL_GENERAL_SWITCHING, CHANNEL_PILOT_WIRE, CHANNEL_TOTALUSAGE, CHANNEL_INSTANTPOWER), SwitchWithEnergyMeasurment_0D(RORG.VLD, 0x01, 0x0D, true, D2_01_0D.class, THING_TYPE_MEASUREMENTSWITCH, CHANNEL_GENERAL_SWITCHING), SwitchWithEnergyMeasurment_0E(RORG.VLD, 0x01, 0x0E, true, D2_01_0E.class, THING_TYPE_MEASUREMENTSWITCH, diff --git a/bundles/org.openhab.binding.enocean/src/main/resources/OH-INF/i18n/enocean.properties b/bundles/org.openhab.binding.enocean/src/main/resources/OH-INF/i18n/enocean.properties index 8e165ddaf3286..3a489599a9eba 100644 --- a/bundles/org.openhab.binding.enocean/src/main/resources/OH-INF/i18n/enocean.properties +++ b/bundles/org.openhab.binding.enocean/src/main/resources/OH-INF/i18n/enocean.properties @@ -519,6 +519,14 @@ channel-type.enocean.outdoorAirHeaterStatus.label = Outdoor Air Heater Status channel-type.enocean.outdoorAirHeaterStatus.description = Indicates if outdoor air heater is active or not channel-type.enocean.outdoorAirTemperature.label = Outdoor Temperature channel-type.enocean.outdoorAirTemperature.description = Current outdoor air temperature in degree Celsius +channel-type.enocean.pilotWire.label = Pilot wire +channel-type.enocean.pilotWire.description = Mode of a heating device +channel-type.enocean.pilotWire.state.option.0 = Off +channel-type.enocean.pilotWire.state.option.1 = Comfort +channel-type.enocean.pilotWire.state.option.2 = Eco +channel-type.enocean.pilotWire.state.option.3 = Anti-freeze +channel-type.enocean.pilotWire.state.option.4 = Comfort-1 +channel-type.enocean.pilotWire.state.option.5 = Comfort-2 channel-type.enocean.protectionPlusEvent.label = Protection Plus Event channel-type.enocean.protectionPlusEvent.description = Triggered when a Protection Plus capable device detects a break-in attempt. channel-type.enocean.rainStatus.label = Rain diff --git a/bundles/org.openhab.binding.enocean/src/main/resources/OH-INF/thing/channels.xml b/bundles/org.openhab.binding.enocean/src/main/resources/OH-INF/thing/channels.xml index 62a71eabaafde..6c65159f11ae0 100644 --- a/bundles/org.openhab.binding.enocean/src/main/resources/OH-INF/thing/channels.xml +++ b/bundles/org.openhab.binding.enocean/src/main/resources/OH-INF/thing/channels.xml @@ -345,6 +345,22 @@ + + Number + + Mode of a heating device + + + + + + + + + + + + Number:ElectricPotential