Java Code Examples for org.eclipse.smarthome.core.types.Command#toString()

The following examples show how to use org.eclipse.smarthome.core.types.Command#toString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HtMt500Handler.java    From smarthome with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public String setInputCommand(Command command) {
    switch (command.toString().toLowerCase()) {
        case "btaudio":
            return "extInput:btAudio";
        case "tv":
            return "extInput:tv";
        case "analog":
            return "extInput:line";
        case "usb":
            return "storage:usb1";
        case "network":
            return "dlna:music";
        case "cast":
            return "cast:audio";
    }
    return command.toString();
}
 
Example 2
Source File: ZonePlayerHandler.java    From smarthome with Eclipse Public License 2.0 6 votes vote down vote up
public void setRepeat(Command command) {
    if ((command != null) && (command instanceof StringType)) {
        try {
            ZonePlayerHandler coordinator = getCoordinatorHandler();

            switch (command.toString()) {
                case "ALL":
                    coordinator.updatePlayMode(coordinator.isShuffleActive() ? "SHUFFLE" : "REPEAT_ALL");
                    break;
                case "ONE":
                    coordinator.updatePlayMode(coordinator.isShuffleActive() ? "SHUFFLE_REPEAT_ONE" : "REPEAT_ONE");
                    break;
                case "OFF":
                    coordinator.updatePlayMode(coordinator.isShuffleActive() ? "SHUFFLE_NOREPEAT" : "NORMAL");
                    break;
                default:
                    logger.debug("{}: unexpected repeat command; accepted values are ALL, ONE and OFF",
                            command.toString());
                    break;
            }
        } catch (IllegalStateException e) {
            logger.debug("Cannot handle repeat command ({})", e.getMessage());
        }
    }
}
 
Example 3
Source File: HtZf9Handler.java    From smarthome with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public String setInputCommand(Command command) {
    switch (command.toString().toLowerCase()) {
        case "btaudio":
            return "extInput:btAudio";
        case "tv":
            return "extInput:tv";
        case "hdmi1":
            return "extInput:hdmi?port=1";
        case "hdmi2":
            return "extInput:hdmi?port=2";
        case "analog":
            return "extInput:line";
        case "usb":
            return "storage:usb1";
        case "network":
            return "dlna:music";
        case "cast":
            return "cast:audio";
    }
    return command.toString();
}
 
Example 4
Source File: HtCt800Handler.java    From smarthome with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public String setInputCommand(Command command) {
    switch (command.toString().toLowerCase()) {
        case "btaudio":
            return "extInput:btAudio";
        case "tv":
            return "extInput:tv";
        case "hdmi1":
            return "extInput:hdmi?port=1";
        case "hdmi2":
            return "extInput:hdmi?port=2";
        case "hdmi3":
            return "extInput:hdmi?port=3";
        case "analog":
            return "extInput:line";
        case "usb":
            return "storage:usb1";
        case "network":
            return "dlna:music";
        case "cast":
            return "cast:audio";
    }
    return command.toString();
}
 
Example 5
Source File: HtZ9fHandler.java    From smarthome with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public String setInputCommand(Command command) {
    switch (command.toString().toLowerCase()) {
        case "btaudio":
            return "extInput:btAudio";
        case "tv":
            return "extInput:tv";
        case "hdmi1":
            return "extInput:hdmi?port=1";
        case "hdmi2":
            return "extInput:hdmi?port=2";
        case "analog":
            return "extInput:line";
        case "usb":
            return "storage:usb1";
        case "network":
            return "dlna:music";
        case "cast":
            return "cast:audio";
    }
    return command.toString();
}
 
Example 6
Source File: HeosChannelHandlerControl.java    From org.openhab.binding.heos with Eclipse Public License 1.0 6 votes vote down vote up
private void handleCommand(Command command) {
    switch (command.toString()) {
        case "PLAY":
            api.play(id);
            break;
        case "PAUSE":
            api.pause(id);
            break;
        case "NEXT":
            api.next(id);
            break;
        case "PREVIOUS":
            api.previous(id);
            break;
        case "ON":
            api.play(id);
            break;
        case "OFF":
            api.pause(id);
            break;
    }
}
 
