diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/profiles/ProfileCallbackImpl.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/profiles/ProfileCallbackImpl.java index 6fb60c032..f3272ef04 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/profiles/ProfileCallbackImpl.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/profiles/ProfileCallbackImpl.java @@ -137,6 +137,12 @@ public class ProfileCallbackImpl implements ProfileCallback { @Override public void sendUpdate(State state) { Item item = itemProvider.apply(link.getItemName()); + if (item == null) { + logger.warn("Cannot post update event '{}' for item '{}', because no item could be found.", state, + link.getItemName()); + return; + } + State acceptedState; if (state instanceof StringType && !(item instanceof StringItem)) { acceptedState = TypeParser.parseState(item.getAcceptedDataTypes(), state.toString()); @@ -146,6 +152,7 @@ public class ProfileCallbackImpl implements ProfileCallback { } else { acceptedState = itemStateConverter.convertToAcceptedState(state, item); } + eventPublisher.post( ItemEventFactory.createStateEvent(link.getItemName(), acceptedState, link.getLinkedUID().toString())); } diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/link/ItemChannelLink.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/link/ItemChannelLink.java index 2ae1086f7..074c46aa6 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/link/ItemChannelLink.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/link/ItemChannelLink.java @@ -12,6 +12,7 @@ */ package org.openhab.core.thing.link; +import org.eclipse.jdt.annotation.NonNullByDefault; import org.openhab.core.config.core.Configuration; import org.openhab.core.items.Item; import org.openhab.core.thing.ChannelUID; @@ -23,9 +24,10 @@ import org.openhab.core.thing.ChannelUID; * @author Jochen Hiller - Bugfix 455434: added default constructor, object is now mutable * @author Simon Kaufmann - added configuration */ +@NonNullByDefault public class ItemChannelLink extends AbstractLink { - private final ChannelUID channelUID; + private final @NonNullByDefault({}) ChannelUID channelUID; private final Configuration configuration; /**