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.velux.internal.bridge;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.velux.internal.bridge.common.RunScene;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
21 * The {@link VeluxBridgeRunScene} represents a complete set of transactions
22 * for executing a scene defined on the <B>Velux</B> bridge.
24 * It provides a method {@link VeluxBridgeRunScene#execute} for execution of a scene.
25 * Any parameters are controlled by {@link org.openhab.binding.velux.internal.config.VeluxBridgeConfiguration}.
27 * @see VeluxBridgeProvider
29 * @author Guenther Schreiner - Initial contribution
32 public class VeluxBridgeRunScene {
33 private final Logger logger = LoggerFactory.getLogger(VeluxBridgeRunScene.class);
36 * Login into bridge, execute a scene and logout from bridge based
37 * on a well-prepared environment of a {@link VeluxBridgeProvider}.
39 * @param bridge Initialized Velux bridge handler.
40 * @param sceneNo Number of scene to be executed.
41 * @return true if successful, and false otherwise.
43 public boolean execute(VeluxBridge bridge, int sceneNo) {
44 logger.trace("execute({}) called.", sceneNo);
46 RunScene bcp = bridge.bridgeAPI().runScene().setSceneId(sceneNo);
47 if (bridge.bridgeCommunicate(bcp) && bcp.isCommunicationSuccessful()) {
48 logger.debug("execute() finished successfully.");
51 logger.trace("execute() finished with failure.");
57 * Login into bridge, execute a scene and logout from bridge based
58 * on a well-prepared environment of a {@link VeluxBridgeProvider}.
60 * @param bridge Initialized Velux bridge handler.
61 * @param sceneNo Number of scene to be executed.
62 * @param velocity integer representing the velocity.
63 * @return true if successful, and false otherwise.
65 public boolean execute(VeluxBridge bridge, int sceneNo, int velocity) {
66 logger.trace("execute({},{}) called.", sceneNo, velocity);
68 RunScene bcp = bridge.bridgeAPI().runScene().setVelocity(velocity).setSceneId(sceneNo);
69 if (bridge.bridgeCommunicate(bcp) && bcp.isCommunicationSuccessful()) {
70 logger.debug("execute() finished successfully.");
73 logger.trace("execute() finished with failure.");