Example 7
Source File: HeosChannelHandlerControl.java    From org.openhab.binding.heos with Eclipse Public License 1.0 6 votes vote down vote up
private void handleCommand(Command command) {
    switch (command.toString()) {
        case "PLAY":
            api.play(id);
            break;
        case "PAUSE":
            api.pause(id);
            break;
        case "NEXT":
            api.next(id);
            break;
        case "PREVIOUS":
            api.previous(id);
            break;
        case "ON":
            api.play(id);
            break;
        case "OFF":
            api.pause(id);
            break;
    }
}
 
Example 8
Source File: HttpOnlyHandler.java    From IpCamera with Eclipse Public License 2.0 6 votes vote down vote up
public void handleCommand(ChannelUID channelUID, Command command) {
    if (command.toString() == "REFRESH") {
        switch (channelUID.getId()) {
            case CHANNEL_ENABLE_AUDIO_ALARM:
                return;
        }
        return; // Return as we have handled the refresh command above and don't need to
                // continue further.
    } // end of "REFRESH"
    switch (channelUID.getId()) {
        case CHANNEL_THRESHOLD_AUDIO_ALARM:
            if ("ON".equals(command.toString())) {
                ipCameraHandler.audioAlarmEnabled = true;
            } else if ("OFF".equals(command.toString()) || "0".equals(command.toString())) {
                ipCameraHandler.audioAlarmEnabled = false;
            } else {
                ipCameraHandler.audioAlarmEnabled = true;
                ipCameraHandler.audioThreshold = Integer.valueOf(command.toString());
            }
            ipCameraHandler.setupFfmpegFormat("RTSPHELPER");
            return;
    }
}
 
Example 9
Source File: HeosChannelHandlerPlayURL.java    From org.openhab.binding.heos with Eclipse Public License 1.0 5 votes vote down vote up
private void handleCommand(Command command) {
    try {
        URL url = new URL(command.toString());
        api.playURL(id, url);
    } catch (MalformedURLException e) {
        logger.debug("Command '{}' is not a propper URL. Error: {}", command.toString(), e.getMessage());
    }
}
 
Example 10
Source File: ZonePlayerHandler.java    From smarthome with Eclipse Public License 2.0 5 votes vote down vote up
public void playRadio(Command command) {
    if (command instanceof StringType) {
        String station = command.toString();
        List<SonosEntry> stations = getFavoriteRadios();

        SonosEntry theEntry = null;
        // search for the appropriate radio based on its name (title)
        for (SonosEntry someStation : stations) {
            if (someStation.getTitle().equals(station)) {
                theEntry = someStation;
                break;
            }
        }

        // set the URI of the group coordinator
        if (theEntry != null) {
            try {
                ZonePlayerHandler coordinator = getCoordinatorHandler();
                coordinator.setCurrentURI(theEntry);
                coordinator.play();
            } catch (IllegalStateException e) {
                logger.debug("Cannot play radio ({})", e.getMessage());
            }
        } else {
            logger.debug("Radio station '{}' not found", station);
        }
    }
}
 
Example 11
Source File: ZonePlayerHandler.java    From smarthome with Eclipse Public License 2.0 5 votes vote down vote up
public void playTuneinStation(Command command) {
    if (command instanceof StringType) {
        String stationId = command.toString();
        List<SonosMusicService> allServices = getAvailableMusicServices();

        SonosMusicService tuneinService = null;
        // search for the TuneIn music service based on its name
        if (allServices != null) {
            for (SonosMusicService service : allServices) {
                if (service.getName().equals("TuneIn")) {
                    tuneinService = service;
                    break;
                }
            }
        }

        // set the URI of the group coordinator
        if (tuneinService != null) {
            try {
                ZonePlayerHandler coordinator = getCoordinatorHandler();
                SonosEntry entry = new SonosEntry("", "TuneIn station", "", "", "", "",
                        "object.item.audioItem.audioBroadcast",
                        String.format(TUNEIN_URI, stationId, tuneinService.getId()));
                entry.setDesc("SA_RINCON" + tuneinService.getType().toString() + "_");
                coordinator.setCurrentURI(entry);
                coordinator.play();
            } catch (IllegalStateException e) {
                logger.debug("Cannot play TuneIn station {} ({})", stationId, e.getMessage());
            }
        } else {
            logger.debug("TuneIn service not found");
        }
    }
}
 
