diff --git a/bundles/org.openhab.binding.tuya/src/main/java/org/openhab/binding/tuya/internal/TuyaDynamicCommandDescriptionProvider.java b/bundles/org.openhab.binding.tuya/src/main/java/org/openhab/binding/tuya/internal/TuyaDynamicCommandDescriptionProvider.java index 8c6c619776d..593ea241852 100644 --- a/bundles/org.openhab.binding.tuya/src/main/java/org/openhab/binding/tuya/internal/TuyaDynamicCommandDescriptionProvider.java +++ b/bundles/org.openhab.binding.tuya/src/main/java/org/openhab/binding/tuya/internal/TuyaDynamicCommandDescriptionProvider.java @@ -13,7 +13,14 @@ package org.openhab.binding.tuya.internal; import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.core.events.EventPublisher; import org.openhab.core.thing.binding.BaseDynamicCommandDescriptionProvider; +import org.openhab.core.thing.i18n.ChannelTypeI18nLocalizationService; +import org.openhab.core.thing.link.ItemChannelLinkRegistry; +import org.openhab.core.thing.type.DynamicCommandDescriptionProvider; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; /** * This class provides the list of valid commands for dynamic channels. @@ -22,5 +29,14 @@ import org.openhab.core.thing.binding.BaseDynamicCommandDescriptionProvider; * */ @NonNullByDefault +@Component(service = { DynamicCommandDescriptionProvider.class, TuyaDynamicCommandDescriptionProvider.class }) class TuyaDynamicCommandDescriptionProvider extends BaseDynamicCommandDescriptionProvider { + @Activate + public TuyaDynamicCommandDescriptionProvider(final @Reference EventPublisher eventPublisher, // + final @Reference ItemChannelLinkRegistry itemChannelLinkRegistry, // + final @Reference ChannelTypeI18nLocalizationService channelTypeI18nLocalizationService) { + this.eventPublisher = eventPublisher; + this.itemChannelLinkRegistry = itemChannelLinkRegistry; + this.channelTypeI18nLocalizationService = channelTypeI18nLocalizationService; + } } diff --git a/bundles/org.openhab.binding.tuya/src/main/java/org/openhab/binding/tuya/internal/TuyaHandlerFactory.java b/bundles/org.openhab.binding.tuya/src/main/java/org/openhab/binding/tuya/internal/TuyaHandlerFactory.java index 3e983e3fa01..a37fce3b867 100644 --- a/bundles/org.openhab.binding.tuya/src/main/java/org/openhab/binding/tuya/internal/TuyaHandlerFactory.java +++ b/bundles/org.openhab.binding.tuya/src/main/java/org/openhab/binding/tuya/internal/TuyaHandlerFactory.java @@ -69,9 +69,10 @@ public class TuyaHandlerFactory extends BaseThingHandlerFactory { @Activate public TuyaHandlerFactory(@Reference HttpClientFactory httpClientFactory, + @Reference TuyaDynamicCommandDescriptionProvider dynamicCommandDescriptionProvider, @Reference StorageService storageService) { this.httpClient = httpClientFactory.getCommonHttpClient(); - this.dynamicCommandDescriptionProvider = new TuyaDynamicCommandDescriptionProvider(); + this.dynamicCommandDescriptionProvider = dynamicCommandDescriptionProvider; this.eventLoopGroup = new NioEventLoopGroup(); this.udpDiscoveryListener = new UdpDiscoveryListener(eventLoopGroup); this.storage = storageService.getStorage("org.openhab.binding.tuya.Schema");