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.hue.internal.handler;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.openhab.binding.hue.internal.discovery.HueDeviceDiscoveryService;
18 import org.openhab.binding.hue.internal.dto.ConfigUpdate;
19 import org.openhab.binding.hue.internal.dto.FullGroup;
20 import org.openhab.binding.hue.internal.dto.FullLight;
21 import org.openhab.binding.hue.internal.dto.FullSensor;
22 import org.openhab.binding.hue.internal.dto.StateUpdate;
25 * Access to the Hue system for light handlers.
27 * @author Simon Kaufmann - initial contribution and API
28 * @author Samuel Leisering - Added support for sensor API
29 * @author Christoph Weitkamp - Added support for sensor API
30 * @author Laurent Garnier - Added support for groups
33 public interface HueClient {
36 * Register {@link HueDeviceDiscoveryService} to bridge handler
38 * @param listener the discovery service
39 * @return {@code true} if the new discovery service is accepted
41 boolean registerDiscoveryListener(HueDeviceDiscoveryService listener);
44 * Unregister {@link HueDeviceDiscoveryService} from bridge handler
46 * @return {@code true} if the discovery service was removed
48 boolean unregisterDiscoveryListener();
51 * Register a light status listener.
53 * @param lightStatusListener the light status listener
54 * @return {@code true} if the collection of listeners has changed as a result of this call
56 boolean registerLightStatusListener(LightStatusListener lightStatusListener);
59 * Unregister a light status listener.
61 * @param lightStatusListener the light status listener
62 * @return {@code true} if the collection of listeners has changed as a result of this call
64 boolean unregisterLightStatusListener(LightStatusListener lightStatusListener);
67 * Register a sensor status listener.
69 * @param sensorStatusListener the sensor status listener
70 * @return {@code true} if the collection of listeners has changed as a result of this call
72 boolean registerSensorStatusListener(SensorStatusListener sensorStatusListener);
75 * Unregister a sensor status listener.
77 * @param sensorStatusListener the sensor status listener
78 * @return {@code true} if the collection of listeners has changed as a result of this call
80 boolean unregisterSensorStatusListener(SensorStatusListener sensorStatusListener);
83 * Register a group status listener.
85 * @param groupStatusListener the group status listener
86 * @return {@code true} if the collection of listeners has changed as a result of this call
88 boolean registerGroupStatusListener(GroupStatusListener groupStatusListener);
91 * Unregister a group status listener.
93 * @param groupStatusListener the group status listener
94 * @return {@code true} if the collection of listeners has changed as a result of this call
96 boolean unregisterGroupStatusListener(GroupStatusListener groupStatusListener);
99 * Get the light by its ID.
101 * @param lightId the light ID
102 * @return the full light representation or {@code null} if it could not be found
105 FullLight getLightById(String lightId);
108 * Get the sensor by its ID.
110 * @param sensorId the sensor ID
111 * @return the full sensor representation or {@code null} if it could not be found
114 FullSensor getSensorById(String sensorId);
117 * Get the group by its ID.
119 * @param groupId the group ID
120 * @return the full group representation or {@code null} if it could not be found
123 FullGroup getGroupById(String groupId);
126 * Updates the given light.
128 * @param listener the light status listener to block it for state updates
129 * @param light the light to be updated
130 * @param stateUpdate the state update
131 * @param fadeTime the status listener will be blocked for this duration after command
133 void updateLightState(LightStatusListener listener, FullLight light, StateUpdate stateUpdate, long fadeTime);
136 * Updates the given sensors config.
138 * @param sensor the light to be updated
139 * @param configUpdate the config update
141 void updateSensorConfig(FullSensor sensor, ConfigUpdate configUpdate);
144 * Updates the given sensor.
146 * @param sensor the sensor to be updated
147 * @param stateUpdate the state update
149 void updateSensorState(FullSensor sensor, StateUpdate stateUpdate);
152 * Updates the given group.
154 * @param group the group to be updated
155 * @param stateUpdate the state update
157 void updateGroupState(FullGroup group, StateUpdate stateUpdate, long fadeTime);
160 * Recall scene to all lights that belong to the scene.
162 * @param id the ID of the scene to be recalled
164 void recallScene(String id);