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.homematic.internal.communicator;
15 import java.io.IOException;
17 import org.openhab.binding.homematic.internal.misc.HomematicClientException;
18 import org.openhab.binding.homematic.internal.model.HmChannel;
19 import org.openhab.binding.homematic.internal.model.HmDatapoint;
20 import org.openhab.binding.homematic.internal.model.HmDatapointConfig;
21 import org.openhab.binding.homematic.internal.model.HmDatapointInfo;
22 import org.openhab.binding.homematic.internal.model.HmDevice;
25 * Describes the methods required for the communication with a Homematic gateway.
27 * @author Gerhard Riegler - Initial contribution
29 public interface HomematicGateway {
32 * Initializes the Homematic gateway and starts the watchdog thread.
34 void initialize() throws IOException;
37 * Disposes the HomematicGateway and stops everything.
42 * Returns the cached datapoint.
44 HmDatapoint getDatapoint(HmDatapointInfo dpInfo) throws HomematicClientException;
47 * Returns the cached device.
49 HmDevice getDevice(String address) throws HomematicClientException;
52 * Cancel loading all device metadata.
54 void cancelLoadAllDeviceMetadata();
57 * Loads all device, channel and datapoint metadata from the gateway.
59 void loadAllDeviceMetadata() throws IOException;
62 * Loads all values into the given channel.
64 void loadChannelValues(HmChannel channel) throws IOException;
67 * Loads the value of the given {@link HmDatapoint} from the device.
69 * @param dp The HmDatapoint that shall be loaded
71 void loadDatapointValue(HmDatapoint dp) throws IOException;
74 * Reenumerates the set of VALUES datapoints for the given channel.
76 void updateChannelValueDatapoints(HmChannel channel) throws IOException;
79 * Prepares the device for reloading all values from the gateway.
81 void triggerDeviceValuesReload(HmDevice device);
84 * Sends the datapoint to the Homematic gateway or executes virtual datapoints.
86 * @param dp The datapoint to send/execute
87 * @param dpConfig The configuration of the datapoint
88 * @param newValue The new value for the datapoint
89 * @param rxMode The rxMode with which the value should be sent to the device
90 * ({@link org.openhab.binding.homematic.internal.HomematicBindingConstants#RX_BURST_MODE "BURST"}
92 * {@link org.openhab.binding.homematic.internal.HomematicBindingConstants#RX_WAKEUP_MODE "WAKEUP"}
93 * for wakeup mode, or null for the default mode)
95 void sendDatapoint(HmDatapoint dp, HmDatapointConfig dpConfig, Object newValue, String rxMode)
96 throws IOException, HomematicClientException;
99 * Returns the id of the HomematicGateway.
104 * Set install mode of homematic controller. During install mode the
105 * controller will accept any device (normal mode)
107 * @param enable <i>true</i> will start install mode, whereas <i>false</i>
109 * @param seconds specify how long the install mode should last
110 * @throws IOException if RpcClient fails to propagate command
112 void setInstallMode(boolean enable, int seconds) throws IOException;
115 * Get current install mode of homematic contoller
117 * @return the current time in seconds that the controller remains in
118 * <i>install_mode==true</i>, respectively <i>0</i> in case of
119 * <i>install_mode==false</i>
120 * @throws IOException if RpcClient fails to propagate command
122 int getInstallMode() throws IOException;
125 * Loads all rssi values from the gateway.
127 void loadRssiValues() throws IOException;
130 * Starts the connection and event tracker threads.
132 void startWatchdogs();
135 * Deletes the device from the gateway.
137 * @param address The address of the device to be deleted
138 * @param reset <i>true</i> will perform a factory reset on the device before deleting it.
139 * @param force <i>true</i> will delete the device even if it is not reachable.
140 * @param defer <i>true</i> will delete the device once it becomes available.
142 void deleteDevice(String address, boolean reset, boolean force, boolean defer);