2 * Copyright (c) 2010-2020 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.nikobus.internal.handler;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.core.library.types.OnOffType;
17 import org.openhab.core.library.types.StopMoveType;
18 import org.openhab.core.library.types.UpDownType;
19 import org.openhab.core.thing.Thing;
20 import org.openhab.core.types.Command;
21 import org.openhab.core.types.State;
24 * The {@link NikobusRollershutterModuleHandler} is responsible for communication between Nikobus
25 * rollershutter-controller and binding.
27 * @author Boris Krivonog - Initial contribution
30 public class NikobusRollershutterModuleHandler extends NikobusModuleHandler {
31 public NikobusRollershutterModuleHandler(Thing thing) {
36 protected int valueFromCommand(Command command) {
37 if (command == UpDownType.DOWN || command == StopMoveType.MOVE) {
40 if (command == UpDownType.UP) {
43 if (command == StopMoveType.STOP) {
47 throw new IllegalArgumentException("Command '" + command + "' not supported");
51 protected State stateFromValue(int value) {
59 return UpDownType.DOWN;
61 throw new IllegalArgumentException("Unexpected value " + value + " received");