for (HmChannel channel : device.getChannels()) {
boolean isChannelZero = "0".equals(channel.getNumber());
for (HmDatapoint dp : channel.getDatapoints()) {
DatapointConfig bindingConfig = new DatapointConfig(device.getAddress(), channel.getNumber(),
dp.getName());
HmRssiInfo rssiInfo = rssiList.get(bindingConfig.getAddress());
if (rssiInfo != null) {
if ("RSSI_DEVICE".equals(bindingConfig.getParameter())) {
dp.setValue(rssiInfo.getDevice());
deviceHasRssiDatapoint = true;
} else if ("RSSI_PEER".equals(bindingConfig.getParameter())) {
dp.setValue(rssiInfo.getPeer());
deviceHasRssiDatapoint = true;
}
}
callback.iterate(bindingConfig, dp);
}
if (isChannelZero && !deviceHasRssiDatapoint) {
HmRssiInfo rssiInfo = rssiList.get(device.getAddress());
if (rssiInfo != null) {
logger.debug("Adding missing RSSI datapoints to device {} with address {}", device.getType(), device.getAddress());
addRssiDatapoint(channel, "RSSI_DEVICE", rssiInfo.getDevice(), callback);
addRssiDatapoint(channel, "RSSI_PEER", rssiInfo.getPeer(), callback);
}
}
}
}
}