use of org.openhab.binding.homematic.internal.config.binding.DatapointConfig in project openhab1-addons by openhab.
the class CcuClient method iterateAllDatapoints.
/**
* {@inheritDoc}
*/
@Override
public void iterateAllDatapoints(HmValueItemIteratorCallback callback) throws HomematicClientException {
List<HmDevice> devices = sendScriptByName("getAllDevices", HmDeviceList.class).getDevices();
Map<String, HmRssiInfo> rssiList = rpcClient.getRssiInfo(HmInterface.RF);
for (HmDevice device : devices) {
addBatteryInfo(device);
boolean deviceHasRssiDatapoint = false;
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);
}
}
}
}
}
use of org.openhab.binding.homematic.internal.config.binding.DatapointConfig in project openhab1-addons by openhab.
the class HomegearClient method iterateAllDatapoints.
/**
* {@inheritDoc}
*/
@Override
public void iterateAllDatapoints(HmValueItemIteratorCallback callback) throws HomematicClientException {
Object[] result = rpcClient.getAllValues(getDefaultInterface());
try {
for (int i = 0; i < result.length; i++) {
@SuppressWarnings("unchecked") Map<String, ?> entryMap = (Map<String, ?>) result[i];
HmDevice device = parseDevice(entryMap);
addBatteryInfo(device);
logger.trace("{}", device);
for (HmChannel channel : device.getChannels()) {
for (HmDatapoint dp : channel.getDatapoints()) {
logger.trace(" {}", dp.toDumpString());
DatapointConfig bindingConfig = new DatapointConfig(device.getAddress(), channel.getNumber(), dp.getName());
callback.iterate(bindingConfig, dp);
}
}
}
} catch (Exception ex) {
throw new HomematicClientException(ex.getMessage(), ex);
}
}
Aggregations