Search in sources :

Example 16 with HmDevice

use of org.eclipse.smarthome.binding.homematic.internal.model.HmDevice in project smarthome by eclipse.

the class HomematicDeviceDiscoveryServiceTest method testDiscoveryResultIsReportedForNewDevice.

@Test
public void testDiscoveryResultIsReportedForNewDevice() {
    SimpleDiscoveryListener discoveryListener = new SimpleDiscoveryListener();
    homematicDeviceDiscoveryService.addDiscoveryListener(discoveryListener);
    HmDevice hmDevice = createDimmerHmDevice();
    homematicDeviceDiscoveryService.deviceDiscovered(hmDevice);
    assertThat(discoveryListener.discoveredResults.size(), is(1));
    discoveryResultMatchesHmDevice(discoveryListener.discoveredResults.element(), hmDevice);
}
Also used : HmDevice(org.eclipse.smarthome.binding.homematic.internal.model.HmDevice) DimmerHelper.createDimmerHmDevice(org.eclipse.smarthome.binding.homematic.test.util.DimmerHelper.createDimmerHmDevice) SimpleDiscoveryListener(org.eclipse.smarthome.binding.homematic.test.util.SimpleDiscoveryListener) Test(org.junit.Test) JavaTest(org.eclipse.smarthome.test.java.JavaTest)

Example 17 with HmDevice

use of org.eclipse.smarthome.binding.homematic.internal.model.HmDevice in project smarthome by eclipse.

the class ButtonDatapointTest method createPressDatapoint.

private HmDatapoint createPressDatapoint(String channelName, Object value) {
    HmDatapoint pressDp = new HmDatapoint(channelName, "", HmValueType.ACTION, value, true, HmParamsetType.VALUES);
    HmChannel hmChannel = new HmChannel(channelName, 1);
    HmDevice device = new HmDevice("ABC12345", HmInterface.RF, "HM-MOCK", "mockid", "mockid", "mockfw");
    hmChannel.setDevice(device);
    device.addChannel(hmChannel);
    hmChannel.addDatapoint(pressDp);
    pressDp.setChannel(hmChannel);
    bvdpHandler.initialize(device);
    return pressDp;
}
Also used : HmDevice(org.eclipse.smarthome.binding.homematic.internal.model.HmDevice) HmChannel(org.eclipse.smarthome.binding.homematic.internal.model.HmChannel) HmDatapoint(org.eclipse.smarthome.binding.homematic.internal.model.HmDatapoint)

Example 18 with HmDevice

use of org.eclipse.smarthome.binding.homematic.internal.model.HmDevice in project smarthome by eclipse.

the class UidUtilsTest method testGeneratedThingTypeUIDHasExpectedFormatForHomegear.

@Test
public void testGeneratedThingTypeUIDHasExpectedFormatForHomegear() {
    HmDevice hmDevice = createDimmerHmDevice("HOMEGEAR");
    ThingTypeUID generatedThingTypeUID = UidUtils.generateThingTypeUID(hmDevice);
    assertThat(generatedThingTypeUID.getAsString(), is("homematic:HG-HM-LC-Dim1-Pl3"));
}
Also used : HmDevice(org.eclipse.smarthome.binding.homematic.internal.model.HmDevice) DimmerHelper.createDimmerHmDevice(org.eclipse.smarthome.binding.homematic.test.util.DimmerHelper.createDimmerHmDevice) ThingTypeUID(org.eclipse.smarthome.core.thing.ThingTypeUID) Test(org.junit.Test)

Example 19 with HmDevice

use of org.eclipse.smarthome.binding.homematic.internal.model.HmDevice in project smarthome by eclipse.

the class UidUtilsTest method testGeneratedThingTypeUIDHasExpectedFormat.

@Test
public void testGeneratedThingTypeUIDHasExpectedFormat() {
    HmDevice hmDevice = createDimmerHmDevice();
    ThingTypeUID generatedThingTypeUID = UidUtils.generateThingTypeUID(hmDevice);
    assertThat(generatedThingTypeUID.getAsString(), is("homematic:HM-LC-Dim1-Pl3"));
}
Also used : HmDevice(org.eclipse.smarthome.binding.homematic.internal.model.HmDevice) DimmerHelper.createDimmerHmDevice(org.eclipse.smarthome.binding.homematic.test.util.DimmerHelper.createDimmerHmDevice) ThingTypeUID(org.eclipse.smarthome.core.thing.ThingTypeUID) Test(org.junit.Test)

Example 20 with HmDevice

use of org.eclipse.smarthome.binding.homematic.internal.model.HmDevice in project smarthome by eclipse.

the class DimmerHelper method createDimmerHmDevice.

public static HmDevice createDimmerHmDevice(String gatewayType) {
    HmDevice hmDevice = new HmDevice("ABC12345678", null, "HM-LC-Dim1-Pl3", gatewayType, "", "1");
    hmDevice.setName("Homematic Dimmer");
    return hmDevice;
}
Also used : HmDevice(org.eclipse.smarthome.binding.homematic.internal.model.HmDevice)

Aggregations

HmDevice (org.eclipse.smarthome.binding.homematic.internal.model.HmDevice)20 HmChannel (org.eclipse.smarthome.binding.homematic.internal.model.HmChannel)9 HmDatapoint (org.eclipse.smarthome.binding.homematic.internal.model.HmDatapoint)7 HomematicClientException (org.eclipse.smarthome.binding.homematic.internal.misc.HomematicClientException)5 DimmerHelper.createDimmerHmDevice (org.eclipse.smarthome.binding.homematic.test.util.DimmerHelper.createDimmerHmDevice)4 IOException (java.io.IOException)3 HashMap (java.util.HashMap)3 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 HomematicGateway (org.eclipse.smarthome.binding.homematic.internal.communicator.HomematicGateway)2 HmDatapointConfig (org.eclipse.smarthome.binding.homematic.internal.model.HmDatapointConfig)2 HmDatapointInfo (org.eclipse.smarthome.binding.homematic.internal.model.HmDatapointInfo)2 HmInterface (org.eclipse.smarthome.binding.homematic.internal.model.HmInterface)2 ThingTypeUID (org.eclipse.smarthome.core.thing.ThingTypeUID)2 BigDecimal (java.math.BigDecimal)1 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 UnknownParameterSetException (org.eclipse.smarthome.binding.homematic.internal.communicator.client.UnknownParameterSetException)1 BatteryTypeVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.BatteryTypeVirtualDatapointHandler)1