Search in sources :

Example 1 with BenqProjectorBindingProvider

use of org.openhab.binding.benqprojector.BenqProjectorBindingProvider in project openhab1-addons by openhab.

the class BenqProjectorBinding method internalReceiveCommand.

/**
     * @{inheritDoc
     */
@Override
protected void internalReceiveCommand(String itemName, Command command) {
    for (BenqProjectorBindingProvider binding : super.providers) {
        if (binding.providesBindingFor(itemName)) {
            logger.debug("Process command " + command + " for " + itemName);
            BenqProjectorBindingConfig cfg = binding.getConfigForItemName(itemName);
            String resp = sendCommandToProjector(cfg, command);
            State s = cfg.mode.parseResponse(resp);
            if (!(s instanceof UnDefType)) {
                eventPublisher.postUpdate(itemName, s);
                logger.debug(itemName + " status is " + s);
            } else {
                logger.debug(itemName + " not updated as result was undefined");
            }
        }
    }
}
Also used : State(org.openhab.core.types.State) UnDefType(org.openhab.core.types.UnDefType) BenqProjectorBindingProvider(org.openhab.binding.benqprojector.BenqProjectorBindingProvider)

Example 2 with BenqProjectorBindingProvider

use of org.openhab.binding.benqprojector.BenqProjectorBindingProvider in project openhab1-addons by openhab.

the class BenqProjectorBinding method execute.

/**
     * @{inheritDoc
     */
@Override
protected void execute() {
    for (BenqProjectorBindingProvider binding : super.providers) {
        for (String itemName : binding.getItemNames()) {
            logger.debug("Polling projector status for " + itemName);
            BenqProjectorBindingConfig cfg = binding.getConfigForItemName(itemName);
            State s = queryProjector(cfg);
            if (!(s instanceof UnDefType)) {
                eventPublisher.postUpdate(itemName, s);
                logger.debug(itemName + " status is " + s);
            } else {
                logger.debug(itemName + " not updated as result was undefined");
            }
        }
    }
}
Also used : State(org.openhab.core.types.State) UnDefType(org.openhab.core.types.UnDefType) BenqProjectorBindingProvider(org.openhab.binding.benqprojector.BenqProjectorBindingProvider)

Aggregations

BenqProjectorBindingProvider (org.openhab.binding.benqprojector.BenqProjectorBindingProvider)2 State (org.openhab.core.types.State)2 UnDefType (org.openhab.core.types.UnDefType)2