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));
}
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));
}
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;
}
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;
}
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));
}
Aggregations