Search in sources :

Example 1 with Code

use of org.openhab.binding.pilight.internal.communication.Code in project openhab1-addons by openhab.

the class PilightBinding method createUpdateCommand.

private Action createUpdateCommand(Command command, PilightBindingConfig config) {
    Action action = new Action(Action.ACTION_CONTROL);
    Code code = new Code();
    code.setDevice(config.getDevice());
    if (command instanceof OnOffType) {
        setOnOffValue((OnOffType) command, code);
    } else if (command instanceof PercentType) {
        setDimmerValue((PercentType) command, code);
    } else {
        logger.error("Only OnOffType and PercentType can be changed by the pilight binding");
        return null;
    }
    action.setCode(code);
    return action;
}
Also used : Action(org.openhab.binding.pilight.internal.communication.Action) OnOffType(org.openhab.core.library.types.OnOffType) PercentType(org.openhab.core.library.types.PercentType) Code(org.openhab.binding.pilight.internal.communication.Code)

Aggregations

Action (org.openhab.binding.pilight.internal.communication.Action)1 Code (org.openhab.binding.pilight.internal.communication.Code)1 OnOffType (org.openhab.core.library.types.OnOffType)1 PercentType (org.openhab.core.library.types.PercentType)1