use of org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.MeteringTypeEnum in project smarthome by eclipse.
the class CircuitHandler method channelLinked.
@Override
public void channelLinked(ChannelUID channelUID) {
if (circuit != null) {
MeteringTypeEnum meteringType = DsChannelTypeProvider.getMeteringType(channelUID.getId());
double val = circuit.getMeteringValue(meteringType, MeteringUnitsEnum.WH);
if (val > -1) {
if (meteringType.equals(MeteringTypeEnum.ENERGY)) {
updateState(channelUID, new DecimalType(val * 0.001));
} else {
updateState(channelUID, new DecimalType(val));
}
}
}
}
use of org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.MeteringTypeEnum in project smarthome by eclipse.
the class DsDeviceThingTypeProvider method getThingType.
@Override
public ThingType getThingType(ThingTypeUID thingTypeUID, Locale locale) {
try {
SupportedThingTypes supportedThingType = SupportedThingTypes.valueOf(thingTypeUID.getId());
ThingTypeBuilder thingTypeBuilder = ThingTypeBuilder.instance(thingTypeUID, getLabelText(thingTypeUID.getId(), locale)).withSupportedBridgeTypeUIDs(Arrays.asList(DigitalSTROMBindingConstants.THING_TYPE_DSS_BRIDGE.getAsString())).withDescription(getDescText(thingTypeUID.getId(), locale));
try {
if (supportedThingType.havePowerSensors) {
thingTypeBuilder.withConfigDescriptionURI(new URI(DEVICE_WITH_POWER_SENSORS));
} else {
thingTypeBuilder.withConfigDescriptionURI(new URI(DEVICE_WITHOUT_POWER_SENSORS));
}
} catch (URISyntaxException e) {
logger.debug("An URISyntaxException occurred: ", e);
}
if (SupportedThingTypes.GR.equals(supportedThingType)) {
thingTypeBuilder.withChannelDefinitions(Arrays.asList(new ChannelDefinition(DsChannelTypeProvider.SHADE, new ChannelTypeUID(DigitalSTROMBindingConstants.BINDING_ID, DsChannelTypeProvider.SHADE))));
}
if (SupportedThingTypes.circuit.equals(supportedThingType)) {
List<ChannelDefinition> channelDefinitions = new ArrayList<ChannelDefinition>(3);
for (MeteringTypeEnum meteringType : MeteringTypeEnum.values()) {
channelDefinitions.add(new ChannelDefinition(DsChannelTypeProvider.getMeteringChannelID(meteringType, MeteringUnitsEnum.WH, false), new ChannelTypeUID(DigitalSTROMBindingConstants.BINDING_ID, DsChannelTypeProvider.getMeteringChannelID(meteringType, MeteringUnitsEnum.WH, false))));
}
thingTypeBuilder.withChannelDefinitions(channelDefinitions);
}
return thingTypeBuilder.build();
} catch (IllegalArgumentException e) {
// ignore
}
return null;
}
use of org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.MeteringTypeEnum in project smarthome by eclipse.
the class DsChannelTypeProvider method getChannelTypes.
@Override
public Collection<ChannelType> getChannelTypes(Locale locale) {
List<ChannelType> channelTypeList = new LinkedList<ChannelType>();
for (String channelTypeId : supportedOutputChannelTypes) {
channelTypeList.add(getChannelType(new ChannelTypeUID(DigitalSTROMBindingConstants.BINDING_ID, channelTypeId), locale));
}
for (SensorEnum sensorType : SensorEnum.values()) {
channelTypeList.add(getChannelType(new ChannelTypeUID(DigitalSTROMBindingConstants.BINDING_ID, buildIdentifier(sensorType)), locale));
}
for (MeteringTypeEnum meteringType : MeteringTypeEnum.values()) {
channelTypeList.add(getChannelType(new ChannelTypeUID(DigitalSTROMBindingConstants.BINDING_ID, buildIdentifier(meteringType, MeteringUnitsEnum.WH)), locale));
channelTypeList.add(getChannelType(new ChannelTypeUID(DigitalSTROMBindingConstants.BINDING_ID, buildIdentifier(TOTAL_PRE, meteringType, MeteringUnitsEnum.WH)), locale));
}
for (DeviceBinarayInputEnum binaryInput : DeviceBinarayInputEnum.values()) {
channelTypeList.add(getChannelType(new ChannelTypeUID(DigitalSTROMBindingConstants.BINDING_ID, buildIdentifier(BINARY_INPUT_PRE, binaryInput)), locale));
}
return channelTypeList;
}
Aggregations