use of org.eclipse.smarthome.binding.homematic.internal.model.HmDatapointInfo in project smarthome by eclipse.
the class DisplayTextVirtualDatapoint method initialize.
@Override
public void initialize(HmDevice device) {
if (isDisplay(device)) {
for (HmChannel channel : device.getChannels()) {
if (channel.hasDatapoint(new HmDatapointInfo(HmParamsetType.VALUES, channel, DATAPOINT_NAME_SUBMIT))) {
for (int i = 1; i <= getLineCount(device); i++) {
addDatapoint(device, channel.getNumber(), DATAPOINT_NAME_DISPLAY_LINE + i, HmValueType.STRING, null, false);
addEnumDisplayDatapoint(device, channel.getNumber(), DATAPOINT_NAME_DISPLAY_ICON + i, Icon.class);
if (!isEpDisplay(device)) {
addEnumDisplayDatapoint(device, channel.getNumber(), DATAPOINT_NAME_DISPLAY_COLOR + i, Color.class);
}
}
if (isEpDisplay(device)) {
addEnumDisplayDatapoint(device, channel.getNumber(), DATAPOINT_NAME_DISPLAY_BEEPER, Beeper.class);
HmDatapoint bc = addDatapoint(device, channel.getNumber(), DATAPOINT_NAME_DISPLAY_BEEPCOUNT, HmValueType.INTEGER, 1, false);
bc.setMinValue(0);
bc.setMaxValue(15);
HmDatapoint bd = addDatapoint(device, channel.getNumber(), DATAPOINT_NAME_DISPLAY_BEEPINTERVAL, HmValueType.INTEGER, 1, false);
bd.setMinValue(10);
bd.setMaxValue(160);
bd.setStep(10);
addEnumDisplayDatapoint(device, channel.getNumber(), DATAPOINT_NAME_DISPLAY_LED, Led.class);
}
addDatapoint(device, channel.getNumber(), DATAPOINT_NAME_DISPLAY_SUBMIT, HmValueType.BOOL, false, false);
}
}
}
}
use of org.eclipse.smarthome.binding.homematic.internal.model.HmDatapointInfo in project smarthome by eclipse.
the class HmwIoModuleVirtualDatapointHandler method initialize.
@Override
public void initialize(HmDevice device) {
if (device.getType().startsWith(DEVICE_TYPE_WIRED_IO_MODULE)) {
for (HmChannel channel : device.getChannels()) {
if (channel.getNumber() >= 7) {
HmDatapointInfo dpInfoState = HmDatapointInfo.createValuesInfo(channel, DATAPOINT_NAME_STATE);
HmDatapointInfo dpInfoValue = HmDatapointInfo.createValuesInfo(channel, DATAPOINT_NAME_VALUE);
boolean hasStateDatapoint = channel.hasDatapoint(dpInfoState);
boolean hasValueDatapoint = channel.hasDatapoint(dpInfoValue);
if (hasStateDatapoint && !hasValueDatapoint) {
HmDatapoint dp = addDatapoint(channel.getDevice(), channel.getNumber(), DATAPOINT_NAME_VALUE, HmValueType.FLOAT, 0.0, false);
dp.setMinValue(0.0);
dp.setMaxValue(1000.0);
dp.setVirtual(false);
} else if (hasValueDatapoint && !hasStateDatapoint) {
HmDatapoint dp = addDatapoint(channel.getDevice(), channel.getNumber(), DATAPOINT_NAME_STATE, HmValueType.BOOL, false, false);
dp.setVirtual(false);
}
}
if (channel.getNumber() >= 21) {
HmDatapointInfo dpInfoCalibration = new HmDatapointInfo(HmParamsetType.MASTER, channel, DATAPOINT_NAME_CALIBRATION);
if (!channel.hasDatapoint(dpInfoCalibration)) {
HmDatapoint dp = new HmDatapoint(DATAPOINT_NAME_CALIBRATION, DATAPOINT_NAME_CALIBRATION, HmValueType.INTEGER, 0, false, HmParamsetType.MASTER);
dp.setMinValue(-127);
dp.setMaxValue(127);
addDatapoint(channel, dp);
dp.setVirtual(false);
}
}
}
}
}
use of org.eclipse.smarthome.binding.homematic.internal.model.HmDatapointInfo in project smarthome by eclipse.
the class GetParamsetParser method parse.
@Override
@SuppressWarnings("unchecked")
public Void parse(Object[] message) throws IOException {
Map<String, ?> mapMessage = (Map<String, ?>) message[0];
for (String dpName : mapMessage.keySet()) {
HmDatapointInfo dpInfo = new HmDatapointInfo(paramsetType, channel, dpName);
HmDatapoint dp = channel.getDatapoint(dpInfo);
if (dp != null) {
dp.setValue(convertToType(dp, mapMessage.get(dpName)));
adjustRssiValue(dp);
} else {
// should never happen, but in case ...
// suppress warning for this datapoint due wrong CCU metadata
String deviceType = channel.getDevice().getType();
boolean isHmSenMdirNextTrans = dpInfo.getName().equals("NEXT_TRANSMISSION") && (deviceType.startsWith("HM-Sen-MDIR-O") || deviceType.startsWith("HM-Sen-MDIR-WM55"));
if (!isHmSenMdirNextTrans) {
logger.warn("Can't set value for datapoint '{}'", dpInfo);
}
}
}
return null;
}
use of org.eclipse.smarthome.binding.homematic.internal.model.HmDatapointInfo in project smarthome by eclipse.
the class RpcResponseHandler method handleEvent.
/**
* Populates the extracted event to the listener.
*/
private T handleEvent(Object[] message) throws IOException {
EventParser eventParser = new EventParser();
HmDatapointInfo dpInfo = eventParser.parse(message);
listener.eventReceived(dpInfo, eventParser.getValue());
return getEmptyStringResult();
}
use of org.eclipse.smarthome.binding.homematic.internal.model.HmDatapointInfo in project smarthome by eclipse.
the class HomematicThingHandler method updateChannelState.
/**
* Evaluates the channel and datapoint for this channelUID and updates the state of the channel.
*/
private void updateChannelState(ChannelUID channelUID) throws GatewayNotAvailableException, HomematicClientException, IOException, ConverterException {
HomematicGateway gateway = getHomematicGateway();
HmDatapointInfo dpInfo = UidUtils.createHmDatapointInfo(channelUID);
HmDatapoint dp = gateway.getDatapoint(dpInfo);
Channel channel = getThing().getChannel(channelUID.getId());
updateChannelState(dp, channel);
}
Aggregations