]> git.basschouten.com Git - openhab-addons.git/blob
4bb7198ada01d7f4ffa39fb1ff34e4feb449fcf4
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.deconz.internal;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.core.thing.ThingUID;
17 import org.openhab.core.thing.binding.BaseDynamicCommandDescriptionProvider;
18 import org.openhab.core.thing.type.DynamicCommandDescriptionProvider;
19 import org.osgi.service.component.annotations.Component;
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
22
23 /**
24  * Dynamic channel command description provider.
25  * Overrides the command description for the controls, which receive its configuration in the runtime.
26  *
27  * @author Jan N. Klug - Initial contribution
28  */
29 @NonNullByDefault
30 @Component(service = { DynamicCommandDescriptionProvider.class, DeconzDynamicCommandDescriptionProvider.class })
31 public class DeconzDynamicCommandDescriptionProvider extends BaseDynamicCommandDescriptionProvider {
32     private final Logger logger = LoggerFactory.getLogger(DeconzDynamicCommandDescriptionProvider.class);
33
34     /**
35      * remove all descriptions for a given thing
36      *
37      * @param thingUID the thing's UID
38      */
39     public void removeDescriptionsForThing(ThingUID thingUID) {
40         logger.trace("removing state description for thing {}", thingUID);
41         channelOptionsMap.entrySet().removeIf(entry -> entry.getKey().getThingUID().equals(thingUID));
42     }
43 }