if (command.getItem().startsWith("Location")) { logger.debug("Received command for location [" + command.getItem() + "] from openhab"); remote = locationRegistry.get(getIdFromOpenHABCommand(command)); } else if (command.getItem().startsWith("Connection")) { logger.debug("Received command for connection [" + command.getItem() + "] from openhab"); remote = connectionRegistry.get(getIdFromOpenHABCommand(command)); } else if (command.getItem().startsWith("UnitGroup")) { logger.debug("Received command for unitgroup [" + command.getItem() + "] from openhab"); remote = unitGroupRegistry.get(getIdFromOpenHABCommand(command));
@Override public void internalReceiveCommand(OpenhabCommandType.OpenhabCommand command) throws CouldNotPerformException { try { if (!command.hasOnOff() || !command.getOnOff().hasState()) { throw new CouldNotPerformException("Command does not have an onOff value required for apps"); } logger.debug("Received command for app [" + command.getItem() + "] from openhab"); appRegistry.get(getIdFromOpenHABItem(command)).setActivationState(ActivationStateTransformer.transform(command.getOnOff().getState())); } catch (CouldNotPerformException ex) { throw new CouldNotPerformException("Skip item update [" + command.getItem() + " = " + command.getOnOff() + "]!", ex); } }
@Override public void internalReceiveCommand(OpenhabCommandType.OpenhabCommand command) throws CouldNotPerformException { try { if (!command.hasOnOff() || !command.getOnOff().hasState()) { throw new CouldNotPerformException("Command does not have an onOff value required for scenes"); } logger.debug("Received command for scene [" + command.getItem() + "] from openhab"); sceneRegistry.get(getSceneIdFromOpenHABItem(command)).setActivationState(ActivationStateTransformer.transform(command.getOnOff().getState())); } catch (CouldNotPerformException ex) { throw new CouldNotPerformException("Skip item update [" + command.getItem() + " = " + command.getOnOff() + "]!", ex); } }