Search in sources :

Example 1 with EnoceanParameterAddress

use of org.opencean.core.address.EnoceanParameterAddress in project openhab1-addons by openhab.

the class WindowHandleTest method setUpDefaultDevice.

@Before
public void setUpDefaultDevice() {
    parameterAddress = new EnoceanParameterAddress(EnoceanId.fromString(EnoceanBindingProviderMock.DEVICE_ID));
    provider.setParameterAddress(parameterAddress);
    provider.setItem(new StringItem("dummie"));
    provider.setEep(EEPId.EEP_F6_10_00);
    binding.addBindingProvider(provider);
}
Also used : EnoceanParameterAddress(org.opencean.core.address.EnoceanParameterAddress) StringItem(org.openhab.core.library.items.StringItem) Before(org.junit.Before)

Example 2 with EnoceanParameterAddress

use of org.opencean.core.address.EnoceanParameterAddress in project openhab1-addons by openhab.

the class EnoceanGenericBindingProviderTest method testGetParameterAddress.

@Test
public void testGetParameterAddress() throws BindingConfigParseException {
    EnoceanGenericBindingProvider provider = new EnoceanGenericBindingProvider();
    provider.processBindingConfiguration("enocean", new TestItem("item"), "{id=00:8B:62:43, eep=F6:02:01, channel=B, parameter=I_PRESSED}");
    assertEquals(new EnoceanParameterAddress(EnoceanId.fromString("00:8B:62:43"), "B", "I_PRESSED"), provider.getParameterAddress("item"));
}
Also used : EnoceanParameterAddress(org.opencean.core.address.EnoceanParameterAddress) Test(org.junit.Test)

Example 3 with EnoceanParameterAddress

use of org.opencean.core.address.EnoceanParameterAddress in project openhab1-addons by openhab.

the class EnoceanBinding method queryAndSendActualState.

private void queryAndSendActualState(EnoceanBindingProvider provider, String itemName) {
    EnoceanParameterAddress parameterAddress = provider.getParameterAddress(itemName);
    Item item = provider.getItem(itemName);
    if (item == null) {
        logger.warn("No item found for " + parameterAddress + " - doing nothing.");
        return;
    }
    State value = getValueFromDevice(parameterAddress, item);
    if (value != null) {
        eventPublisher.postUpdate(itemName, value);
    }
}
Also used : DimmerItem(org.openhab.core.library.items.DimmerItem) SwitchItem(org.openhab.core.library.items.SwitchItem) RollershutterItem(org.openhab.core.library.items.RollershutterItem) Item(org.openhab.core.items.Item) StringItem(org.openhab.core.library.items.StringItem) EnoceanParameterAddress(org.opencean.core.address.EnoceanParameterAddress) State(org.openhab.core.types.State)

Example 4 with EnoceanParameterAddress

use of org.opencean.core.address.EnoceanParameterAddress in project openhab1-addons by openhab.

the class RockerSwitchInDimmerSteppingProfileTest method increaseLightBy30OnShortButtonPressDown.

@Test
public void increaseLightBy30OnShortButtonPressDown() {
    EnoceanParameterAddress valueParameterAddress = new EnoceanParameterAddress(EnoceanId.fromString(EnoceanBindingProviderMock.DEVICE_ID), CHANNEL, Parameter.I);
    binding.valueChanged(valueParameterAddress, ButtonState.PRESSED);
    waitFor(10);
    assertEquals("Update State", null, publisher.popLastCommand());
    binding.valueChanged(valueParameterAddress, ButtonState.RELEASED);
    waitFor(10);
    assertEquals("Update State", new DecimalType(30), publisher.popLastCommand());
}
Also used : EnoceanParameterAddress(org.opencean.core.address.EnoceanParameterAddress) DecimalType(org.openhab.core.library.types.DecimalType) Test(org.junit.Test)

Example 5 with EnoceanParameterAddress

use of org.opencean.core.address.EnoceanParameterAddress in project openhab1-addons by openhab.

the class RockerSwitchInDimmerSteppingProfileTest method switchOffLightOnShortButtonPressUp.

@Test
public void switchOffLightOnShortButtonPressUp() {
    EnoceanParameterAddress valueParameterAddress = new EnoceanParameterAddress(EnoceanId.fromString(EnoceanBindingProviderMock.DEVICE_ID), CHANNEL, Parameter.O);
    binding.valueChanged(valueParameterAddress, ButtonState.PRESSED);
    waitFor(10);
    assertEquals("Update State", IncreaseDecreaseType.DECREASE, publisher.popLastCommand());
    binding.valueChanged(valueParameterAddress, ButtonState.RELEASED);
    waitFor(10);
    assertEquals("Update State", OnOffType.OFF, publisher.popLastCommand());
}
Also used : EnoceanParameterAddress(org.opencean.core.address.EnoceanParameterAddress) Test(org.junit.Test)

Aggregations

EnoceanParameterAddress (org.opencean.core.address.EnoceanParameterAddress)39 Test (org.junit.Test)31 Before (org.junit.Before)6 DimmerItem (org.openhab.core.library.items.DimmerItem)5 SwitchItem (org.openhab.core.library.items.SwitchItem)4 RollershutterItem (org.openhab.core.library.items.RollershutterItem)3 StringItem (org.openhab.core.library.items.StringItem)3 Item (org.openhab.core.items.Item)2 DecimalType (org.openhab.core.library.types.DecimalType)2 NoSuchPortException (gnu.io.NoSuchPortException)1 BigDecimal (java.math.BigDecimal)1 EEPId (org.opencean.core.common.EEPId)1 NumberWithUnit (org.opencean.core.common.values.NumberWithUnit)1 DimmerOnOffProfile (org.openhab.binding.enocean.internal.profiles.DimmerOnOffProfile)1 Profile (org.openhab.binding.enocean.internal.profiles.Profile)1 RollershutterProfile (org.openhab.binding.enocean.internal.profiles.RollershutterProfile)1 StandardProfile (org.openhab.binding.enocean.internal.profiles.StandardProfile)1 SwitchOnOffProfile (org.openhab.binding.enocean.internal.profiles.SwitchOnOffProfile)1 WindowHandleProfile (org.openhab.binding.enocean.internal.profiles.WindowHandleProfile)1 EventPublisher (org.openhab.core.events.EventPublisher)1