Search in sources :

Example 1 with HomematicBindingProvider

use of org.openhab.binding.homematic.HomematicBindingProvider in project openhab1-addons by openhab.

the class HomematicBinding method internalReceiveUpdate.

/**
     * Receives a state and send it to the Homematic communicator.
     */
@Override
protected void internalReceiveUpdate(String itemName, State newState) {
    for (HomematicBindingProvider provider : providers) {
        Item item = provider.getItem(itemName);
        HomematicBindingConfig config = provider.getBindingFor(itemName);
        communicator.receiveUpdate(item, newState, config);
    }
}
Also used : Item(org.openhab.core.items.Item) HomematicBindingProvider(org.openhab.binding.homematic.HomematicBindingProvider) HomematicBindingConfig(org.openhab.binding.homematic.internal.config.binding.HomematicBindingConfig)

Example 2 with HomematicBindingProvider

use of org.openhab.binding.homematic.HomematicBindingProvider in project openhab1-addons by openhab.

the class HomematicBinding method internalReceiveCommand.

/**
     * Receives a command and send it to the Homematic communicator.
     */
@Override
protected void internalReceiveCommand(String itemName, Command command) {
    for (HomematicBindingProvider provider : providers) {
        Item item = provider.getItem(itemName);
        HomematicBindingConfig config = provider.getBindingFor(itemName);
        communicator.receiveCommand(item, command, config);
    }
}
Also used : Item(org.openhab.core.items.Item) HomematicBindingProvider(org.openhab.binding.homematic.HomematicBindingProvider) HomematicBindingConfig(org.openhab.binding.homematic.internal.config.binding.HomematicBindingConfig)

Example 3 with HomematicBindingProvider

use of org.openhab.binding.homematic.HomematicBindingProvider in project openhab1-addons by openhab.

the class HomematicBinding method bindingChanged.

/**
     * {@inheritDoc}
     */
@Override
public void bindingChanged(BindingProvider provider, String itemName) {
    super.bindingChanged(provider, itemName);
    if (isProperlyConfigured()) {
        if (provider instanceof HomematicBindingProvider) {
            HomematicBindingProvider hmProvider = (HomematicBindingProvider) provider;
            informCommunicator(hmProvider, itemName);
        }
    }
}
Also used : HomematicBindingProvider(org.openhab.binding.homematic.HomematicBindingProvider)

Example 4 with HomematicBindingProvider

use of org.openhab.binding.homematic.HomematicBindingProvider in project openhab1-addons by openhab.

the class ProviderItemIterator method iterate.

/**
     * Iterate through all providers and their items, creates a converter and
     * calls the callback.
     */
public void iterate(HomematicBindingConfig bindingConfig, ProviderItemIteratorCallback callback) {
    for (HomematicBindingProvider provider : context.getProviders()) {
        List<Item> items = provider.getItemsFor(bindingConfig);
        for (Item item : items) {
            HomematicBindingConfig providerBindingConfig = provider.getBindingFor(item.getName());
            Converter<?> converter = context.getConverterFactory().createConverter(item, providerBindingConfig);
            if (converter != null) {
                callback.next(providerBindingConfig, item, converter);
            }
        }
    }
}
Also used : Item(org.openhab.core.items.Item) HomematicBindingProvider(org.openhab.binding.homematic.HomematicBindingProvider) HomematicBindingConfig(org.openhab.binding.homematic.internal.config.binding.HomematicBindingConfig)

Example 5 with HomematicBindingProvider

use of org.openhab.binding.homematic.HomematicBindingProvider in project openhab1-addons by openhab.

the class HomematicBinding method updated.

/**
     * Updates the configuration for the binding and (re-)starts the
     * communicator.
     */
@Override
public void updated(Dictionary<String, ?> config) throws ConfigurationException {
    if (config != null) {
        setProperlyConfigured(false);
        communicator.stop();
        context.getConfig().parse(config);
        logger.info(context.getConfig().toString());
        if (context.getConfig().isValid()) {
            communicator.start();
            setProperlyConfigured(true);
            for (HomematicBindingProvider hmProvider : providers) {
                for (String itemName : hmProvider.getItemNames()) {
                    informCommunicator(hmProvider, itemName);
                }
            }
        }
    }
}
Also used : HomematicBindingProvider(org.openhab.binding.homematic.HomematicBindingProvider)

Aggregations

HomematicBindingProvider (org.openhab.binding.homematic.HomematicBindingProvider)5 HomematicBindingConfig (org.openhab.binding.homematic.internal.config.binding.HomematicBindingConfig)3 Item (org.openhab.core.items.Item)3