use of org.openhab.binding.horizon.HorizonBindingProvider in project openhab1-addons by openhab.
the class HorizonBinding method internalReceiveCommand.
/**
* {@inheritDoc}
*/
@Override
protected void internalReceiveCommand(String itemName, Command command) {
logger.debug("internalReceiveCommand({},{}) is called!", itemName, command);
HorizonBindingProvider horizonBindingProvider = findFirstMatchingBindingProvider(itemName, command);
String horizonKeyWithHorizonId = horizonBindingProvider.getHorizonCommand(itemName, command.toString());
String[] horizonKeyWithHorizonIdSplit = horizonKeyWithHorizonId.split(":");
String horizonId = horizonKeyWithHorizonIdSplit[0];
String horizonKey = horizonKeyWithHorizonIdSplit[1];
HorizonBox horizonBox = deviceConfigCache.get(horizonId);
if (horizonBox != null) {
try {
horizonBox.sendKey(Integer.valueOf(horizonKey));
} catch (Exception e) {
logger.error("Error sending key to device with device id '{}'", horizonId, e);
}
} else {
logger.warn("Cannot find connection details for device id '{}'", horizonId);
}
}
Aggregations