Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress SseItemStates warnings during startup #3774

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.openhab.core.items.ItemRegistry;
import org.openhab.core.library.types.DateTimeType;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.service.StartLevelService;
import org.openhab.core.transform.TransformationException;
import org.openhab.core.transform.TransformationHelper;
import org.openhab.core.types.State;
Expand Down Expand Up @@ -62,13 +63,15 @@ public class SseItemStatesEventBuilder {
private final BundleContext bundleContext;
private final ItemRegistry itemRegistry;
private final LocaleService localeService;
private final StartLevelService startLevelService;

@Activate
public SseItemStatesEventBuilder(final BundleContext bundleContext, final @Reference ItemRegistry itemRegistry,
final @Reference LocaleService localeService) {
final @Reference LocaleService localeService, final @Reference StartLevelService startLevelService) {
this.bundleContext = bundleContext;
this.itemRegistry = itemRegistry;
this.localeService = localeService;
this.startLevelService = startLevelService;
}

public @Nullable OutboundSseEvent buildEvent(Builder eventBuilder, Set<String> itemNames) {
Expand All @@ -86,7 +89,9 @@ public SseItemStatesEventBuilder(final BundleContext bundleContext, final @Refer
}
payload.put(itemName, stateDto);
} catch (ItemNotFoundException e) {
logger.warn("Attempting to send a state update of an item which doesn't exist: {}", itemName);
if (startLevelService.getStartLevel() >= StartLevelService.STARTLEVEL_MODEL) {
logger.warn("Attempting to send a state update of an item which doesn't exist: {}", itemName);
}
}
}

Expand Down