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.smartthings.internal.converter;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.openhab.binding.smartthings.internal.dto.SmartthingsStateData;
18 import org.openhab.core.thing.ChannelUID;
19 import org.openhab.core.thing.Thing;
20 import org.openhab.core.types.Command;
21 import org.openhab.core.types.State;
24 * This "Converter" is assigned to a channel when a special converter is not needed.
25 * A channel specific converter is specified in the thing-type channel property smartthings-converter then that channel
27 * If a channel specific converter is not found a convert based on the channel ID is used.
28 * If there is no convert found then this Default converter is used.
29 * Yes, it would be possible to change the SamrtthingsConverter class to not being abstract and implement these methods
30 * there. But, this makes it explicit that the default converter is being used.
31 * See SmartthingsThingHandler.initialize() for details
33 * @author Bob Raker - Initial contribution
36 public class SmartthingsDefaultConverter extends SmartthingsConverter {
38 public SmartthingsDefaultConverter(Thing thing) {
43 public String convertToSmartthings(ChannelUID channelUid, Command command) {
44 String jsonMsg = defaultConvertToSmartthings(channelUid, command);
49 public State convertToOpenHab(@Nullable String acceptedChannelType, SmartthingsStateData dataFromSmartthings) {
50 State state = defaultConvertToOpenHab(acceptedChannelType, dataFromSmartthings);