Example 12
Source File: ZonePlayerHandler.java    From smarthome with Eclipse Public License 2.0 5 votes vote down vote up
public void playPlayList(Command command) {
    if (command != null && command instanceof StringType) {
        String playlist = command.toString();
        List<SonosEntry> playlists = getPlayLists();

        SonosEntry theEntry = null;
        // search for the appropriate play list based on its name (title)
        for (SonosEntry somePlaylist : playlists) {
            if (somePlaylist.getTitle().equals(playlist)) {
                theEntry = somePlaylist;
                break;
            }
        }

        // set the URI of the group coordinator
        if (theEntry != null) {
            try {
                ZonePlayerHandler coordinator = getCoordinatorHandler();

                coordinator.addURIToQueue(theEntry);

                coordinator.setCurrentURI(QUEUE_URI + coordinator.getUDN() + "#0", "");

                String firstTrackNumberEnqueued = stateMap.get("FirstTrackNumberEnqueued");
                if (firstTrackNumberEnqueued != null) {
                    coordinator.seek("TRACK_NR", firstTrackNumberEnqueued);
                }

                coordinator.play();
            } catch (IllegalStateException e) {
                logger.debug("Cannot play playlist ({})", e.getMessage());
            }
        } else {
            logger.debug("Playlist '{}' not found", playlist);
        }
    }
}
 
Example 13
Source File: StrDn1080Handler.java    From smarthome with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public String setInputCommand(Command command) {
    switch (command.toString().toLowerCase()) {
        case "btaudio":
            return "extInput:btAudio";
        case "fm":
            return "radio:fm";
        case "usb":
            return "storage:usb1";
        case "bd/dvd":
            return "extInput:bd-dvd";
        case "game":
            return "extInput:game";
        case "sat/catv":
            return "extInput:sat-catv";
        case "video1":
            return "extInput:video?port=1";
        case "video2":
            return "extInput:video?port=2";
        case "tv":
            return "extInput:tv";
        case "sa-cd/cd":
            return "extInput:sacd-cd";
        case "network":
            return "dlna:music";
        case "source":
            return "extInput:source";
        case "cast":
            return "cast:audio";
    }
    return command.toString();
}
 
Example 14
Source File: DoorBirdHandler.java    From IpCamera with Eclipse Public License 2.0 5 votes vote down vote up
public void handleCommand(ChannelUID channelUID, Command command) {
    if (command.toString() == "REFRESH") {
        return;
    } // end of "REFRESH"
    switch (channelUID.getId()) {
        case CHANNEL_ACTIVATE_ALARM_OUTPUT:
            if ("ON".equals(command.toString())) {
                ipCameraHandler.sendHttpGET("/bha-api/open-door.cgi");
            }
            return;
        case CHANNEL_ACTIVATE_ALARM_OUTPUT2:
            if ("ON".equals(command.toString())) {
                ipCameraHandler.sendHttpGET("/bha-api/open-door.cgi?r=2");
            }
            return;
        case CHANNEL_EXTERNAL_LIGHT:
            if ("ON".equals(command.toString())) {
                ipCameraHandler.sendHttpGET("/bha-api/light-on.cgi");
            }
            return;
        case CHANNEL_FFMPEG_MOTION_CONTROL:
            if ("ON".equals(command.toString())) {
                ipCameraHandler.motionAlarmEnabled = true;
            } else if ("OFF".equals(command.toString()) || "0".equals(command.toString())) {
                ipCameraHandler.motionAlarmEnabled = false;
                ipCameraHandler.noMotionDetected(CHANNEL_MOTION_ALARM);
            } else {
                ipCameraHandler.motionAlarmEnabled = true;
                ipCameraHandler.motionThreshold = Double.valueOf(command.toString());
                ipCameraHandler.motionThreshold = ipCameraHandler.motionThreshold / 10000;
            }
            ipCameraHandler.setupFfmpegFormat("RTSPHELPER");
            return;
    }
}
 
