TuyaDynamicCommandDescriptionProvider needs to be a Component

Signed-off-by: Cody Cutrer <cody@cutrer.us>
This commit is contained in:
Cody Cutrer 2024-12-20 11:01:19 -07:00
parent f9b0b34389
commit 31ef89e39b
2 changed files with 18 additions and 1 deletions

View File

@ -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;
}
}

View File

@ -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");