2 * Copyright (c) 2010-2024 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.openwebnet.internal.handler;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.binding.openwebnet.internal.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.openwebnet4j.message.Where;
25 import org.openwebnet4j.message.WhereLightAutom;
26 import org.slf4j.Logger;
27 import org.slf4j.LoggerFactory;
30 * The {@link OpenWebNetGenericHandler} is responsible for handling Generic OpenWebNet
31 * devices. It does not too much, but it is needed to avoid handler errors and to tell the user
32 * that some device has been found by the gateway but it was not recognised.
33 * It extends the abstract {@link OpenWebNetThingHandler}.
35 * @author Massimo Valla - Initial contribution
38 public class OpenWebNetGenericHandler extends OpenWebNetThingHandler {
40 private final Logger logger = LoggerFactory.getLogger(OpenWebNetGenericHandler.class);
42 public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = OpenWebNetBindingConstants.GENERIC_SUPPORTED_THING_TYPES;
44 public OpenWebNetGenericHandler(Thing thing) {
49 public void initialize() {
54 protected void requestChannelState(ChannelUID channel) {
56 logger.warn("Generic: there are no channels");
60 protected void refreshDevice(boolean refreshAll) {
62 logger.warn("Generic: nothing to refresh");
66 protected void handleChannelCommand(ChannelUID channel, Command command) {
68 logger.warn("Generic: there are no channels");
72 protected String ownIdPrefix() {
77 protected Where buildBusWhere(String wStr) throws IllegalArgumentException {
78 return new WhereLightAutom(wStr);
82 protected void handleMessage(BaseOpenMessage msg) {
83 super.handleMessage(msg);
85 logger.warn("Generic: handleMessage() nothing to do!");