Example 15
Source File: OnOffValue.java    From smarthome with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void update(Command command) throws IllegalArgumentException {
    if (command instanceof OnOffType) {
        state = (OnOffType) command;
    } else {
        final String updatedValue = command.toString();
        if (onString.equals(updatedValue)) {
            state = OnOffType.ON;
        } else if (offString.equals(updatedValue)) {
            state = OnOffType.OFF;
        } else {
            state = OnOffType.valueOf(updatedValue);
        }
    }
}
 
Example 16
Source File: OpenCloseValue.java    From smarthome with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void update(Command command) throws IllegalArgumentException {
    if (command instanceof OpenClosedType) {
        state = (OpenClosedType) command;
    } else {
        final String updatedValue = command.toString();
        if (openString.equals(updatedValue)) {
            state = OpenClosedType.OPEN;
        } else if (closeString.equals(updatedValue)) {
            state = OpenClosedType.CLOSED;
        } else {
            state = OpenClosedType.valueOf(updatedValue);
        }
    }
}
 
Example 17
Source File: TextValue.java    From smarthome with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void update(Command command) throws IllegalArgumentException {
    final Set<String> states = this.states;
    String valueStr = command.toString();
    if (states != null && !states.contains(valueStr)) {
        throw new IllegalArgumentException("Value " + valueStr + " not within range");
    }
    state = new StringType(valueStr);
}
 
Example 18
Source File: HikvisionHandler.java    From IpCamera with Eclipse Public License 2.0 4 votes vote down vote up
public void handleCommand(ChannelUID channelUID, Command command) {
    if (command.toString() == "REFRESH") {
        switch (channelUID.getId()) {
            case CHANNEL_ENABLE_AUDIO_ALARM:
                ipCameraHandler.sendHttpGET("/ISAPI/Smart/AudioDetection/channels/" + nvrChannel + "01");
                return;
            case CHANNEL_ENABLE_LINE_CROSSING_ALARM:
                ipCameraHandler.sendHttpGET("/ISAPI/Smart/LineDetection/" + nvrChannel + "01");
                return;
            case CHANNEL_ENABLE_FIELD_DETECTION_ALARM:
                ipCameraHandler.logger.debug("FieldDetection command");
                ipCameraHandler.sendHttpGET("/ISAPI/Smart/FieldDetection/" + nvrChannel + "01");
                return;
            case CHANNEL_ENABLE_MOTION_ALARM:
                ipCameraHandler
                        .sendHttpGET("/ISAPI/System/Video/inputs/channels/" + nvrChannel + "01/motionDetection");
                return;
        }
        return; // Return as we have handled the refresh command above and don't need to
                // continue further.
    } // end of "REFRESH"
    switch (channelUID.getId()) {
        case CHANNEL_ENABLE_AUDIO_ALARM:
            if ("ON".equals(command.toString())) {
                ipCameraHandler.hikChangeSetting("/ISAPI/Smart/AudioDetection/channels/" + nvrChannel + "01",
                        "<enabled>false</enabled>", "<enabled>true</enabled>");
            } else {
                ipCameraHandler.hikChangeSetting("/ISAPI/Smart/AudioDetection/channels/" + nvrChannel + "01",
                        "<enabled>true</enabled>", "<enabled>false</enabled>");
            }
            return;
        case CHANNEL_ENABLE_LINE_CROSSING_ALARM:
            if ("ON".equals(command.toString())) {
                ipCameraHandler.hikChangeSetting("/ISAPI/Smart/LineDetection/" + nvrChannel + "01",
                        "<enabled>false</enabled>", "<enabled>true</enabled>");
            } else {
                ipCameraHandler.hikChangeSetting("/ISAPI/Smart/LineDetection/" + nvrChannel + "01",
                        "<enabled>true</enabled>", "<enabled>false</enabled>");
            }
            return;
        case CHANNEL_ENABLE_MOTION_ALARM:
            if ("ON".equals(command.toString())) {

                ipCameraHandler.hikChangeSetting(
                        "/ISAPI/System/Video/inputs/channels/" + nvrChannel + "01/motionDetection",
                        "<enabled>false</enabled>", "<enabled>true</enabled>");
            } else {
                ipCameraHandler.hikChangeSetting(
                        "/ISAPI/System/Video/inputs/channels/" + nvrChannel + "01/motionDetection",
                        "<enabled>true</enabled>", "<enabled>false</enabled>");
            }
            return;
        case CHANNEL_ENABLE_FIELD_DETECTION_ALARM:
            if ("ON".equals(command.toString())) {
                ipCameraHandler.hikChangeSetting("/ISAPI/Smart/FieldDetection/" + nvrChannel + "01",
                        "<enabled>false</enabled>", "<enabled>true</enabled>");
            } else {
                ipCameraHandler.hikChangeSetting("/ISAPI/Smart/FieldDetection/" + nvrChannel + "01",
                        "<enabled>true</enabled>", "<enabled>false</enabled>");
            }
            return;
        case CHANNEL_ACTIVATE_ALARM_OUTPUT:
            if ("ON".equals(command.toString())) {
                ipCameraHandler.hikSendXml("/ISAPI/System/IO/outputs/" + nvrChannel + "/trigger",
                        "<IOPortData version=\"1.0\" xmlns=\"http://www.hikvision.com/ver10/XMLSchema\">\r\n    <outputState>high</outputState>\r\n</IOPortData>\r\n");
            } else {
                ipCameraHandler.hikSendXml("/ISAPI/System/IO/outputs/" + nvrChannel + "/trigger",
                        "<IOPortData version=\"1.0\" xmlns=\"http://www.hikvision.com/ver10/XMLSchema\">\r\n    <outputState>low</outputState>\r\n</IOPortData>\r\n");
            }
            return;
        case CHANNEL_FFMPEG_MOTION_CONTROL:
            if ("ON".equals(command.toString())) {
                ipCameraHandler.motionAlarmEnabled = true;
            } else if ("OFF".equals(command.toString()) || "0".equals(command.toString())) {
                ipCameraHandler.motionAlarmEnabled = false;
                ipCameraHandler.noMotionDetected(CHANNEL_MOTION_ALARM);
            } else {
                ipCameraHandler.motionAlarmEnabled = true;
                ipCameraHandler.motionThreshold = Double.valueOf(command.toString());
                ipCameraHandler.motionThreshold = ipCameraHandler.motionThreshold / 10000;
            }
            ipCameraHandler.setupFfmpegFormat("RTSPHELPER");
            return;
    }
}
 
