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.GetHouseStatus;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
21 * The {@link VeluxBridgeGetHouseStatus} represents a complete set of transactions
22 * for receiving the current state by the <B>House Status Monitor</B> on the <B>Velux</B> bridge.
24 * The HSM is responsible for continuous updates towards the communication initiator
25 * about any changes of actuator states.
27 * It therefore provides a method {@link VeluxBridgeGetHouseStatus#evaluateState} for check of availability of House
28 * Monitoring Messages.
29 * Any parameters are controlled by {@link org.openhab.binding.velux.internal.config.VeluxBridgeConfiguration}.
31 * @see VeluxBridgeProvider
33 * @author Guenther Schreiner - Initial contribution
36 public class VeluxBridgeGetHouseStatus {
37 private final Logger logger = LoggerFactory.getLogger(VeluxBridgeGetHouseStatus.class);
39 // Class access methods
42 * Login into bridge, fetch the HSM state and logout from bridge based
43 * on a well-prepared environment of a {@link VeluxBridgeProvider}.
45 * @param bridge Initialized Velux bridge handler.
46 * @return true if successful or false otherwise.
48 public boolean evaluateState(VeluxBridge bridge) {
49 logger.trace("evaluateState() called.");
51 boolean success = false;
52 GetHouseStatus bcp = bridge.bridgeAPI().getHouseStatus();
54 if (bridge.bridgeCommunicate(bcp) && bcp.isCommunicationSuccessful()) {
58 logger.debug("evaluateState() finished {}.", (success ? "successfully" : "with failure"));