mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-25 14:55:55 +01:00
[enocean] Add null annotations (#14023)
* mainly null annotations Signed-off-by: lsiepel <leosiepel@gmail.com> * checkstyle fixes Signed-off-by: lsiepel <leosiepel@gmail.com> * another checkstyle pass Signed-off-by: lsiepel <leosiepel@gmail.com> * Fix review comments Signed-off-by: lsiepel <leosiepel@gmail.com> * fix most review comments Signed-off-by: lsiepel <leosiepel@gmail.com> * Generic => temp_generic Signed-off-by: lsiepel <leosiepel@gmail.com> * temp_generic => generic Signed-off-by: lsiepel <leosiepel@gmail.com> * Generic fix try 2 Signed-off-by: lsiepel <leosiepel@gmail.com> * another generic commit Signed-off-by: lsiepel <leosiepel@gmail.com> * Final pass for changing generic packages/folder Signed-off-by: lsiepel <leosiepel@gmail.com> * Mised comment Signed-off-by: lsiepel <leosiepel@gmail.com> * Conflict folder change trial 1 Signed-off-by: lsiepel <leosiepel@gmail.com> * Conflict folder change final Signed-off-by: lsiepel <leosiepel@gmail.com> * Conflict folder change trial 2 Signed-off-by: lsiepel <leosiepel@gmail.com> * Move folder Signed-off-by: lsiepel <leosiepel@gmail.com> * Review comment Signed-off-by: lsiepel <leosiepel@gmail.com> --------- Signed-off-by: lsiepel <leosiepel@gmail.com>
This commit is contained in:
parent
a0e10b2120
commit
d4a231e8a9
@ -576,7 +576,7 @@ public class EnOceanBindingConstants {
|
||||
|
||||
// Bridge properties
|
||||
public static final String PROPERTY_BASE_ID = "Base ID";
|
||||
public static final String PROPERTY_REMAINING_WRITE_CYCLES_Base_ID = "Remaining Base ID Write Cycles";
|
||||
public static final String PROPERTY_REMAINING_WRITE_CYCLES_BASE_ID = "Remaining Base ID Write Cycles";
|
||||
public static final String PROPERTY_APP_VERSION = "APP Version";
|
||||
public static final String PROPERTY_API_VERSION = "API Version";
|
||||
public static final String PROPERTY_CHIP_ID = "Chip ID";
|
||||
@ -594,9 +594,9 @@ public class EnOceanBindingConstants {
|
||||
public static final String PARAMETER_ENOCEANID = "enoceanId";
|
||||
|
||||
// Channel config parameter
|
||||
public static final String PARAMETER_CHANNEL_TeachInMSG = "teachInMSG";
|
||||
public static final String PARAMETER_CHANNEL_Duration = "duration";
|
||||
public static final String PARAMETER_CHANNEL_SwitchMode = "switchMode";
|
||||
public static final String PARAMETER_CHANNEL_TEACHINMSG = "teachInMSG";
|
||||
public static final String PARAMETER_CHANNEL_DURATION = "duration";
|
||||
public static final String PARAMETER_CHANNEL_SWITCHMODE = "switchMode";
|
||||
|
||||
// Manufacturer Ids - used to recognize special EEPs during auto discovery
|
||||
public static final int ELTAKOID = 0x00d;
|
||||
|
@ -12,7 +12,8 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.core.thing.type.ChannelTypeUID;
|
||||
|
||||
/**
|
||||
@ -21,10 +22,10 @@ import org.openhab.core.thing.type.ChannelTypeUID;
|
||||
* This class holds information for creating a channel of an EnOcean thing like acceptedItemType and
|
||||
* channelTypeUID
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class EnOceanChannelDescription {
|
||||
public final ChannelTypeUID channelTypeUID;
|
||||
public final String acceptedItemType;
|
||||
@NonNull
|
||||
public final String label;
|
||||
public final boolean isStateChannel;
|
||||
public final boolean autoCreate;
|
||||
@ -49,15 +50,11 @@ public class EnOceanChannelDescription {
|
||||
* @param autoCreate create channel during thing initialization, otherwise channel is created
|
||||
* manually/predefined
|
||||
*/
|
||||
public EnOceanChannelDescription(ChannelTypeUID channelTypeUID, String itemType, String label,
|
||||
public EnOceanChannelDescription(ChannelTypeUID channelTypeUID, @Nullable String itemType, @Nullable String label,
|
||||
boolean isStateChannel, boolean autoCreate) {
|
||||
this.channelTypeUID = channelTypeUID;
|
||||
this.acceptedItemType = itemType;
|
||||
if (label != null) {
|
||||
this.label = label;
|
||||
} else {
|
||||
this.label = "";
|
||||
}
|
||||
this.acceptedItemType = itemType != null ? itemType : "";
|
||||
this.label = label != null ? label : "";
|
||||
|
||||
this.isStateChannel = isStateChannel;
|
||||
this.autoCreate = autoCreate;
|
||||
|
@ -12,10 +12,13 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public enum EnOceanConfigStatusMessage {
|
||||
PORT_MISSING("missing-port-configuration"),
|
||||
SENDERID_MISSING("missing-senderId-configuration"),
|
||||
|
@ -12,10 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class EnOceanException extends Exception {
|
||||
|
||||
/**
|
||||
@ -23,7 +27,7 @@ public class EnOceanException extends Exception {
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public EnOceanException(String msg) {
|
||||
public EnOceanException(@Nullable String msg) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,8 @@ import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.binding.enocean.internal.discovery.EnOceanDeviceDiscoveryService;
|
||||
import org.openhab.binding.enocean.internal.handler.EnOceanBaseActuatorHandler;
|
||||
import org.openhab.binding.enocean.internal.handler.EnOceanBaseSensorHandler;
|
||||
@ -36,6 +38,7 @@ import org.openhab.core.thing.binding.ThingHandler;
|
||||
import org.openhab.core.thing.binding.ThingHandlerFactory;
|
||||
import org.openhab.core.thing.link.ItemChannelLinkRegistry;
|
||||
import org.osgi.framework.ServiceRegistration;
|
||||
import org.osgi.service.component.annotations.Activate;
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
|
||||
@ -45,6 +48,7 @@ import org.osgi.service.component.annotations.Reference;
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
@Component(service = ThingHandlerFactory.class, configurationPid = "binding.enocean")
|
||||
public class EnOceanHandlerFactory extends BaseThingHandlerFactory {
|
||||
|
||||
@ -55,14 +59,19 @@ public class EnOceanHandlerFactory extends BaseThingHandlerFactory {
|
||||
|
||||
private Map<ThingUID, ServiceRegistration<?>> discoveryServiceRegs = new HashMap<>();
|
||||
|
||||
@Reference
|
||||
SerialPortManager serialPortManager;
|
||||
private final SerialPortManager serialPortManager;
|
||||
private final ThingManager thingManager;
|
||||
private final ItemChannelLinkRegistry itemChannelLinkRegistry;
|
||||
|
||||
@Reference
|
||||
ItemChannelLinkRegistry itemChannelLinkRegistry;
|
||||
|
||||
@Reference
|
||||
ThingManager thingManager;
|
||||
@Activate
|
||||
public EnOceanHandlerFactory(final @Reference SerialPortManager serialPortManager,
|
||||
final @Reference ThingManager thingManager,
|
||||
final @Reference ItemChannelLinkRegistry itemChannelLinkRegistry) {
|
||||
// Obtain references to thes service using an OSGi reference
|
||||
this.serialPortManager = serialPortManager;
|
||||
this.thingManager = thingManager;
|
||||
this.itemChannelLinkRegistry = itemChannelLinkRegistry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsThingType(ThingTypeUID thingTypeUID) {
|
||||
@ -70,9 +79,8 @@ public class EnOceanHandlerFactory extends BaseThingHandlerFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ThingHandler createHandler(Thing thing) {
|
||||
protected @Nullable ThingHandler createHandler(Thing thing) {
|
||||
ThingTypeUID thingTypeUID = thing.getThingTypeUID();
|
||||
|
||||
if (EnOceanBridgeHandler.SUPPORTED_THING_TYPES.contains(thingTypeUID)) {
|
||||
EnOceanBridgeHandler bridgeHandler = new EnOceanBridgeHandler((Bridge) thing, serialPortManager);
|
||||
registerDeviceDiscoveryService(bridgeHandler);
|
||||
@ -90,12 +98,10 @@ public class EnOceanHandlerFactory extends BaseThingHandlerFactory {
|
||||
|
||||
@Override
|
||||
protected void removeHandler(ThingHandler thingHandler) {
|
||||
if (this.discoveryServiceRegs != null) {
|
||||
ServiceRegistration<?> serviceReg = this.discoveryServiceRegs.get(thingHandler.getThing().getUID());
|
||||
if (serviceReg != null) {
|
||||
serviceReg.unregister();
|
||||
discoveryServiceRegs.remove(thingHandler.getThing().getUID());
|
||||
}
|
||||
ServiceRegistration<?> serviceReg = this.discoveryServiceRegs.get(thingHandler.getThing().getUID());
|
||||
if (serviceReg != null) {
|
||||
serviceReg.unregister();
|
||||
discoveryServiceRegs.remove(thingHandler.getThing().getUID());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,14 +14,17 @@ package org.openhab.binding.enocean.internal;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class Helper {
|
||||
|
||||
public static byte[] concatAll(byte[] a, byte[]... rest) {
|
||||
if (rest == null) {
|
||||
if (rest.length == 0) {
|
||||
return a;
|
||||
}
|
||||
|
||||
@ -40,7 +43,7 @@ public class Helper {
|
||||
offset += array.length;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return result != null ? result : new byte[0];
|
||||
}
|
||||
|
||||
public static int tryParseInt(String value, int defaultValue) {
|
||||
|
@ -12,18 +12,22 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.config;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class EnOceanActuatorConfig extends EnOceanBaseConfig {
|
||||
|
||||
public int channel;
|
||||
public Integer senderIdOffset = null;
|
||||
public String manufacturerId;
|
||||
public String teachInType;
|
||||
public @Nullable Integer senderIdOffset = null;
|
||||
public String manufacturerId = "";
|
||||
public String teachInType = "";
|
||||
|
||||
public String sendingEEPId;
|
||||
public String sendingEEPId = "";
|
||||
|
||||
public int pollingInterval;
|
||||
|
||||
|
@ -12,10 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.config;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class EnOceanBridgeConfig {
|
||||
|
||||
public enum ESPVersion {
|
||||
@ -40,24 +44,17 @@ public class EnOceanBridgeConfig {
|
||||
}
|
||||
}
|
||||
|
||||
public String path;
|
||||
public String path = "";
|
||||
|
||||
public String espVersion;
|
||||
public String espVersion = "ESP3";
|
||||
public boolean rs485;
|
||||
public String rs485BaseId;
|
||||
public String rs485BaseId = "";
|
||||
|
||||
public Integer nextSenderId;
|
||||
public @Nullable Integer nextSenderId;
|
||||
|
||||
public boolean enableSmack;
|
||||
public boolean enableSmack = true;
|
||||
public boolean sendTeachOuts;
|
||||
|
||||
public EnOceanBridgeConfig() {
|
||||
espVersion = "ESP3";
|
||||
sendTeachOuts = false;
|
||||
enableSmack = true;
|
||||
nextSenderId = null;
|
||||
}
|
||||
|
||||
public ESPVersion getESPVersion() {
|
||||
return ESPVersion.getESPVersion(espVersion);
|
||||
}
|
||||
|
@ -12,10 +12,13 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.config;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Holger Englert - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class EnOceanChannelContactConfig {
|
||||
// Swap Open/Closed value, e.g.
|
||||
// Eltako FPE-1: false, Eltako FPE-2: true
|
||||
|
@ -12,10 +12,13 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.config;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Dominik Krickl-Vorreiter - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class EnOceanChannelDimmerConfig {
|
||||
|
||||
public int rampingTime = 0;
|
||||
|
@ -14,10 +14,14 @@ package org.openhab.binding.enocean.internal.config;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class EnOceanChannelRockerSwitchConfigBase {
|
||||
|
||||
public String switchMode;
|
||||
@ -39,7 +43,7 @@ public class EnOceanChannelRockerSwitchConfigBase {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static SwitchMode getSwitchMode(String value) {
|
||||
public static SwitchMode getSwitchMode(@Nullable String value) {
|
||||
if (value == null) {
|
||||
return SwitchMode.Unkown;
|
||||
}
|
||||
@ -65,7 +69,7 @@ public class EnOceanChannelRockerSwitchConfigBase {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static Channel getChannel(String value) {
|
||||
public static Channel getChannel(@Nullable String value) {
|
||||
if (value == null) {
|
||||
return Channel.Unkown;
|
||||
}
|
||||
|
@ -12,18 +12,19 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.config;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class EnOceanChannelRockerSwitchListenerConfig extends EnOceanChannelRockerSwitchConfigBase {
|
||||
|
||||
public String enoceanId;
|
||||
public boolean handleSecondAction;
|
||||
public String enoceanId = "";
|
||||
public boolean handleSecondAction = false;
|
||||
|
||||
public EnOceanChannelRockerSwitchListenerConfig() {
|
||||
super();
|
||||
enoceanId = null;
|
||||
handleSecondAction = false;
|
||||
}
|
||||
}
|
||||
|
@ -12,10 +12,13 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.config;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class EnOceanChannelRollershutterConfig {
|
||||
|
||||
public int shutTime;
|
||||
|
@ -12,10 +12,13 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.config;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class EnOceanChannelTariffInfoConfig {
|
||||
public int tariff = 0;
|
||||
}
|
||||
|
@ -12,12 +12,15 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.config;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class EnOceanChannelTeachInConfig {
|
||||
|
||||
public String teachInMSG;
|
||||
public String manufacturerId;
|
||||
public String teachInMSG = "";
|
||||
public String manufacturerId = "";
|
||||
}
|
||||
|
@ -12,10 +12,13 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.config;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Dominik Vorreiter - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class EnOceanChannelTotalusageConfig {
|
||||
public boolean validateValue = false;
|
||||
}
|
||||
|
@ -12,19 +12,21 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.config;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.config.core.Configuration;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class EnOceanChannelTransformationConfig extends Configuration {
|
||||
|
||||
public String transformationType;
|
||||
public String transformationFunction;
|
||||
public String transformationType = "";
|
||||
public String transformationFunction = "";
|
||||
|
||||
public EnOceanChannelTransformationConfig() {
|
||||
put("transformationType", "");
|
||||
put("transformationFunction", "");
|
||||
put("transformationType", transformationType);
|
||||
put("transformationFunction", transformationFunction);
|
||||
}
|
||||
}
|
||||
|
@ -12,10 +12,13 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.config;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class EnOceanChannelVirtualRockerSwitchConfig extends EnOceanChannelRockerSwitchConfigBase {
|
||||
|
||||
public Integer duration;
|
||||
|
@ -12,12 +12,15 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.config;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
* This {@link EnOceanProfileRockerSwitchActionConfig} config class is used for rockerSwitchAction profiles to define in
|
||||
* which case it should react.
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class EnOceanProfileRockerSwitchActionConfig {
|
||||
|
||||
public String channelAFilter;
|
||||
|
@ -17,6 +17,8 @@ import static org.openhab.binding.enocean.internal.EnOceanBindingConstants.*;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.binding.enocean.internal.eep.Base.UTEResponse;
|
||||
import org.openhab.binding.enocean.internal.eep.Base._4BSMessage;
|
||||
import org.openhab.binding.enocean.internal.eep.EEP;
|
||||
@ -27,7 +29,7 @@ import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message.RORG;
|
||||
import org.openhab.binding.enocean.internal.messages.EventMessage;
|
||||
import org.openhab.binding.enocean.internal.messages.EventMessage.EventMessageType;
|
||||
import org.openhab.binding.enocean.internal.messages.Responses.SMACKTeachInResponse;
|
||||
import org.openhab.binding.enocean.internal.messages.responses.SMACKTeachInResponse;
|
||||
import org.openhab.binding.enocean.internal.transceiver.TeachInListener;
|
||||
import org.openhab.core.config.discovery.AbstractDiscoveryService;
|
||||
import org.openhab.core.config.discovery.DiscoveryResultBuilder;
|
||||
@ -44,6 +46,7 @@ import org.slf4j.LoggerFactory;
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class EnOceanDeviceDiscoveryService extends AbstractDiscoveryService implements TeachInListener {
|
||||
private final Logger logger = LoggerFactory.getLogger(EnOceanDeviceDiscoveryService.class);
|
||||
|
||||
@ -70,20 +73,12 @@ public class EnOceanDeviceDiscoveryService extends AbstractDiscoveryService impl
|
||||
|
||||
@Override
|
||||
protected void startScan() {
|
||||
if (bridgeHandler == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
logger.info("Starting EnOcean discovery and accepting teach in requests");
|
||||
bridgeHandler.startDiscovery(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void stopScan() {
|
||||
if (bridgeHandler == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
logger.info("Stopping EnOcean discovery scan");
|
||||
bridgeHandler.stopDiscovery();
|
||||
super.stopScan();
|
||||
@ -125,11 +120,12 @@ public class EnOceanDeviceDiscoveryService extends AbstractDiscoveryService impl
|
||||
|
||||
// check for bidirectional communication => do not use broadcast in this case
|
||||
if (msg.getRORG() == RORG.UTE && (msg.getPayload(1, 1)[0]
|
||||
& UTEResponse.CommunicationType_MASK) == UTEResponse.CommunicationType_MASK) {
|
||||
& UTEResponse.COMMUNICATION_TYPE_MASK) == UTEResponse.COMMUNICATION_TYPE_MASK) {
|
||||
broadcastMessages = false;
|
||||
}
|
||||
|
||||
if (msg.getRORG() == RORG.UTE && (msg.getPayload(1, 1)[0] & UTEResponse.ResponseNeeded_MASK) == 0) {
|
||||
if (msg.getRORG() == RORG.UTE
|
||||
&& (msg.getPayload(1, 1)[0] & UTEResponse.RESPONSE_NEEDED_MASK) == 0) {
|
||||
// if ute => send response if needed
|
||||
logger.debug("Sending UTE response to {}", enoceanId);
|
||||
senderIdOffset = sendTeachInResponse(msg, enoceanId);
|
||||
@ -183,7 +179,7 @@ public class EnOceanDeviceDiscoveryService extends AbstractDiscoveryService impl
|
||||
}
|
||||
}
|
||||
|
||||
private Integer sendTeachInResponse(ERP1Message msg, String enoceanId) {
|
||||
private @Nullable Integer sendTeachInResponse(ERP1Message msg, String enoceanId) {
|
||||
// get new sender Id
|
||||
Integer offset = bridgeHandler.getNextSenderId(enoceanId);
|
||||
if (offset != null) {
|
||||
@ -193,9 +189,12 @@ public class EnOceanDeviceDiscoveryService extends AbstractDiscoveryService impl
|
||||
// send response
|
||||
EEP response = EEPFactory.buildResponseEEPFromTeachInERP1(msg, newSenderId, true);
|
||||
if (response != null) {
|
||||
bridgeHandler.sendMessage(response.getERP1Message(), null);
|
||||
logger.debug("Teach in response for {} with new senderId {} (= offset {}) sent", enoceanId,
|
||||
HexUtils.bytesToHex(newSenderId), offset);
|
||||
BasePacket bPacket = response.getERP1Message();
|
||||
if (bPacket != null) {
|
||||
bridgeHandler.sendMessage(bPacket, null);
|
||||
logger.debug("Teach in response for {} with new senderId {} (= offset {}) sent", enoceanId,
|
||||
HexUtils.bytesToHex(newSenderId), offset);
|
||||
}
|
||||
} else {
|
||||
logger.warn("Teach in response for enoceanId {} not supported!", enoceanId);
|
||||
}
|
||||
@ -212,16 +211,24 @@ public class EnOceanDeviceDiscoveryService extends AbstractDiscoveryService impl
|
||||
// send response
|
||||
EEP response = EEPFactory.buildResponseEEPFromTeachInERP1(msg, senderId, false);
|
||||
if (response != null) {
|
||||
bridgeHandler.sendMessage(response.getERP1Message(), null);
|
||||
logger.debug("Teach out response for thing {} with EnOceanId {} sent", thing.getUID().getId(), enoceanId);
|
||||
ERP1Message message = response.getERP1Message();
|
||||
if (message != null) {
|
||||
bridgeHandler.sendMessage(message, null);
|
||||
logger.debug("Teach out response for thing {} with EnOceanId {} sent", thing.getUID().getId(),
|
||||
enoceanId);
|
||||
}
|
||||
} else {
|
||||
logger.warn("Teach out response for enoceanId {} not supported!", enoceanId);
|
||||
}
|
||||
}
|
||||
|
||||
protected void createDiscoveryResult(EEP eep, boolean broadcastMessages, Integer senderIdOffset) {
|
||||
protected void createDiscoveryResult(EEP eep, boolean broadcastMessages, @Nullable Integer senderIdOffset) {
|
||||
String enoceanId = HexUtils.bytesToHex(eep.getSenderId());
|
||||
ThingTypeUID thingTypeUID = eep.getThingTypeUID();
|
||||
if (thingTypeUID == null) {
|
||||
logger.debug("Discovery failed, could not get ThingTypeUID for EnOceanId {}", enoceanId);
|
||||
return;
|
||||
}
|
||||
ThingUID thingUID = new ThingUID(thingTypeUID, bridgeHandler.getThing().getUID(), enoceanId);
|
||||
|
||||
DiscoveryResultBuilder discoveryResultBuilder = DiscoveryResultBuilder.create(thingUID)
|
||||
|
@ -18,6 +18,7 @@ import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.core.config.discovery.DiscoveryResult;
|
||||
import org.openhab.core.config.discovery.DiscoveryResultBuilder;
|
||||
@ -35,6 +36,7 @@ import org.osgi.service.component.annotations.Component;
|
||||
*
|
||||
* @author Aitor Iturrioz - initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
@Component(service = UsbSerialDiscoveryParticipant.class)
|
||||
public class EnOceanUsbSerialDiscoveryParticipant implements UsbSerialDiscoveryParticipant {
|
||||
|
||||
|
@ -14,6 +14,8 @@ package org.openhab.binding.enocean.internal.eep.A5_02;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.binding.enocean.internal.eep.Base._4BSMessage;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
import org.openhab.core.config.core.Configuration;
|
||||
@ -25,6 +27,7 @@ import org.openhab.core.types.State;
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public abstract class A5_02 extends _4BSMessage {
|
||||
|
||||
public A5_02(ERP1Message packet) {
|
||||
@ -44,13 +47,12 @@ public abstract class A5_02 extends _4BSMessage {
|
||||
protected abstract double getScaledMax();
|
||||
|
||||
protected int getUnscaledTemperatureValue() {
|
||||
return getDB_1Value();
|
||||
return getDB1Value();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected State convertToStateImpl(String channelId, String channelTypeId,
|
||||
Function<String, State> getCurrentStateFunc, Configuration config) {
|
||||
|
||||
Function<String, @Nullable State> getCurrentStateFunc, Configuration config) {
|
||||
double scaledTemp = getScaledMin()
|
||||
- (((getUnscaledMin() - getUnscaledTemperatureValue()) * (getScaledMin() - getScaledMax()))
|
||||
/ getUnscaledMin());
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_02;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_02_01 extends A5_02 {
|
||||
|
||||
public A5_02_01(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_02;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_02_02 extends A5_02 {
|
||||
|
||||
public A5_02_02(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_02;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_02_03 extends A5_02 {
|
||||
|
||||
public A5_02_03(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_02;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_02_04 extends A5_02 {
|
||||
|
||||
public A5_02_04(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_02;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_02_05 extends A5_02 {
|
||||
|
||||
public A5_02_05(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_02;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_02_06 extends A5_02 {
|
||||
|
||||
public A5_02_06(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_02;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_02_07 extends A5_02 {
|
||||
|
||||
public A5_02_07(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_02;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_02_08 extends A5_02 {
|
||||
|
||||
public A5_02_08(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_02;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_02_09 extends A5_02 {
|
||||
|
||||
public A5_02_09(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_02;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_02_0A extends A5_02 {
|
||||
|
||||
public A5_02_0A(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_02;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_02_0B extends A5_02 {
|
||||
|
||||
public A5_02_0B(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_02;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_02_10 extends A5_02 {
|
||||
|
||||
public A5_02_10(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_02;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_02_11 extends A5_02 {
|
||||
|
||||
public A5_02_11(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_02;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_02_12 extends A5_02 {
|
||||
|
||||
public A5_02_12(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_02;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_02_13 extends A5_02 {
|
||||
|
||||
public A5_02_13(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_02;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_02_14 extends A5_02 {
|
||||
|
||||
public A5_02_14(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_02;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_02_15 extends A5_02 {
|
||||
|
||||
public A5_02_15(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_02;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_02_16 extends A5_02 {
|
||||
|
||||
public A5_02_16(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_02;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_02_17 extends A5_02 {
|
||||
|
||||
public A5_02_17(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_02;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_02_18 extends A5_02 {
|
||||
|
||||
public A5_02_18(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_02;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_02_19 extends A5_02 {
|
||||
|
||||
public A5_02_19(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_02;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_02_1A extends A5_02 {
|
||||
|
||||
public A5_02_1A(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_02;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_02_1B extends A5_02 {
|
||||
|
||||
public A5_02_1B(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_02;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_02_20 extends A5_02 {
|
||||
|
||||
public A5_02_20(ERP1Message packet) {
|
||||
@ -46,6 +48,6 @@ public class A5_02_20 extends A5_02 {
|
||||
|
||||
@Override
|
||||
protected int getUnscaledTemperatureValue() {
|
||||
return getDB_1Value() + ((getDB_2Value() & 0b11) << 8);
|
||||
return getDB1Value() + ((getDB2Value() & 0b11) << 8);
|
||||
}
|
||||
}
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_02;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_02_30 extends A5_02 {
|
||||
|
||||
public A5_02_30(ERP1Message packet) {
|
||||
@ -46,6 +48,6 @@ public class A5_02_30 extends A5_02 {
|
||||
|
||||
@Override
|
||||
protected int getUnscaledTemperatureValue() {
|
||||
return getDB_1Value() + ((getDB_2Value() & 0b11) << 8);
|
||||
return getDB1Value() + ((getDB2Value() & 0b11) << 8);
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,8 @@ 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.eep.Base._4BSMessage;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
import org.openhab.core.config.core.Configuration;
|
||||
@ -29,6 +31,7 @@ import org.openhab.core.types.UnDefType;
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public abstract class A5_04 extends _4BSMessage {
|
||||
|
||||
public A5_04(ERP1Message packet) {
|
||||
@ -48,7 +51,7 @@ public abstract class A5_04 extends _4BSMessage {
|
||||
protected abstract double getScaledTemperatureMax();
|
||||
|
||||
protected int getUnscaledTemperatureValue() {
|
||||
return getDB_1Value();
|
||||
return getDB1Value();
|
||||
}
|
||||
|
||||
protected double getUnscaledHumidityMax() {
|
||||
@ -56,13 +59,12 @@ public abstract class A5_04 extends _4BSMessage {
|
||||
}
|
||||
|
||||
protected int getUnscaledHumidityValue() {
|
||||
return getDB_2Value();
|
||||
return getDB2Value();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected State convertToStateImpl(String channelId, String channelTypeId,
|
||||
Function<String, State> getCurrentStateFunc, Configuration config) {
|
||||
|
||||
Function<String, @Nullable State> getCurrentStateFunc, Configuration config) {
|
||||
if (channelId.equals(CHANNEL_TEMPERATURE)) {
|
||||
double scaledTemp = getScaledTemperatureMin()
|
||||
+ ((getUnscaledTemperatureValue() * (getScaledTemperatureMax() - getScaledTemperatureMin()))
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_04;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_04_01 extends A5_04 {
|
||||
|
||||
public A5_04_01(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_04;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_04_02 extends A5_04 {
|
||||
|
||||
public A5_04_02(ERP1Message packet) {
|
||||
|
@ -16,6 +16,8 @@ import static org.openhab.binding.enocean.internal.EnOceanBindingConstants.CHANN
|
||||
|
||||
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.QuantityType;
|
||||
@ -26,6 +28,7 @@ import org.openhab.core.types.State;
|
||||
*
|
||||
* @author Dominik Krickl-Vorreiter - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_04_02_Eltako extends A5_04_02 {
|
||||
|
||||
public A5_04_02_Eltako(ERP1Message packet) {
|
||||
@ -34,9 +37,9 @@ public class A5_04_02_Eltako extends A5_04_02 {
|
||||
|
||||
@Override
|
||||
protected State convertToStateImpl(String channelId, String channelTypeId,
|
||||
Function<String, State> getCurrentStateFunc, Configuration config) {
|
||||
Function<String, @Nullable State> getCurrentStateFunc, Configuration config) {
|
||||
if (channelId.equals(CHANNEL_BATTERY_VOLTAGE)) {
|
||||
double voltage = getDB_3Value() * 6.58 / 255.0; // not sure if this is right
|
||||
double voltage = getDB3Value() * 6.58 / 255.0; // not sure if this is right
|
||||
return new QuantityType<>(voltage, Units.VOLT);
|
||||
}
|
||||
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_04;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_04_03 extends A5_04 {
|
||||
|
||||
public A5_04_03(ERP1Message packet) {
|
||||
@ -41,7 +43,7 @@ public class A5_04_03 extends A5_04 {
|
||||
|
||||
@Override
|
||||
protected int getUnscaledTemperatureValue() {
|
||||
return getDB_1Value() + ((getDB_2Value() & 0b11) << 8);
|
||||
return getDB1Value() + ((getDB2Value() & 0b11) << 8);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -51,6 +53,6 @@ public class A5_04_03 extends A5_04 {
|
||||
|
||||
@Override
|
||||
protected int getUnscaledHumidityValue() {
|
||||
return getDB_3Value();
|
||||
return getDB3Value();
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,8 @@ 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.eep.Base._4BSMessage;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
import org.openhab.core.config.core.Configuration;
|
||||
@ -28,6 +30,7 @@ import org.openhab.core.types.UnDefType;
|
||||
*
|
||||
* @author Dominik Krickl-Vorreiter - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_06_01 extends _4BSMessage {
|
||||
|
||||
public A5_06_01(ERP1Message packet) {
|
||||
@ -35,7 +38,7 @@ public class A5_06_01 extends _4BSMessage {
|
||||
}
|
||||
|
||||
private State getBatteryVoltage() {
|
||||
int db3 = getDB_3Value();
|
||||
int db3 = getDB3Value();
|
||||
|
||||
double voltage = db3 / 50.0; // 0..255 = 0.0..5.1V
|
||||
|
||||
@ -43,16 +46,16 @@ public class A5_06_01 extends _4BSMessage {
|
||||
}
|
||||
|
||||
private State getIllumination() {
|
||||
boolean rs = getBit(getDB_0(), 0);
|
||||
boolean rs = getBit(getDB0(), 0);
|
||||
|
||||
double illumination = rs ? getDB_2Value() * 116.48 + 300.0 : getDB_1Value() * 232.94 + 600.0;
|
||||
double illumination = rs ? getDB2Value() * 116.48 + 300.0 : getDB1Value() * 232.94 + 600.0;
|
||||
|
||||
return new QuantityType<>(illumination, Units.LUX);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected State convertToStateImpl(String channelId, String channelTypeId,
|
||||
Function<String, State> getCurrentStateFunc, Configuration config) {
|
||||
Function<String, @Nullable State> getCurrentStateFunc, Configuration config) {
|
||||
switch (channelId) {
|
||||
case CHANNEL_BATTERY_VOLTAGE:
|
||||
return getBatteryVoltage();
|
||||
|
@ -16,6 +16,8 @@ import static org.openhab.binding.enocean.internal.EnOceanBindingConstants.CHANN
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.binding.enocean.internal.eep.Base._4BSMessage;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
import org.openhab.core.config.core.Configuration;
|
||||
@ -28,6 +30,7 @@ import org.openhab.core.types.UnDefType;
|
||||
*
|
||||
* @author Dominik Krickl-Vorreiter - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_06_01_ELTAKO extends _4BSMessage {
|
||||
|
||||
public A5_06_01_ELTAKO(ERP1Message packet) {
|
||||
@ -35,10 +38,10 @@ public class A5_06_01_ELTAKO extends _4BSMessage {
|
||||
}
|
||||
|
||||
private State getIllumination() {
|
||||
int db2 = getDB_2Value();
|
||||
int db2 = getDB2Value();
|
||||
|
||||
if (db2 == 0) {
|
||||
int db3 = getDB_3Value();
|
||||
int db3 = getDB3Value();
|
||||
return new QuantityType<>(db3 * 0.5, Units.LUX);
|
||||
} else {
|
||||
return new QuantityType<>(db2 * 116.48 + 300.0, Units.LUX);
|
||||
@ -47,7 +50,7 @@ public class A5_06_01_ELTAKO extends _4BSMessage {
|
||||
|
||||
@Override
|
||||
protected State convertToStateImpl(String channelId, String channelTypeId,
|
||||
Function<String, State> getCurrentStateFunc, Configuration config) {
|
||||
Function<String, @Nullable State> getCurrentStateFunc, Configuration config) {
|
||||
switch (channelId) {
|
||||
case CHANNEL_ILLUMINATION:
|
||||
return getIllumination();
|
||||
|
@ -16,6 +16,8 @@ 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.eep.Base._4BSMessage;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
import org.openhab.core.config.core.Configuration;
|
||||
@ -28,6 +30,7 @@ import org.openhab.core.types.UnDefType;
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public abstract class A5_07 extends _4BSMessage {
|
||||
|
||||
public A5_07(ERP1Message packet) {
|
||||
@ -52,8 +55,7 @@ public abstract class A5_07 extends _4BSMessage {
|
||||
|
||||
@Override
|
||||
protected State convertToStateImpl(String channelId, String channelTypeId,
|
||||
Function<String, State> getCurrentStateFunc, Configuration config) {
|
||||
|
||||
Function<String, @Nullable State> getCurrentStateFunc, Configuration config) {
|
||||
if (channelId.equals(CHANNEL_ILLUMINATION)) {
|
||||
return getIllumination();
|
||||
} else if (channelId.equals(CHANNEL_MOTIONDETECTION)) {
|
||||
|
@ -12,6 +12,7 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_07;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
import org.openhab.core.library.types.OnOffType;
|
||||
import org.openhab.core.types.State;
|
||||
@ -21,9 +22,10 @@ import org.openhab.core.types.UnDefType;
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_07_01 extends A5_07 {
|
||||
|
||||
private final int PIR_OFF = 0x7f;
|
||||
private static final int PIR_OFF = 0x7f;
|
||||
|
||||
public A5_07_01(ERP1Message packet) {
|
||||
super(packet);
|
||||
@ -36,15 +38,15 @@ public class A5_07_01 extends A5_07 {
|
||||
|
||||
@Override
|
||||
protected State getMotion() {
|
||||
return getDB_1Value() <= PIR_OFF ? OnOffType.OFF : OnOffType.ON;
|
||||
return getDB1Value() <= PIR_OFF ? OnOffType.OFF : OnOffType.ON;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected State getSupplyVoltage() {
|
||||
if (!getBit(getDB_0Value(), 0)) {
|
||||
if (!getBit(getDB0Value(), 0)) {
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
|
||||
return getSupplyVoltage(getDB_3Value());
|
||||
return getSupplyVoltage(getDB3Value());
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_07;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
import org.openhab.core.library.types.OnOffType;
|
||||
import org.openhab.core.types.State;
|
||||
@ -21,6 +22,7 @@ import org.openhab.core.types.UnDefType;
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_07_02 extends A5_07 {
|
||||
|
||||
public A5_07_02(ERP1Message packet) {
|
||||
@ -34,11 +36,11 @@ public class A5_07_02 extends A5_07 {
|
||||
|
||||
@Override
|
||||
protected State getMotion() {
|
||||
return getBit(getDB_0Value(), 7) ? OnOffType.ON : OnOffType.OFF;
|
||||
return getBit(getDB0Value(), 7) ? OnOffType.ON : OnOffType.OFF;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected State getSupplyVoltage() {
|
||||
return getSupplyVoltage(getDB_3Value());
|
||||
return getSupplyVoltage(getDB3Value());
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_07;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
import org.openhab.core.library.types.QuantityType;
|
||||
import org.openhab.core.library.unit.Units;
|
||||
@ -21,6 +22,7 @@ import org.openhab.core.types.State;
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_07_03 extends A5_07_02 {
|
||||
|
||||
public A5_07_03(ERP1Message packet) {
|
||||
@ -29,6 +31,6 @@ public class A5_07_03 extends A5_07_02 {
|
||||
|
||||
@Override
|
||||
protected State getIllumination() {
|
||||
return new QuantityType<>((getDB_2Value() << 8) + ((getDB_1Value() & 0b11000000) >>> 6), Units.LUX);
|
||||
return new QuantityType<>((getDB2Value() << 8) + ((getDB1Value() & 0b11000000) >>> 6), Units.LUX);
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,8 @@ 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.eep.Base._4BSMessage;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
import org.openhab.core.config.core.Configuration;
|
||||
@ -30,6 +32,7 @@ import org.openhab.core.types.UnDefType;
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public abstract class A5_08 extends _4BSMessage {
|
||||
|
||||
public A5_08(ERP1Message packet) {
|
||||
@ -61,17 +64,16 @@ public abstract class A5_08 extends _4BSMessage {
|
||||
protected abstract double getScaledIlluminationMax();
|
||||
|
||||
protected int getUnscaledTemperatureValue() {
|
||||
return getDB_1Value();
|
||||
return getDB1Value();
|
||||
}
|
||||
|
||||
protected int getUnscaledIlluminationValue() {
|
||||
return getDB_2Value();
|
||||
return getDB2Value();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected State convertToStateImpl(String channelId, String channelTypeId,
|
||||
Function<String, State> getCurrentStateFunc, Configuration config) {
|
||||
|
||||
Function<String, @Nullable State> getCurrentStateFunc, Configuration config) {
|
||||
if (channelId.equals(CHANNEL_TEMPERATURE)) {
|
||||
double scaledTemp = getScaledTemperatureMin()
|
||||
+ ((getUnscaledTemperatureValue() * (getScaledTemperatureMax() - getScaledTemperatureMin()))
|
||||
@ -83,9 +85,9 @@ public abstract class A5_08 extends _4BSMessage {
|
||||
/ (getUnscaledIlluminationMax() - getUnscaledIlluminationMin()));
|
||||
return new QuantityType<>(scaledIllumination, Units.LUX);
|
||||
} else if (channelId.equals(CHANNEL_MOTIONDETECTION)) {
|
||||
return getBit(getDB_0(), 1) ? OnOffType.OFF : OnOffType.ON;
|
||||
return getBit(getDB0(), 1) ? OnOffType.OFF : OnOffType.ON;
|
||||
} else if (channelId.equals(CHANNEL_OCCUPANCY)) {
|
||||
return getBit(getDB_0(), 0) ? OnOffType.OFF : OnOffType.ON;
|
||||
return getBit(getDB0(), 0) ? OnOffType.OFF : OnOffType.ON;
|
||||
}
|
||||
|
||||
return UnDefType.UNDEF;
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_08;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_08_01 extends A5_08 {
|
||||
|
||||
public A5_08_01(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_08;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_08_01_FXBH extends A5_08 {
|
||||
|
||||
public A5_08_01_FXBH(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_08;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_08_02 extends A5_08 {
|
||||
|
||||
public A5_08_02(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_08;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_08_03 extends A5_08 {
|
||||
|
||||
public A5_08_03(ERP1Message packet) {
|
||||
|
@ -16,6 +16,8 @@ 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.eep.Base._4BSMessage;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
import org.openhab.core.config.core.Configuration;
|
||||
@ -31,6 +33,7 @@ import org.openhab.core.types.UnDefType;
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public abstract class A5_10 extends _4BSMessage {
|
||||
|
||||
public A5_10(ERP1Message packet) {
|
||||
@ -39,31 +42,30 @@ public abstract class A5_10 extends _4BSMessage {
|
||||
|
||||
@Override
|
||||
protected State convertToStateImpl(String channelId, String channelTypeId,
|
||||
Function<String, State> getCurrentStateFunc, Configuration config) {
|
||||
|
||||
Function<String, @Nullable State> getCurrentStateFunc, Configuration config) {
|
||||
switch (channelId) {
|
||||
case CHANNEL_FANSPEEDSTAGE:
|
||||
if (getDB_3Value() > 209) {
|
||||
if (getDB3Value() > 209) {
|
||||
return new StringType("-1");
|
||||
} else if (getDB_3Value() > 189) {
|
||||
} else if (getDB3Value() > 189) {
|
||||
return new StringType("0");
|
||||
} else if (getDB_3Value() > 164) {
|
||||
} else if (getDB3Value() > 164) {
|
||||
return new StringType("1");
|
||||
} else if (getDB_3Value() > 144) {
|
||||
} else if (getDB3Value() > 144) {
|
||||
return new StringType("2");
|
||||
} else {
|
||||
return new StringType("3");
|
||||
}
|
||||
|
||||
case CHANNEL_SETPOINT:
|
||||
return new DecimalType(getDB_2Value());
|
||||
return new DecimalType(getDB2Value());
|
||||
|
||||
case CHANNEL_TEMPERATURE:
|
||||
double temp = (getDB_1Value() - 255) / -6.375;
|
||||
double temp = (getDB1Value() - 255) / -6.375;
|
||||
return new QuantityType<>(temp, SIUnits.CELSIUS);
|
||||
|
||||
case CHANNEL_OCCUPANCY:
|
||||
return getBit(getDB_0(), 0) ? OnOffType.OFF : OnOffType.ON;
|
||||
return getBit(getDB0(), 0) ? OnOffType.OFF : OnOffType.ON;
|
||||
}
|
||||
|
||||
return UnDefType.UNDEF;
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_01 extends A5_10 {
|
||||
|
||||
public A5_10_01(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_02 extends A5_10 {
|
||||
|
||||
public A5_10_02(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_03 extends A5_10 {
|
||||
|
||||
public A5_10_03(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_04 extends A5_10 {
|
||||
|
||||
public A5_10_04(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_05 extends A5_10 {
|
||||
|
||||
public A5_10_05(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_06 extends A5_10 {
|
||||
|
||||
public A5_10_06(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_07 extends A5_10 {
|
||||
|
||||
public A5_10_07(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_08 extends A5_10 {
|
||||
|
||||
public A5_10_08(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_09 extends A5_10 {
|
||||
|
||||
public A5_10_09(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_0A extends A5_10 {
|
||||
|
||||
public A5_10_0A(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_0B extends A5_10 {
|
||||
|
||||
public A5_10_0B(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_0C extends A5_10 {
|
||||
|
||||
public A5_10_0C(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_0D extends A5_10 {
|
||||
|
||||
public A5_10_0D(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_10 extends A5_10 {
|
||||
|
||||
public A5_10_10(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_11 extends A5_10 {
|
||||
|
||||
public A5_10_11(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_12 extends A5_10 {
|
||||
|
||||
public A5_10_12(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_13 extends A5_10 {
|
||||
|
||||
public A5_10_13(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_14 extends A5_10 {
|
||||
|
||||
public A5_10_14(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_15 extends A5_10 {
|
||||
|
||||
public A5_10_15(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_16 extends A5_10 {
|
||||
|
||||
public A5_10_16(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_17 extends A5_10 {
|
||||
|
||||
public A5_10_17(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_18 extends A5_10 {
|
||||
|
||||
public A5_10_18(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_19 extends A5_10 {
|
||||
|
||||
public A5_10_19(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_1A extends A5_10 {
|
||||
|
||||
public A5_10_1A(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_1B extends A5_10 {
|
||||
|
||||
public A5_10_1B(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_1C extends A5_10 {
|
||||
|
||||
public A5_10_1C(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_1D extends A5_10 {
|
||||
|
||||
public A5_10_1D(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_1E extends A5_10 {
|
||||
|
||||
public A5_10_1E(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_1F extends A5_10 {
|
||||
|
||||
public A5_10_1F(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_20 extends A5_10 {
|
||||
|
||||
public A5_10_20(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_21 extends A5_10 {
|
||||
|
||||
public A5_10_21(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_22 extends A5_10 {
|
||||
|
||||
public A5_10_22(ERP1Message packet) {
|
||||
|
@ -12,12 +12,14 @@
|
||||
*/
|
||||
package org.openhab.binding.enocean.internal.eep.A5_10;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Weber - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_10_23 extends A5_10 {
|
||||
|
||||
public A5_10_23(ERP1Message packet) {
|
||||
|
@ -16,6 +16,8 @@ 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.eep.Base._4BSMessage;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
import org.openhab.core.config.core.Configuration;
|
||||
@ -29,6 +31,7 @@ import org.openhab.core.types.UnDefType;
|
||||
*
|
||||
* @author Dominik Krickl-Vorreiter - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class A5_11_03 extends _4BSMessage {
|
||||
|
||||
public A5_11_03(ERP1Message packet) {
|
||||
@ -36,7 +39,7 @@ public class A5_11_03 extends _4BSMessage {
|
||||
}
|
||||
|
||||
protected boolean isErrorState() {
|
||||
byte db1 = getDB_1();
|
||||
byte db1 = getDB1();
|
||||
|
||||
int state = (db1 >> 4) & 0x03;
|
||||
|
||||
@ -45,14 +48,14 @@ public class A5_11_03 extends _4BSMessage {
|
||||
}
|
||||
|
||||
protected State getPositionData() {
|
||||
byte db1 = getDB_1();
|
||||
byte db1 = getDB1();
|
||||
boolean pvf = getBit(db1, 7);
|
||||
|
||||
if (pvf) {
|
||||
byte db0 = getDB_0();
|
||||
byte db0 = getDB0();
|
||||
|
||||
boolean motp = getBit(db0, 6);
|
||||
int bsp = getDB_3Value();
|
||||
int bsp = getDB3Value();
|
||||
|
||||
if ((bsp >= 0) && (bsp <= 100)) {
|
||||
return new PercentType(motp ? 100 - bsp : bsp);
|
||||
@ -63,11 +66,11 @@ public class A5_11_03 extends _4BSMessage {
|
||||
}
|
||||
|
||||
protected State getAngleData() {
|
||||
byte db1 = getDB_1();
|
||||
byte db1 = getDB1();
|
||||
boolean avf = getBit(db1, 6);
|
||||
|
||||
if (avf) {
|
||||
byte db2 = getDB_2();
|
||||
byte db2 = getDB2();
|
||||
|
||||
boolean as = getBit(db2, 7);
|
||||
int an = (db2 & 0x7F) * 2;
|
||||
@ -82,7 +85,7 @@ public class A5_11_03 extends _4BSMessage {
|
||||
|
||||
@Override
|
||||
protected State convertToStateImpl(String channelId, String channelTypeId,
|
||||
Function<String, State> getCurrentStateFunc, Configuration config) {
|
||||
Function<String, @Nullable State> getCurrentStateFunc, Configuration config) {
|
||||
if (isErrorState()) {
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
|
@ -16,6 +16,8 @@ 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.eep.Base._4BSMessage;
|
||||
import org.openhab.binding.enocean.internal.eep.EEPHelper;
|
||||
import org.openhab.binding.enocean.internal.messages.ERP1Message;
|
||||
@ -35,7 +37,7 @@ import org.slf4j.LoggerFactory;
|
||||
*
|
||||
* @author Vincent Bakker - Initial contribution
|
||||
*/
|
||||
|
||||
@NonNullByDefault
|
||||
public class A5_11_04 extends _4BSMessage {
|
||||
|
||||
private enum Error {
|
||||
@ -64,14 +66,14 @@ public class A5_11_04 extends _4BSMessage {
|
||||
NOT_SUPPORTED
|
||||
}
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(A5_11_04.class);
|
||||
private Logger logger = LoggerFactory.getLogger(A5_11_04.class);
|
||||
|
||||
public A5_11_04(ERP1Message packet) {
|
||||
super(packet);
|
||||
}
|
||||
|
||||
protected boolean isErrorState() {
|
||||
byte db0 = getDB_0();
|
||||
byte db0 = getDB0();
|
||||
|
||||
int state = (db0 >> 4) & 0x03;
|
||||
|
||||
@ -85,12 +87,12 @@ public class A5_11_04 extends _4BSMessage {
|
||||
}
|
||||
|
||||
protected ParameterMode getParameterMode() {
|
||||
int pm = (getDB_0() >> 1) & 0x03;
|
||||
int pm = (getDB0() >> 1) & 0x03;
|
||||
return ParameterMode.values()[pm];
|
||||
}
|
||||
|
||||
protected EnergyUnit getEnergyUnit() {
|
||||
int unit = getDB_1();
|
||||
int unit = getDB1();
|
||||
if (unit < 8) {
|
||||
return EnergyUnit.values()[unit];
|
||||
}
|
||||
@ -99,7 +101,7 @@ public class A5_11_04 extends _4BSMessage {
|
||||
}
|
||||
|
||||
protected State getLightingStatus() {
|
||||
byte db0 = getDB_0();
|
||||
byte db0 = getDB0();
|
||||
boolean lightOn = getBit(db0, 0);
|
||||
|
||||
return lightOn ? OnOffType.ON : OnOffType.OFF;
|
||||
@ -107,7 +109,7 @@ public class A5_11_04 extends _4BSMessage {
|
||||
|
||||
protected State getDimmerStatus() {
|
||||
if (getParameterMode() == ParameterMode.EIGHT_BIT_DIMMER_VALUE_AND_LAMP_OPERATING_HOURS) {
|
||||
return new PercentType(getDB_3Value() * 100 / 255);
|
||||
return new PercentType(getDB3Value() * 100 / 255);
|
||||
}
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
@ -134,7 +136,7 @@ public class A5_11_04 extends _4BSMessage {
|
||||
}
|
||||
|
||||
return new QuantityType<>(
|
||||
Long.parseLong(HexUtils.bytesToHex(new byte[] { getDB_3(), getDB_2() }), 16) * factor,
|
||||
Long.parseLong(HexUtils.bytesToHex(new byte[] { getDB3(), getDB2() }), 16) * factor,
|
||||
Units.KILOWATT_HOUR);
|
||||
}
|
||||
|
||||
@ -163,7 +165,7 @@ public class A5_11_04 extends _4BSMessage {
|
||||
}
|
||||
|
||||
return new QuantityType<>(
|
||||
Long.parseLong(HexUtils.bytesToHex(new byte[] { getDB_3(), getDB_2() }), 16) * factor, Units.WATT);
|
||||
Long.parseLong(HexUtils.bytesToHex(new byte[] { getDB3(), getDB2() }), 16) * factor, Units.WATT);
|
||||
}
|
||||
|
||||
return UnDefType.UNDEF;
|
||||
@ -171,7 +173,7 @@ public class A5_11_04 extends _4BSMessage {
|
||||
|
||||
protected State getOperatingHours() {
|
||||
if (getParameterMode() == ParameterMode.EIGHT_BIT_DIMMER_VALUE_AND_LAMP_OPERATING_HOURS) {
|
||||
return new DecimalType(getDB_2Value() << 8 + getDB_1Value());
|
||||
return new DecimalType(getDB2Value() << 8 + getDB1Value());
|
||||
}
|
||||
|
||||
return UnDefType.UNDEF;
|
||||
@ -179,7 +181,7 @@ public class A5_11_04 extends _4BSMessage {
|
||||
|
||||
@Override
|
||||
protected State convertToStateImpl(String channelId, String channelTypeId,
|
||||
Function<String, State> getCurrentStateFunc, Configuration config) {
|
||||
Function<String, @Nullable State> getCurrentStateFunc, Configuration config) {
|
||||
if (isErrorState()) {
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
|
@ -16,6 +16,8 @@ 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.config.EnOceanChannelTariffInfoConfig;
|
||||
import org.openhab.binding.enocean.internal.eep.Base._4BSMessage;
|
||||
import org.openhab.binding.enocean.internal.eep.EEPHelper;
|
||||
@ -31,6 +33,7 @@ import org.openhab.core.util.HexUtils;
|
||||
*
|
||||
* @author Dominik Krickl-Vorreiter - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public abstract class A5_12 extends _4BSMessage {
|
||||
public A5_12(ERP1Message packet) {
|
||||
super(packet);
|
||||
@ -45,7 +48,7 @@ public abstract class A5_12 extends _4BSMessage {
|
||||
}
|
||||
|
||||
protected State getCumulativeValue() {
|
||||
byte db0 = getDB_0();
|
||||
byte db0 = getDB0();
|
||||
boolean dt = getBit(db0, 2);
|
||||
|
||||
if (!dt) {
|
||||
@ -70,8 +73,8 @@ public abstract class A5_12 extends _4BSMessage {
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
|
||||
float cumulativeValue = Long.parseLong(HexUtils.bytesToHex(new byte[] { getDB_3(), getDB_2(), getDB_1() }),
|
||||
16) * factor;
|
||||
float cumulativeValue = Long.parseLong(HexUtils.bytesToHex(new byte[] { getDB3(), getDB2(), getDB1() }), 16)
|
||||
* factor;
|
||||
return calcCumulativeValue(cumulativeValue);
|
||||
}
|
||||
|
||||
@ -79,7 +82,7 @@ public abstract class A5_12 extends _4BSMessage {
|
||||
}
|
||||
|
||||
protected State getCurrentValue() {
|
||||
byte db0 = getDB_0();
|
||||
byte db0 = getDB0();
|
||||
boolean dt = getBit(db0, 2);
|
||||
|
||||
if (dt) {
|
||||
@ -104,7 +107,7 @@ public abstract class A5_12 extends _4BSMessage {
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
|
||||
float currentValue = Long.parseLong(HexUtils.bytesToHex(new byte[] { getDB_3(), getDB_2(), getDB_1() }), 16)
|
||||
float currentValue = Long.parseLong(HexUtils.bytesToHex(new byte[] { getDB3(), getDB2(), getDB1() }), 16)
|
||||
* factor;
|
||||
|
||||
return calcCurrentValue(currentValue);
|
||||
@ -114,13 +117,12 @@ public abstract class A5_12 extends _4BSMessage {
|
||||
}
|
||||
|
||||
protected int getTariffInfo() {
|
||||
return ((getDB_0() >>> 4) & 0xff);
|
||||
return ((getDB0() >>> 4) & 0xff);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected State convertToStateImpl(String channelId, String channelTypeId,
|
||||
Function<String, State> getCurrentStateFunc, Configuration config) {
|
||||
|
||||
Function<String, @Nullable State> getCurrentStateFunc, Configuration config) {
|
||||
EnOceanChannelTariffInfoConfig c = config.as(EnOceanChannelTariffInfoConfig.class);
|
||||
if (c.tariff != getTariffInfo()) {
|
||||
return UnDefType.UNDEF;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user