2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.deconz.internal;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.core.events.EventPublisher;
17 import org.openhab.core.thing.ThingUID;
18 import org.openhab.core.thing.binding.BaseDynamicCommandDescriptionProvider;
19 import org.openhab.core.thing.i18n.ChannelTypeI18nLocalizationService;
20 import org.openhab.core.thing.link.ItemChannelLinkRegistry;
21 import org.openhab.core.thing.type.DynamicCommandDescriptionProvider;
22 import org.osgi.service.component.annotations.Activate;
23 import org.osgi.service.component.annotations.Component;
24 import org.osgi.service.component.annotations.Reference;
25 import org.slf4j.Logger;
26 import org.slf4j.LoggerFactory;
29 * Dynamic channel command description provider.
30 * Overrides the command description for the controls, which receive its configuration in the runtime.
32 * @author Jan N. Klug - Initial contribution
35 @Component(service = { DynamicCommandDescriptionProvider.class, DeconzDynamicCommandDescriptionProvider.class })
36 public class DeconzDynamicCommandDescriptionProvider extends BaseDynamicCommandDescriptionProvider {
39 public DeconzDynamicCommandDescriptionProvider(final @Reference EventPublisher eventPublisher, //
40 final @Reference ItemChannelLinkRegistry itemChannelLinkRegistry, //
41 final @Reference ChannelTypeI18nLocalizationService channelTypeI18nLocalizationService) {
42 this.eventPublisher = eventPublisher;
43 this.itemChannelLinkRegistry = itemChannelLinkRegistry;
44 this.channelTypeI18nLocalizationService = channelTypeI18nLocalizationService;
47 private final Logger logger = LoggerFactory.getLogger(DeconzDynamicCommandDescriptionProvider.class);
50 * remove all descriptions for a given thing
52 * @param thingUID the thing's UID
54 public void removeCommandDescriptionForThing(ThingUID thingUID) {
55 logger.trace("removing state description for thing {}", thingUID);
56 channelOptionsMap.entrySet().removeIf(entry -> entry.getKey().getThingUID().equals(thingUID));