Search in sources :

Example 31 with HmChannel

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

the class RpcClientTest method masterParamsetIsLoadedForDummyChannel.

@Test
public void masterParamsetIsLoadedForDummyChannel() throws IOException {
    HmChannel channel = createDimmerDummyChannel();
    rpcClient.setChannelDatapointValues(channel, HmParamsetType.MASTER);
    assertThat(rpcClient.numberOfCalls.get(GET_PARAMSET_NAME), is(1));
}
Also used : HmChannel(org.eclipse.smarthome.binding.homematic.internal.model.HmChannel) DimmerHelper.createDimmerHmChannel(org.eclipse.smarthome.binding.homematic.test.util.DimmerHelper.createDimmerHmChannel) Test(org.junit.Test) JavaTest(org.eclipse.smarthome.test.java.JavaTest)

Example 32 with HmChannel

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

the class RpcClientTest method valuesParamsetIsNotLoadedForDummyChannel.

@Test
public void valuesParamsetIsNotLoadedForDummyChannel() throws IOException {
    HmChannel channel = createDimmerDummyChannel();
    rpcClient.setChannelDatapointValues(channel, HmParamsetType.VALUES);
    assertThat(rpcClient.numberOfCalls.get(GET_PARAMSET_NAME), is(0));
}
Also used : HmChannel(org.eclipse.smarthome.binding.homematic.internal.model.HmChannel) DimmerHelper.createDimmerHmChannel(org.eclipse.smarthome.binding.homematic.test.util.DimmerHelper.createDimmerHmChannel) Test(org.junit.Test) JavaTest(org.eclipse.smarthome.test.java.JavaTest)

Example 33 with HmChannel

use of org.eclipse.smarthome.binding.homematic.internal.model.HmChannel 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 34 with HmChannel

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

the class DimmerHelper method createDimmerDummyChannel.

public static HmChannel createDimmerDummyChannel() {
    HmChannel hmChannel = new HmChannel("HM-LC-Dim1-Pl3", -1);
    hmChannel.setDevice(createDimmerHmDevice());
    return hmChannel;
}
Also used : HmChannel(org.eclipse.smarthome.binding.homematic.internal.model.HmChannel)

Example 35 with HmChannel

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

the class HomematicTypeGeneratorImpl method generateConfigDescription.

private void generateConfigDescription(HmDevice device, URI configDescriptionURI) {
    List<ConfigDescriptionParameter> parms = new ArrayList<ConfigDescriptionParameter>();
    List<ConfigDescriptionParameterGroup> groups = new ArrayList<ConfigDescriptionParameterGroup>();
    for (HmChannel channel : device.getChannels()) {
        String groupName = "HMG_" + channel.getNumber();
        String groupLabel = MetadataUtils.getDescription("CHANNEL_NAME") + " " + channel.getNumber();
        groups.add(new ConfigDescriptionParameterGroup(groupName, null, false, groupLabel, null));
        for (HmDatapoint dp : channel.getDatapoints()) {
            if (dp.getParamsetType() == HmParamsetType.MASTER) {
                ConfigDescriptionParameterBuilder builder = ConfigDescriptionParameterBuilder.create(MetadataUtils.getParameterName(dp), MetadataUtils.getConfigDescriptionParameterType(dp));
                builder.withLabel(MetadataUtils.getLabel(dp));
                builder.withDefault(ObjectUtils.toString(dp.getDefaultValue()));
                builder.withDescription(MetadataUtils.getDatapointDescription(dp));
                if (dp.isEnumType()) {
                    builder.withLimitToOptions(dp.isEnumType());
                    List<ParameterOption> options = MetadataUtils.generateOptions(dp, new OptionsBuilder<ParameterOption>() {

                        @Override
                        public ParameterOption createOption(String value, String description) {
                            return new ParameterOption(value, description);
                        }
                    });
                    builder.withOptions(options);
                }
                if (dp.isNumberType()) {
                    builder.withMinimum(MetadataUtils.createBigDecimal(dp.getMinValue()));
                    builder.withMaximum(MetadataUtils.createBigDecimal(dp.getMaxValue()));
                    builder.withStepSize(MetadataUtils.createBigDecimal(dp.isFloatType() ? new Float(0.1) : 1L));
                    builder.withUnitLabel(MetadataUtils.getUnit(dp));
                }
                builder.withGroupName(groupName);
                parms.add(builder.build());
            }
        }
    }
    configDescriptionProvider.addConfigDescription(new ConfigDescription(configDescriptionURI, parms, groups));
}
Also used : ArrayList(java.util.ArrayList) ConfigDescription(org.eclipse.smarthome.config.core.ConfigDescription) ConfigDescriptionParameterBuilder(org.eclipse.smarthome.config.core.ConfigDescriptionParameterBuilder) HmDatapoint(org.eclipse.smarthome.binding.homematic.internal.model.HmDatapoint) ConfigDescriptionParameterGroup(org.eclipse.smarthome.config.core.ConfigDescriptionParameterGroup) ParameterOption(org.eclipse.smarthome.config.core.ParameterOption) ConfigDescriptionParameter(org.eclipse.smarthome.config.core.ConfigDescriptionParameter) HmChannel(org.eclipse.smarthome.binding.homematic.internal.model.HmChannel)

Aggregations

HmChannel (org.eclipse.smarthome.binding.homematic.internal.model.HmChannel)35 HmDatapoint (org.eclipse.smarthome.binding.homematic.internal.model.HmDatapoint)19 HmDevice (org.eclipse.smarthome.binding.homematic.internal.model.HmDevice)9 DimmerHelper.createDimmerHmChannel (org.eclipse.smarthome.binding.homematic.test.util.DimmerHelper.createDimmerHmChannel)7 Test (org.junit.Test)7 HmDatapointInfo (org.eclipse.smarthome.binding.homematic.internal.model.HmDatapointInfo)6 JavaTest (org.eclipse.smarthome.test.java.JavaTest)5 ArrayList (java.util.ArrayList)4 HomematicClientException (org.eclipse.smarthome.binding.homematic.internal.misc.HomematicClientException)4 HashMap (java.util.HashMap)3 HmDatapointConfig (org.eclipse.smarthome.binding.homematic.internal.model.HmDatapointConfig)3 IOException (java.io.IOException)2 BatteryTypeVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.BatteryTypeVirtualDatapointHandler)2 ButtonVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.ButtonVirtualDatapointHandler)2 DeleteDeviceModeVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.DeleteDeviceModeVirtualDatapointHandler)2 DeleteDeviceVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.DeleteDeviceVirtualDatapointHandler)2 DisplayOptionsVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.DisplayOptionsVirtualDatapointHandler)2 FirmwareVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.FirmwareVirtualDatapointHandler)2 HmwIoModuleVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.HmwIoModuleVirtualDatapointHandler)2 OnTimeAutomaticVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.OnTimeAutomaticVirtualDatapointHandler)2