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.loxone.internal;
15 import java.io.IOException;
18 import org.openhab.binding.loxone.internal.controls.LxControl;
19 import org.openhab.binding.loxone.internal.security.LxWsSecurity;
20 import org.openhab.binding.loxone.internal.types.LxUuid;
21 import org.openhab.core.thing.ChannelUID;
22 import org.openhab.core.thing.Thing;
23 import org.openhab.core.thing.ThingUID;
24 import org.openhab.core.types.State;
25 import org.openhab.core.types.StateDescription;
27 import com.google.gson.Gson;
30 * Representation of a Loxone Miniserver. It is an openHAB {@link Thing}, which is used to communicate with
31 * objects (controls) configured in the Miniserver over channels.
33 * @author Pawel Pieczul - Initial contribution
35 public interface LxServerHandlerApi {
38 * Sends an action to a Loxone Miniserver's control.
40 * @param id identifier of the control
41 * @param operation identifier of the operation
42 * @throws IOException when communication error with Miniserver occurs
44 void sendAction(LxUuid id, String operation) throws IOException;
47 * Add a control - creates internal data structures and channels in the framework.
48 * This method should be used for all dynamically created controls, usually as a result of Miniserver's state update
49 * messages, after the static configuration is setup.
51 * @param control control to be added
53 void addControl(LxControl control);
56 * Remove a control - removes internal data structures and channels from the framework
57 * This method should be used for all dynamically created controls, usually as a result of Miniserver's state update
58 * messages, after the static configuration is setup.
60 * @param control control to remove
62 void removeControl(LxControl control);
65 * Sets channel's state to a new value
67 * @param channelId channel ID
68 * @param state new state value
70 void setChannelState(ChannelUID channelId, State state);
73 * Sets a new channel state description. This method is called to dynamically change the way the channel state is
74 * interpreted and displayed. It is called when a dynamic state update is received from the Miniserver with a new
75 * way of displaying control's state.
77 * @param channelId channel ID
78 * @param description a new state description
80 void setChannelStateDescription(ChannelUID channelId, StateDescription description);
83 * Get configuration parameter from the thing configuration. This method is called by the {@link LxWsSecurity} class
84 * to dynamically retrieve previously stored login token and its parameters.
86 * @param name parameter name
87 * @return parameter value
89 String getSetting(String name);
92 * Set configuration parameters in the thing configuration. This method is called by the {@link LxWsSecurity} class
93 * to dynamically stored login token and its parameters received from the Miniserver.
95 * @param properties pairs of parameter names and values
97 void setSettings(Map<String, String> properties);
100 * Get GSON object for reuse
102 * @return GSON object
107 * Get ID of the Miniserver's Thing
109 * @return ID of the Thing
111 ThingUID getThingId();