]> git.basschouten.com Git - openhab-addons.git/blob
d6766c904f66aece8ab8160515d2ee445474b473
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2021 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.openwebnet.handler;
14
15 import java.util.Set;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.binding.openwebnet.OpenWebNetBindingConstants;
19 import org.openhab.core.thing.ChannelUID;
20 import org.openhab.core.thing.Thing;
21 import org.openhab.core.thing.ThingTypeUID;
22 import org.openhab.core.types.Command;
23 import org.openwebnet4j.message.BaseOpenMessage;
24 import org.slf4j.Logger;
25 import org.slf4j.LoggerFactory;
26
27 /**
28  * The {@link OpenWebNetGenericHandler} is responsible for handling Generic OpenWebNet
29  * devices. It does not too much, but it is needed to avoid handler errors and to tell the user
30  * that some device has been found by the gateway but it was not recognised.
31  * It extends the abstract {@link OpenWebNetThingHandler}.
32  *
33  * @author Massimo Valla - Initial contribution
34  */
35 @NonNullByDefault
36 public class OpenWebNetGenericHandler extends OpenWebNetThingHandler {
37
38     private final Logger logger = LoggerFactory.getLogger(OpenWebNetGenericHandler.class);
39
40     public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = OpenWebNetBindingConstants.GENERIC_SUPPORTED_THING_TYPES;
41
42     public OpenWebNetGenericHandler(Thing thing) {
43         super(thing);
44     }
45
46     @Override
47     public void initialize() {
48         super.initialize();
49     }
50
51     @Override
52     protected void requestChannelState(ChannelUID channel) {
53         // do nothing
54         logger.warn("There are no channels");
55     }
56
57     @Override
58     protected void handleChannelCommand(ChannelUID channel, Command command) {
59         // do nothing
60         logger.warn("There are no channels");
61     }
62
63     @Override
64     protected String ownIdPrefix() {
65         return "G";
66     }
67
68     @Override
69     protected void handleMessage(BaseOpenMessage msg) {
70         super.handleMessage(msg);
71         // do nothing
72         logger.warn("handleMessage(): Nothing to do!");
73     }
74 } // class