2 * Copyright (c) 2010-2022 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.innogysmarthome.internal.client.entity.action;
16 * Special {@link Action} needed to control shutters.
20 public class ShutterAction extends Action {
22 public enum ShutterActions {
28 private static final String TYPE_STOP_RAMP = "StopRamp";
29 private static final String TYPE_START_RAMP = "StartRamp";
30 private static final String DIRECTION_RAMP_UP = "RampUp";
31 private static final String DIRECTION_RAMP_DOWN = "RampDown";
32 private static final String CONSTANT = "Constant";
33 private static final String NAMESPACE_COSIP = "CosipDevices.RWE";
36 * Describes a Shutteraction
38 * @param capabilityId String of the 32 character capability id
39 * @param action Which action to perform (UP, DOWN, STOP)
41 public ShutterAction(String capabilityId, ShutterActions action) {
42 setTargetCapabilityById(capabilityId);
43 setNamespace(NAMESPACE_COSIP);
44 final ActionParams params = new ActionParams();
46 if (ShutterActions.STOP.equals(action)) {
47 setType(TYPE_STOP_RAMP);
48 } else if (ShutterActions.UP.equals(action)) {
49 setType(TYPE_START_RAMP);
50 params.setRampDirection(new StringActionParam(CONSTANT, DIRECTION_RAMP_UP));
51 } else if (ShutterActions.DOWN.equals(action)) {
52 setType(TYPE_START_RAMP);
53 params.setRampDirection(new StringActionParam(CONSTANT, DIRECTION_RAMP_DOWN));