use of org.opencean.core.address.EnoceanParameterAddress in project openhab1-addons by openhab.
the class RockerSwitchInRollershutterProfileTest method stopShutterMovingUpOnShortPressDown.
@Test
public void stopShutterMovingUpOnShortPressDown() {
EnoceanParameterAddress valueParameterAddress = new EnoceanParameterAddress(EnoceanId.fromString(EnoceanBindingProviderMock.DEVICE_ID), Parameter.O);
binding.valueChanged(valueParameterAddress, ButtonState.PRESSED);
binding.valueChanged(valueParameterAddress, ButtonState.RELEASED);
publisher.popLastCommand();
waitFor(100);
valueParameterAddress = new EnoceanParameterAddress(EnoceanId.fromString(EnoceanBindingProviderMock.DEVICE_ID), Parameter.I);
binding.valueChanged(valueParameterAddress, ButtonState.PRESSED);
binding.valueChanged(valueParameterAddress, ButtonState.RELEASED);
assertEquals("Update State", StopMoveType.STOP, publisher.popLastCommand());
assertEquals("No new state expected", null, publisher.popLastCommand());
}
use of org.opencean.core.address.EnoceanParameterAddress in project openhab1-addons by openhab.
the class RockerSwitchInRollershutterProfileTest method closeShutterDuringLongButtonPressDown.
@Test
public void closeShutterDuringLongButtonPressDown() {
EnoceanParameterAddress valueParameterAddress = new EnoceanParameterAddress(EnoceanId.fromString(EnoceanBindingProviderMock.DEVICE_ID), Parameter.I);
binding.valueChanged(valueParameterAddress, ButtonState.PRESSED);
assertEquals("Update State", UpDownType.DOWN, publisher.popLastCommand());
waitFor(LONG_PRESS_DELAY);
binding.valueChanged(valueParameterAddress, ButtonState.RELEASED);
assertEquals("Update State", StopMoveType.STOP, publisher.popLastCommand());
assertEquals("No new state expected", null, publisher.popLastCommand());
}
use of org.opencean.core.address.EnoceanParameterAddress in project openhab1-addons by openhab.
the class RockerSwitchInSwitchOnOffProfileTest method switchOffForButtonPressDown.
@Test
public void switchOffForButtonPressDown() {
EnoceanParameterAddress valueParameterAddress = new EnoceanParameterAddress(EnoceanId.fromString(EnoceanBindingProviderMock.DEVICE_ID), CHANNEL, Parameter.O);
binding.valueChanged(valueParameterAddress, ButtonState.PRESSED);
assertEquals("Update State", OnOffType.OFF, publisher.popLastCommand());
}
use of org.opencean.core.address.EnoceanParameterAddress in project openhab1-addons by openhab.
the class EnoceanBinding method processEEPs.
private void processEEPs(EnoceanBindingProvider enoceanBindingProvider, String itemName) {
EnoceanParameterAddress parameterAddress = enoceanBindingProvider.getParameterAddress(itemName);
EEPId eep = enoceanBindingProvider.getEEP(itemName);
esp3Host.addDeviceProfile(parameterAddress.getEnoceanDeviceId(), eep);
Item item = enoceanBindingProvider.getItem(itemName);
if (profiles.containsKey(parameterAddress.getAsString())) {
Profile profile = profiles.get(parameterAddress.getAsString());
profile.removeItem(item);
}
Class<Profile> customProfileClass = enoceanBindingProvider.getCustomProfile(itemName);
if (customProfileClass != null) {
Constructor<Profile> constructor;
Profile profile;
try {
constructor = customProfileClass.getConstructor(Item.class, EventPublisher.class);
profile = constructor.newInstance(item, eventPublisher);
addProfile(item, parameterAddress, profile);
} catch (Exception e) {
logger.error("Could not create class for profile " + customProfileClass, e);
}
} else if (EEPId.EEP_F6_02_01.equals(eep) || EEPId.EEP_F6_10_00.equals(eep)) {
if (item.getClass().equals(RollershutterItem.class)) {
RollershutterProfile profile = new RollershutterProfile(item, eventPublisher);
addProfile(item, parameterAddress, profile);
}
if (item.getClass().equals(DimmerItem.class)) {
DimmerOnOffProfile profile = new DimmerOnOffProfile(item, eventPublisher);
addProfile(item, parameterAddress, profile);
}
if (item.getClass().equals(SwitchItem.class) && parameterAddress.getParameterId() == null) {
SwitchOnOffProfile profile = new SwitchOnOffProfile(item, eventPublisher);
addProfile(item, parameterAddress, profile);
}
if (item.getClass().equals(StringItem.class) && EEPId.EEP_F6_10_00.equals(eep)) {
WindowHandleProfile profile = new WindowHandleProfile(item, eventPublisher);
addProfile(item, parameterAddress, profile);
}
}
}
Aggregations