Search in sources :

Example 6 with HomematicBindingConfig

use of org.openhab.binding.homematic.internal.config.binding.HomematicBindingConfig 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 7 with HomematicBindingConfig

use of org.openhab.binding.homematic.internal.config.binding.HomematicBindingConfig in project openhab1-addons by openhab.

the class StateHolder method loadDatapoints.

/**
     * Loads all datapoints from the Homematic server, only executed at startup.
     */
public void loadDatapoints() throws HomematicClientException {
    logger.info("Loading Homematic datapoints");
    context.getHomematicClient().iterateAllDatapoints(new HmValueItemIteratorCallback() {

        @Override
        public void iterate(HomematicBindingConfig bindingConfig, HmValueItem hmValueItem) {
            datapoints.put(bindingConfig, hmValueItem);
        }
    });
    logger.info("Finished loading {} Homematic datapoints", datapoints.size());
}
Also used : HomematicBindingConfig(org.openhab.binding.homematic.internal.config.binding.HomematicBindingConfig) HmValueItemIteratorCallback(org.openhab.binding.homematic.internal.communicator.client.BaseHomematicClient.HmValueItemIteratorCallback) HmValueItem(org.openhab.binding.homematic.internal.model.HmValueItem)

Example 8 with HomematicBindingConfig

use of org.openhab.binding.homematic.internal.config.binding.HomematicBindingConfig in project openhab1-addons by openhab.

the class HomematicGenericBindingProvider method processBindingConfiguration.

/**
     * {@inheritDoc}
     */
@Override
public void processBindingConfiguration(String context, Item item, String bindingConfig) throws BindingConfigParseException {
    super.processBindingConfiguration(context, item, bindingConfig);
    HomematicBindingConfig config = parser.parse(item, bindingConfig);
    logger.debug("Adding item {} with {}", item.getName(), config.toString());
    items.put(item.getName(), item);
    addBindingConfig(item, config);
}
Also used : HomematicBindingConfig(org.openhab.binding.homematic.internal.config.binding.HomematicBindingConfig)

Example 9 with HomematicBindingConfig

use of org.openhab.binding.homematic.internal.config.binding.HomematicBindingConfig in project openhab1-addons by openhab.

the class StateHolder method loadVariables.

/**
     * Loads all variables from the Homematic server, only executed at startup.
     */
public void loadVariables() throws HomematicClientException {
    if (context.getHomematicClient().supportsVariables()) {
        logger.info("Loading Homematic Server variables");
        context.getHomematicClient().iterateAllVariables(new HmValueItemIteratorCallback() {

            @Override
            public void iterate(HomematicBindingConfig bindingConfig, HmValueItem variable) {
                variables.put(bindingConfig, variable);
            }
        });
        logger.info("Finished loading {} Homematic server variables", variables.size());
    }
}
Also used : HomematicBindingConfig(org.openhab.binding.homematic.internal.config.binding.HomematicBindingConfig) HmValueItemIteratorCallback(org.openhab.binding.homematic.internal.communicator.client.BaseHomematicClient.HmValueItemIteratorCallback) HmValueItem(org.openhab.binding.homematic.internal.model.HmValueItem)

Aggregations

HomematicBindingConfig (org.openhab.binding.homematic.internal.config.binding.HomematicBindingConfig)9 Item (org.openhab.core.items.Item)6 HmValueItem (org.openhab.binding.homematic.internal.model.HmValueItem)4 HomematicBindingProvider (org.openhab.binding.homematic.HomematicBindingProvider)3 ProviderItemIteratorCallback (org.openhab.binding.homematic.internal.communicator.ProviderItemIterator.ProviderItemIteratorCallback)2 HmValueItemIteratorCallback (org.openhab.binding.homematic.internal.communicator.client.BaseHomematicClient.HmValueItemIteratorCallback)2 State (org.openhab.core.types.State)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 TimerTask (java.util.TimerTask)1 ActionConfig (org.openhab.binding.homematic.internal.config.binding.ActionConfig)1 DatapointConfig (org.openhab.binding.homematic.internal.config.binding.DatapointConfig)1 ProgramConfig (org.openhab.binding.homematic.internal.config.binding.ProgramConfig)1 VariableConfig (org.openhab.binding.homematic.internal.config.binding.VariableConfig)1