Example 19
Source File: InstarHandler.java    From IpCamera with Eclipse Public License 2.0 4 votes vote down vote up
public void handleCommand(ChannelUID channelUID, Command command) {
    if (command.toString() == "REFRESH") {
        switch (channelUID.getId()) {
            case CHANNEL_MOTION_ALARM:
                if (ipCameraHandler.serverPort > 0) {
                    ipCameraHandler.logger.info("Setting up the Alarm Server settings in the camera now");
                    ipCameraHandler.sendHttpGET(
                            "/param.cgi?cmd=setmdalarm&-aname=server2&-switch=on&-interval=2&cmd=setalarmserverattr&-as_index=3&-as_server="
                                    + ipCameraHandler.hostIp + "&-as_port=" + ipCameraHandler.serverPort
                                    + "&-as_path=/instar&-as_queryattr1=&-as_queryval1=&-as_queryattr2=&-as_queryval2=&-as_queryattr3=&-as_queryval3=&-as_activequery=1&-as_auth=0&-as_query1=0&-as_query2=0&-as_query3=0");
                    return;
                }
        }
        return;
    } // end of "REFRESH"
    switch (channelUID.getId()) {
        case CHANNEL_THRESHOLD_AUDIO_ALARM:
            int value = Math.round(Float.valueOf(command.toString()));
            if (value == 0) {
                ipCameraHandler.sendHttpGET("/cgi-bin/hi3510/param.cgi?cmd=setaudioalarmattr&-aa_enable=0");
            } else {
                ipCameraHandler.sendHttpGET("/cgi-bin/hi3510/param.cgi?cmd=setaudioalarmattr&-aa_enable=1");
                ipCameraHandler
                        .sendHttpGET("/cgi-bin/hi3510/param.cgi?cmd=setaudioalarmattr&-aa_enable=1&-aa_value="
                                + command.toString());
            }
            return;
        case CHANNEL_ENABLE_AUDIO_ALARM:
            if ("ON".equals(command.toString())) {
                ipCameraHandler.sendHttpGET("/cgi-bin/hi3510/param.cgi?cmd=setaudioalarmattr&-aa_enable=1");
            } else {
                ipCameraHandler.sendHttpGET("/cgi-bin/hi3510/param.cgi?cmd=setaudioalarmattr&-aa_enable=0");
            }
            return;
        case CHANNEL_ENABLE_MOTION_ALARM:
            if ("ON".equals(command.toString())) {
                ipCameraHandler.sendHttpGET(
                        "/cgi-bin/hi3510/param.cgi?cmd=setmdattr&-enable=1&-name=1&cmd=setmdattr&-enable=1&-name=2&cmd=setmdattr&-enable=1&-name=3&cmd=setmdattr&-enable=1&-name=4");
            } else {
                ipCameraHandler.sendHttpGET(
                        "/cgi-bin/hi3510/param.cgi?cmd=setmdattr&-enable=0&-name=1&cmd=setmdattr&-enable=0&-name=2&cmd=setmdattr&-enable=0&-name=3&cmd=setmdattr&-enable=0&-name=4");
            }
            return;
        case CHANNEL_TEXT_OVERLAY:
            String text = encodeSpecialChars(command.toString());
            if ("".contentEquals(text)) {
                ipCameraHandler.sendHttpGET("/param.cgi?cmd=setoverlayattr&-region=1&-show=0");
            } else {
                ipCameraHandler.sendHttpGET("/param.cgi?cmd=setoverlayattr&-region=1&-show=1&-name=" + text);
            }
            return;
        case CHANNEL_AUTO_LED:
            if ("ON".equals(command.toString())) {
                ipCameraHandler.sendHttpGET("/param.cgi?cmd=setinfrared&-infraredstat=auto");
            } else {
                ipCameraHandler.sendHttpGET("/param.cgi?cmd=setinfrared&-infraredstat=close");
            }
            return;
        case CHANNEL_ENABLE_PIR_ALARM:
            if ("ON".equals(command.toString())) {
                ipCameraHandler.sendHttpGET("/param.cgi?cmd=setpirattr&-pir_enable=1");
            } else {
                ipCameraHandler.sendHttpGET("/param.cgi?cmd=setpirattr&-pir_enable=0");
            }
            return;
        case CHANNEL_ENABLE_EXTERNAL_ALARM_INPUT:
            if ("ON".equals(command.toString())) {
                ipCameraHandler.sendHttpGET("/param.cgi?cmd=setioattr&-io_enable=1");
            } else {
                ipCameraHandler.sendHttpGET("/param.cgi?cmd=setioattr&-io_enable=0");
            }
            return;
        case CHANNEL_FFMPEG_MOTION_CONTROL:
            if ("ON".equals(command.toString())) {
                ipCameraHandler.motionAlarmEnabled = true;
            } else if ("OFF".equals(command.toString()) || "0".equals(command.toString())) {
                ipCameraHandler.motionAlarmEnabled = false;
                ipCameraHandler.noMotionDetected(CHANNEL_MOTION_ALARM);
            } else {
                ipCameraHandler.motionAlarmEnabled = true;
                ipCameraHandler.motionThreshold = Double.valueOf(command.toString());
                ipCameraHandler.motionThreshold = ipCameraHandler.motionThreshold / 10000;
            }
            ipCameraHandler.setupFfmpegFormat("RTSPHELPER");
            return;
    }
}
 
Example 20
Source File: ItemEventFactory.java    From smarthome with Eclipse Public License 2.0 3 votes vote down vote up
/**
 * Creates an item command event.
 *
 * @param itemName the name of the item to send the command for
 * @param command the command to send
 * @param source the name of the source identifying the sender (can be null)
 * @return the created item command event
 * @throws IllegalArgumentException if itemName or command is null
 */
public static ItemCommandEvent createCommandEvent(String itemName, Command command, String source) {
    assertValidArguments(itemName, command, "command");
    String topic = buildTopic(ITEM_COMAND_EVENT_TOPIC, itemName);
    ItemEventPayloadBean bean = new ItemEventPayloadBean(getCommandType(command), command.toString());
    String payload = serializePayload(bean);
    return new ItemCommandEvent(topic, payload, itemName, command, source);
}