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);
}
}
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);
}
}
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);
}
}
}
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);
}
}
}
}
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);
}
}
}
}
}
Aggregations