use of org.openhab.binding.dscalarm.DSCAlarmBindingProvider in project openhab1-addons by openhab.
the class DSCAlarmActiveBinding method bindingChanged.
/**
* {@inheritDoc}
*/
@Override
public void bindingChanged(BindingProvider provider, String itemName) {
logger.debug("bindingChanged(): Item Name: {}", itemName);
boolean itemRemoved = false;
int icount = provider.getItemNames().size();
if (icount < itemCount) {
itemRemoved = true;
}
if (itemRemoved) {
dscAlarmUpdateMap.clear();
} else {
DSCAlarmBindingProvider dscAlarmBindingProvider = (DSCAlarmBindingProvider) provider;
if (dscAlarmBindingProvider != null) {
DSCAlarmBindingConfig dscAlarmBindingConfig = dscAlarmBindingProvider.getDSCAlarmBindingConfig(itemName);
if (dscAlarmBindingConfig != null) {
dscAlarmUpdateMap.put(itemName, dscAlarmBindingConfig);
}
}
}
itemCount = provider.getItemNames().size();
itemHasChanged = true;
}
use of org.openhab.binding.dscalarm.DSCAlarmBindingProvider in project openhab1-addons by openhab.
the class DSCAlarmActiveBinding method processUpdateMap.
/**
* Processes the Update Items Map
*/
private void processUpdateMap() {
if (dscAlarmUpdateMap.size() == 0) {
logger.debug("processUpdateMap(): Nothing to update.");
return;
}
Map<String, DSCAlarmBindingConfig> itemsMap = new HashMap<String, DSCAlarmBindingConfig>(dscAlarmUpdateMap);
for (String itemName : itemsMap.keySet()) {
DSCAlarmBindingConfig dscAlarmBindingConfig = itemsMap.get(itemName);
dscAlarmUpdateMap.remove(itemName);
Item item = null;
for (DSCAlarmBindingProvider provider : providers) {
item = provider.getItem(itemName);
}
if (dscAlarmBindingConfig.getDSCAlarmItemType().equals(DSCAlarmItemType.PANEL_COMMAND)) {
dscAlarmItemUpdate.updateDeviceItem(item, dscAlarmBindingConfig, eventPublisher, null, -1, "");
} else {
dscAlarmItemUpdate.updateDeviceItem(item, dscAlarmBindingConfig, eventPublisher, null, 0, "");
}
logger.debug("processUpdateMap(): Updated item: {}", itemName);
}
}
Aggregations