Closed kirantpatil closed 7 years ago
Below is code from openhab-1 addon.
private void tryUpdate(final String key, final String value, final String remoteAddress) {
logger.debug("trying to set {} of {} to {}", key, remoteAddress, value);
boolean updated = false;
for (final DiyOnXBeeBindingProvider provider : providers) {
for (final String itemName : provider.getItemNames()) {
final String id = provider.getId(itemName);
final String remote = provider.getRemote(itemName);
if (key.equals(id) && remote.equals(remoteAddress)) {
final List<Class<? extends State>> availableTypes = provider.getAvailableItemTypes(itemName);
final State state = parseState(value, availableTypes, provider, itemName);
if (state != null) {
updated = true;
eventPublisher.postUpdate(itemName, state);
}
}
}
}
Hi, I took as an example the YahooWeather binding where : updateState(channelUID, getTemperature());
Is used. I have seen no mention of eventPublisher in OH2 binding, but I am not expert enough to tell if we should use it.
In my case the updateState call works fine an items are updated. You can try to run : smarthome:status ItemName
TO check is it is updated.
Yes, events are getting generated. Somehow I overlooked it. Thanks.
Hi @g1velo,
Why there is no usage of Events to update items ?
Thanks.