use of org.openhab.binding.intertechno.CULIntertechnoBindingProvider in project openhab1-addons by openhab.
the class CULIntertechnoBinding method internalReceiveCommand.
/**
*
* @{inheritDoc
*/
@Override
protected void internalReceiveCommand(String itemName, Command command) {
IntertechnoBindingConfig config = null;
for (CULIntertechnoBindingProvider provider : providers) {
config = provider.getConfigForItemName(itemName);
if (config != null) {
break;
}
}
if (config != null && culHandlerLifecycle.isCulReady() && command instanceof OnOffType) {
OnOffType type = (OnOffType) command;
String commandValue = null;
switch(type) {
case ON:
commandValue = config.getCommandValueON();
break;
case OFF:
commandValue = config.getCommandValueOFF();
break;
}
if (commandValue != null) {
try {
culHandlerLifecycle.getCul().send("is" + config.getAddress() + commandValue);
} catch (CULCommunicationException e) {
logger.error("Can't write to CUL", e);
}
} else {
logger.error("Can't determine value to send for command " + command.toString());
}
}
}
Aggregations