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.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 public void initialize() throws IOException;
37 * Disposes the HomematicGateway and stops everything.
39 public void dispose();
42 * Returns the cached datapoint.
44 public HmDatapoint getDatapoint(HmDatapointInfo dpInfo) throws HomematicClientException;
47 * Returns the cached device.
49 public HmDevice getDevice(String address) throws HomematicClientException;
52 * Cancel loading all device metadata.
54 public void cancelLoadAllDeviceMetadata();
57 * Loads all device, channel and datapoint metadata from the gateway.
59 public void loadAllDeviceMetadata() throws IOException;
62 * Loads all values into the given channel.
64 public 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 public void loadDatapointValue(HmDatapoint dp) throws IOException;
74 * Reenumerates the set of VALUES datapoints for the given channel.
76 public void updateChannelValueDatapoints(HmChannel channel) throws IOException;
79 * Prepares the device for reloading all values from the gateway.
81 public 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 HomematicBindingConstants#RX_BURST_MODE "BURST"} for burst mode,
91 * {@link HomematicBindingConstants#RX_WAKEUP_MODE "WAKEUP"} for wakeup mode, or null for the default
94 public void sendDatapoint(HmDatapoint dp, HmDatapointConfig dpConfig, Object newValue, String rxMode)
95 throws IOException, HomematicClientException;
98 * Returns the id of the HomematicGateway.
100 public String getId();
103 * Set install mode of homematic controller. During install mode the
104 * controller will accept any device (normal mode)
106 * @param enable <i>true</i> will start install mode, whereas <i>false</i>
108 * @param seconds specify how long the install mode should last
109 * @throws IOException if RpcClient fails to propagate command
111 public void setInstallMode(boolean enable, int seconds) throws IOException;
114 * Get current install mode of homematic contoller
116 * @return the current time in seconds that the controller remains in
117 * <i>install_mode==true</i>, respectively <i>0</i> in case of
118 * <i>install_mode==false</i>
119 * @throws IOException if RpcClient fails to propagate command
121 public int getInstallMode() throws IOException;
124 * Loads all rssi values from the gateway.
126 public void loadRssiValues() throws IOException;
129 * Starts the connection and event tracker threads.
131 public void startWatchdogs();
134 * Deletes the device from the gateway.
136 * @param address The address of the device to be deleted
137 * @param reset <i>true</i> will perform a factory reset on the device before deleting it.
138 * @param force <i>true</i> will delete the device even if it is not reachable.
139 * @param defer <i>true</i> will delete the device once it becomes available.
141 public void deleteDevice(String address, boolean reset, boolean force, boolean defer);