Search in sources :

Example 6 with FHTBindingConfig

use of org.openhab.binding.fht.FHTBindingConfig in project openhab1-addons by openhab.

the class FHTBinding method receivedNewDesiredTemperature.

private void receivedNewDesiredTemperature(String deviceAddress, double temperature) {
    FHTBindingConfig config = getConfig(deviceAddress, Datapoint.DESIRED_TEMP);
    if (config != null) {
        logger.debug("Updating item " + config.getItem().getName() + " with new desired temperature " + temperature);
        DecimalType state = new DecimalType(temperature);
        eventPublisher.postUpdate(config.getItem().getName(), state);
    } else {
        logger.debug("Received new desired temperature for currently unknown device with address " + deviceAddress);
    }
}
Also used : FHTBindingConfig(org.openhab.binding.fht.FHTBindingConfig) DecimalType(org.openhab.core.library.types.DecimalType)

Example 7 with FHTBindingConfig

use of org.openhab.binding.fht.FHTBindingConfig in project openhab1-addons by openhab.

the class FHTBinding method internalReceiveCommand.

/**
     * @{inheritDoc
     */
@Override
protected void internalReceiveCommand(String itemName, Command command) {
    if (!checkCULDevice()) {
        return;
    }
    logger.debug("internalReceiveCommand() is called!");
    FHTBindingConfig config = null;
    for (FHTBindingProvider provider : providers) {
        config = provider.getConfigByItemName(itemName);
        if (config != null) {
            break;
        }
    }
    if (config != null) {
        if (Datapoint.DESIRED_TEMP == config.getDatapoint() && command instanceof DecimalType) {
            setDesiredTemperature(config, (DecimalType) command);
        } else if (Datapoint.VALVE == config.getDatapoint() && command instanceof DecimalType) {
            setValvePosition(config, (DecimalType) command);
        } else {
            logger.error("You can only manipulate the desired temperature or valve position via commands, all other data points are read only");
        }
    }
}
Also used : FHTBindingProvider(org.openhab.binding.fht.FHTBindingProvider) FHTBindingConfig(org.openhab.binding.fht.FHTBindingConfig) DecimalType(org.openhab.core.library.types.DecimalType)

Aggregations

FHTBindingConfig (org.openhab.binding.fht.FHTBindingConfig)7 DecimalType (org.openhab.core.library.types.DecimalType)4 Datapoint (org.openhab.binding.fht.FHTBindingConfig.Datapoint)2 FHTBindingProvider (org.openhab.binding.fht.FHTBindingProvider)1 OnOffType (org.openhab.core.library.types.OnOffType)1 OpenClosedType (org.openhab.core.library.types.OpenClosedType)1 State (org.openhab.core.types.State)1 BindingConfigParseException (org.openhab.model.item.binding.BindingConfigParseException)1