mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-25 14:55:55 +01:00
[enocean] D2-50 EEP remove extra channels and fix warnings (#17531)
* [enocean] EEP D2_50 - remove unsupported channels Signed-off-by: Zhivka Dimova <zhivka.dimova@myforest.net> Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
parent
406c202801
commit
830886f7f0
@ -16,7 +16,6 @@ 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;
|
||||
@ -85,7 +84,7 @@ public class EnOceanDeviceDiscoveryService extends AbstractDiscoveryService impl
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<@NonNull ThingTypeUID> getSupportedThingTypes() {
|
||||
public Set<ThingTypeUID> getSupportedThingTypes() {
|
||||
return SUPPORTED_DEVICE_THING_TYPES_UIDS;
|
||||
}
|
||||
|
||||
@ -155,26 +154,24 @@ public class EnOceanDeviceDiscoveryService extends AbstractDiscoveryService impl
|
||||
|
||||
SMACKTeachInResponse response = EEPFactory.buildResponseFromSMACKTeachIn(event,
|
||||
bridgeHandler.sendTeachOuts());
|
||||
if (response != null) {
|
||||
bridgeHandler.sendMessage(response, null);
|
||||
bridgeHandler.sendMessage(response, null);
|
||||
|
||||
if (response.isTeachIn()) {
|
||||
// SenderIdOffset will be determined during Thing init
|
||||
createDiscoveryResult(eep, false, -1);
|
||||
} else if (response.isTeachOut()) {
|
||||
// disable already teached in thing
|
||||
bridgeHandler.getThing().getThings().stream()
|
||||
.filter(t -> t.getConfiguration().getProperties()
|
||||
.getOrDefault(PARAMETER_ENOCEANID, EMPTYENOCEANID).toString()
|
||||
.equals(HexUtils.bytesToHex(eep.getSenderId())))
|
||||
.findFirst().ifPresentOrElse(t -> {
|
||||
thingManager.setEnabled(t.getUID(), false);
|
||||
logger.info("Disable thing with id {}", t.getUID());
|
||||
}, () -> {
|
||||
logger.info("Thing for EnOceanId {} already deleted",
|
||||
HexUtils.bytesToHex(eep.getSenderId()));
|
||||
});
|
||||
}
|
||||
if (response.isTeachIn()) {
|
||||
// SenderIdOffset will be determined during Thing init
|
||||
createDiscoveryResult(eep, false, -1);
|
||||
} else if (response.isTeachOut()) {
|
||||
// disable already teached in thing
|
||||
bridgeHandler.getThing().getThings().stream()
|
||||
.filter(t -> t.getConfiguration().getProperties()
|
||||
.getOrDefault(PARAMETER_ENOCEANID, EMPTYENOCEANID).toString()
|
||||
.equals(HexUtils.bytesToHex(eep.getSenderId())))
|
||||
.findFirst().ifPresentOrElse(t -> {
|
||||
thingManager.setEnabled(t.getUID(), false);
|
||||
logger.info("Disable thing with id {}", t.getUID());
|
||||
}, () -> {
|
||||
logger.info("Thing for EnOceanId {} already deleted",
|
||||
HexUtils.bytesToHex(eep.getSenderId()));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public class A5_3F_7F_EltakoFSB extends _4BSMessage {
|
||||
setData(ZERO, (byte) shutTime, MOVE_UP, TEACHIN_BIT); // => move completely up
|
||||
} else if (percentCommand.intValue() == PercentType.HUNDRED.intValue()) {
|
||||
setData(ZERO, (byte) shutTime, MOVE_DOWN, TEACHIN_BIT); // => move completely down
|
||||
} else if (channelState != null) {
|
||||
} else {
|
||||
PercentType current = channelState.as(PercentType.class);
|
||||
if (current != null) {
|
||||
if (current.intValue() != percentCommand.intValue()) {
|
||||
|
@ -51,9 +51,6 @@ public class EEPFactory {
|
||||
public static EEP createEEP(EEPType eepType) {
|
||||
try {
|
||||
Class<? extends EEP> cl = eepType.getEEPClass();
|
||||
if (cl == null) {
|
||||
throw new IllegalArgumentException("Message " + eepType + " not implemented");
|
||||
}
|
||||
return cl.getDeclaredConstructor().newInstance();
|
||||
} catch (IllegalAccessException | InstantiationException | IllegalArgumentException | InvocationTargetException
|
||||
| NoSuchMethodException | SecurityException e) {
|
||||
@ -64,9 +61,6 @@ public class EEPFactory {
|
||||
public static EEP buildEEP(EEPType eepType, ERP1Message packet) {
|
||||
try {
|
||||
Class<? extends EEP> cl = eepType.getEEPClass();
|
||||
if (cl == null) {
|
||||
throw new IllegalArgumentException("Message " + eepType + " not implemented");
|
||||
}
|
||||
return cl.getConstructor(ERP1Message.class).newInstance(packet);
|
||||
} catch (IllegalAccessException | InstantiationException | IllegalArgumentException | InvocationTargetException
|
||||
| NoSuchMethodException | SecurityException e) {
|
||||
@ -238,7 +232,7 @@ public class EEPFactory {
|
||||
eepType = getGenericEEPTypeFor(rorg);
|
||||
}
|
||||
|
||||
return (eepType == null) ? null : createEEP(eepType).setSenderId(senderId);
|
||||
return eepType == null ? null : createEEP(eepType).setSenderId(senderId);
|
||||
}
|
||||
|
||||
public static @Nullable EEP buildResponseEEPFromTeachInERP1(ERP1Message msg, byte[] senderId, boolean teachIn) {
|
||||
|
@ -507,40 +507,34 @@ public enum EEPType {
|
||||
CHANNEL_INDOORAIRANALYSIS),
|
||||
|
||||
HeatRecoveryVentilation_00(RORG.VLD, 0x50, 0x00, false, D2_50.class, THING_TYPE_HEATRECOVERYVENTILATION,
|
||||
CHANNEL_VENTILATIONOPERATIONMODE, CHANNEL_SUPPLYAIRFLAPSTATUS, CHANNEL_WEEKLYTIMERPROGRAMSTATUS,
|
||||
CHANNEL_EXHAUSTAIRFLAPSTATUS, CHANNEL_DEFROSTMODE, CHANNEL_COOLINGPROTECTIONMODE,
|
||||
CHANNEL_OUTDOORAIRHEATERSTATUS, CHANNEL_SUPPLYAIRHEATERSTATUS, CHANNEL_DRAINHEATERSTATUS,
|
||||
CHANNEL_TIMEROPERATIONMODE, CHANNEL_MAINTENANCESTATUS, CHANNEL_ROOMTEMPERATURECONTROLSTATUS,
|
||||
CHANNEL_AIRQUALITYVALUE1, CHANNEL_AIRQUALITYVALUE2, CHANNEL_OUTDOORAIRTEMPERATURE,
|
||||
CHANNEL_SUPPLYAIRTEMPERATURE, CHANNEL_INDOORAIRTEMPERATURE, CHANNEL_EXHAUSTAIRTEMPERATURE,
|
||||
CHANNEL_SUPPLYAIRFANAIRFLOWRATE, CHANNEL_EXHAUSTAIRFANAIRFLOWRATE, CHANNEL_SUPPLYFANSPEED,
|
||||
CHANNEL_EXHAUSTFANSPEED),
|
||||
CHANNEL_VENTILATIONOPERATIONMODE, CHANNEL_SUPPLYAIRFLAPSTATUS, CHANNEL_EXHAUSTAIRFLAPSTATUS,
|
||||
CHANNEL_DEFROSTMODE, CHANNEL_COOLINGPROTECTIONMODE, CHANNEL_DRAINHEATERSTATUS, CHANNEL_TIMEROPERATIONMODE,
|
||||
CHANNEL_MAINTENANCESTATUS, CHANNEL_AIRQUALITYVALUE1, CHANNEL_OUTDOORAIRTEMPERATURE,
|
||||
CHANNEL_SUPPLYAIRTEMPERATURE, CHANNEL_SUPPLYAIRFANAIRFLOWRATE, CHANNEL_EXHAUSTAIRFANAIRFLOWRATE,
|
||||
CHANNEL_SUPPLYFANSPEED, CHANNEL_EXHAUSTFANSPEED),
|
||||
HeatRecoveryVentilation_01(RORG.VLD, 0x50, 0x01, false, D2_50.class, THING_TYPE_HEATRECOVERYVENTILATION,
|
||||
CHANNEL_VENTILATIONOPERATIONMODE, CHANNEL_SUPPLYAIRFLAPSTATUS, CHANNEL_WEEKLYTIMERPROGRAMSTATUS,
|
||||
CHANNEL_EXHAUSTAIRFLAPSTATUS, CHANNEL_DEFROSTMODE, CHANNEL_COOLINGPROTECTIONMODE,
|
||||
CHANNEL_OUTDOORAIRHEATERSTATUS, CHANNEL_SUPPLYAIRHEATERSTATUS, CHANNEL_DRAINHEATERSTATUS,
|
||||
CHANNEL_TIMEROPERATIONMODE, CHANNEL_MAINTENANCESTATUS, CHANNEL_ROOMTEMPERATURECONTROLSTATUS,
|
||||
CHANNEL_AIRQUALITYVALUE1, CHANNEL_AIRQUALITYVALUE2, CHANNEL_OUTDOORAIRTEMPERATURE,
|
||||
CHANNEL_SUPPLYAIRTEMPERATURE, CHANNEL_INDOORAIRTEMPERATURE, CHANNEL_EXHAUSTAIRTEMPERATURE,
|
||||
CHANNEL_SUPPLYAIRFANAIRFLOWRATE, CHANNEL_EXHAUSTAIRFANAIRFLOWRATE, CHANNEL_SUPPLYFANSPEED,
|
||||
CHANNEL_EXHAUSTFANSPEED),
|
||||
CHANNEL_VENTILATIONOPERATIONMODE, CHANNEL_SUPPLYAIRFLAPSTATUS, CHANNEL_EXHAUSTAIRFLAPSTATUS,
|
||||
CHANNEL_DEFROSTMODE, CHANNEL_COOLINGPROTECTIONMODE, CHANNEL_OUTDOORAIRHEATERSTATUS,
|
||||
CHANNEL_SUPPLYAIRHEATERSTATUS, CHANNEL_DRAINHEATERSTATUS, CHANNEL_TIMEROPERATIONMODE,
|
||||
CHANNEL_MAINTENANCESTATUS, CHANNEL_AIRQUALITYVALUE1, CHANNEL_OUTDOORAIRTEMPERATURE,
|
||||
CHANNEL_SUPPLYAIRTEMPERATURE, CHANNEL_SUPPLYAIRFANAIRFLOWRATE, CHANNEL_EXHAUSTAIRFANAIRFLOWRATE,
|
||||
CHANNEL_SUPPLYFANSPEED, CHANNEL_EXHAUSTFANSPEED),
|
||||
HeatRecoveryVentilation_10(RORG.VLD, 0x50, 0x10, false, D2_50.class, THING_TYPE_HEATRECOVERYVENTILATION,
|
||||
CHANNEL_VENTILATIONOPERATIONMODE, CHANNEL_DEFROSTMODE, CHANNEL_COOLINGPROTECTIONMODE,
|
||||
CHANNEL_OUTDOORAIRHEATERSTATUS, CHANNEL_SUPPLYAIRHEATERSTATUS, CHANNEL_DRAINHEATERSTATUS,
|
||||
CHANNEL_TIMEROPERATIONMODE, CHANNEL_MAINTENANCESTATUS, CHANNEL_ROOMTEMPERATURECONTROLSTATUS,
|
||||
CHANNEL_AIRQUALITYVALUE1, CHANNEL_AIRQUALITYVALUE2, CHANNEL_OUTDOORAIRTEMPERATURE,
|
||||
CHANNEL_SUPPLYAIRTEMPERATURE, CHANNEL_INDOORAIRTEMPERATURE, CHANNEL_EXHAUSTAIRTEMPERATURE,
|
||||
CHANNEL_SUPPLYAIRFANAIRFLOWRATE, CHANNEL_EXHAUSTAIRFANAIRFLOWRATE, CHANNEL_SUPPLYFANSPEED,
|
||||
CHANNEL_EXHAUSTFANSPEED, CHANNEL_WEEKLYTIMERPROGRAMSTATUS),
|
||||
CHANNEL_OUTDOORAIRHEATERSTATUS, CHANNEL_SUPPLYAIRHEATERSTATUS, CHANNEL_TIMEROPERATIONMODE,
|
||||
CHANNEL_MAINTENANCESTATUS, CHANNEL_ROOMTEMPERATURECONTROLSTATUS, CHANNEL_AIRQUALITYVALUE1,
|
||||
CHANNEL_AIRQUALITYVALUE2, CHANNEL_OUTDOORAIRTEMPERATURE, CHANNEL_SUPPLYAIRTEMPERATURE,
|
||||
CHANNEL_INDOORAIRTEMPERATURE, CHANNEL_EXHAUSTAIRTEMPERATURE, CHANNEL_SUPPLYAIRFANAIRFLOWRATE,
|
||||
CHANNEL_EXHAUSTAIRFANAIRFLOWRATE, CHANNEL_SUPPLYFANSPEED, CHANNEL_EXHAUSTFANSPEED,
|
||||
CHANNEL_WEEKLYTIMERPROGRAMSTATUS),
|
||||
HeatRecoveryVentilation_11(RORG.VLD, 0x50, 0x11, false, D2_50.class, THING_TYPE_HEATRECOVERYVENTILATION,
|
||||
CHANNEL_VENTILATIONOPERATIONMODE, CHANNEL_FIREPLACESAFETYMODE, CHANNEL_HEATEXCHANGERBYPASSSTATUS,
|
||||
CHANNEL_DEFROSTMODE, CHANNEL_COOLINGPROTECTIONMODE, CHANNEL_OUTDOORAIRHEATERSTATUS,
|
||||
CHANNEL_WEEKLYTIMERPROGRAMSTATUS, CHANNEL_SUPPLYAIRHEATERSTATUS, CHANNEL_DRAINHEATERSTATUS,
|
||||
CHANNEL_TIMEROPERATIONMODE, CHANNEL_MAINTENANCESTATUS, CHANNEL_ROOMTEMPERATURECONTROLSTATUS,
|
||||
CHANNEL_AIRQUALITYVALUE1, CHANNEL_AIRQUALITYVALUE2, CHANNEL_OUTDOORAIRTEMPERATURE,
|
||||
CHANNEL_SUPPLYAIRTEMPERATURE, CHANNEL_INDOORAIRTEMPERATURE, CHANNEL_EXHAUSTAIRTEMPERATURE,
|
||||
CHANNEL_SUPPLYAIRFANAIRFLOWRATE, CHANNEL_EXHAUSTAIRFANAIRFLOWRATE, CHANNEL_SUPPLYFANSPEED,
|
||||
CHANNEL_EXHAUSTFANSPEED);
|
||||
CHANNEL_WEEKLYTIMERPROGRAMSTATUS, CHANNEL_SUPPLYAIRHEATERSTATUS, CHANNEL_TIMEROPERATIONMODE,
|
||||
CHANNEL_MAINTENANCESTATUS, CHANNEL_ROOMTEMPERATURECONTROLSTATUS, CHANNEL_AIRQUALITYVALUE1,
|
||||
CHANNEL_AIRQUALITYVALUE2, CHANNEL_OUTDOORAIRTEMPERATURE, CHANNEL_SUPPLYAIRTEMPERATURE,
|
||||
CHANNEL_INDOORAIRTEMPERATURE, CHANNEL_EXHAUSTAIRTEMPERATURE, CHANNEL_SUPPLYAIRFANAIRFLOWRATE,
|
||||
CHANNEL_EXHAUSTAIRFANAIRFLOWRATE, CHANNEL_SUPPLYFANSPEED, CHANNEL_EXHAUSTFANSPEED);
|
||||
|
||||
private RORG rorg;
|
||||
private int func;
|
||||
@ -750,12 +744,8 @@ public enum EEPType {
|
||||
}
|
||||
|
||||
public Configuration getChannelConfig(String channelId) {
|
||||
Configuration c = null;
|
||||
if (!channelIdsWithConfig.isEmpty()) {
|
||||
c = channelIdsWithConfig.get(channelId);
|
||||
if (c != null) {
|
||||
return c;
|
||||
}
|
||||
return channelIdsWithConfig.get(channelId);
|
||||
}
|
||||
return new Configuration();
|
||||
}
|
||||
|
@ -155,9 +155,6 @@ public class EnOceanBaseSensorHandler extends EnOceanBaseThingHandler implements
|
||||
ERP1Message msg = (ERP1Message) packet;
|
||||
|
||||
EEPType localReceivingType = receivingEEPTypes.get(msg.getRORG());
|
||||
if (localReceivingType == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
EEP eep = EEPFactory.buildEEP(localReceivingType, (ERP1Message) packet);
|
||||
logger.debug("ESP Packet payload {} for {} received", HexUtils.bytesToHex(packet.getPayload()),
|
||||
|
@ -448,7 +448,8 @@ public abstract class EnOceanTransceiver implements SerialPortEventListener {
|
||||
protected abstract byte[] serializePacket(BasePacket packet) throws EnOceanException;
|
||||
|
||||
public synchronized void addPacketListener(PacketListener listener, long senderIdToListenTo) {
|
||||
if (listeners.computeIfAbsent(senderIdToListenTo, k -> new HashSet<>()).add(listener)) {
|
||||
HashSet<PacketListener> lst = listeners.computeIfAbsent(senderIdToListenTo, k -> new HashSet<>());
|
||||
if (lst != null && lst.add(listener)) {
|
||||
logger.debug("Listener added: {}", senderIdToListenTo);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user