-
Notifications
You must be signed in to change notification settings - Fork 82
Expand file tree
/
Copy pathHumidifierDehumidifierAccessory.java
More file actions
114 lines (97 loc) · 3.94 KB
/
HumidifierDehumidifierAccessory.java
File metadata and controls
114 lines (97 loc) · 3.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
package io.github.hapjava.accessories;
import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
import io.github.hapjava.characteristics.impl.humidifier.CurrentHumidifierDehumidifierStateEnum;
import io.github.hapjava.characteristics.impl.humidifier.TargetHumidifierDehumidifierStateEnum;
import io.github.hapjava.services.Service;
import io.github.hapjava.services.impl.HumidifierDehumidifierService;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
/** Humidifier/Dehumidifier accessory */
public interface HumidifierDehumidifierAccessory extends HomekitAccessory {
/**
* Retrieves the current relative humidity.
*
* @return a future that will contain the humidity as a value between 0 and 100.
*/
CompletableFuture<Double> getCurrentHumidity();
/**
* Mandatory: Retrieves the current active state of the humidifier/dehumidifier.
*
* @return a future that will contain the binary state
*/
CompletableFuture<Boolean> isActive();
/**
* Sets the active state of the humidifier/dehumidifier
*
* @param state the binary state to set
* @return a future that completes when the change is made
* @throws Exception when the change cannot be made
*/
CompletableFuture<Void> setActive(boolean state) throws Exception;
/**
* Retrieves the humidifier/dehumidifier current state.
*
* @return a future that will contain the humidifier/dehumidifier current state .
*/
CompletableFuture<CurrentHumidifierDehumidifierStateEnum> getCurrentHumidifierDehumidifierState();
/**
* Retrieves the humidifier/dehumidifier target state.
*
* @return a future that will contain the humidifier/dehumidifier target state .
*/
CompletableFuture<TargetHumidifierDehumidifierStateEnum> getTargetHumidifierDehumidifierState();
/**
* set humidifier/dehumidifier target state the lock target state.
*
* @param state humidifier/dehumidifier target state
* @return a future that completes when the change is made
*/
CompletableFuture<Void> setTargetHumidifierDehumidifierState(
TargetHumidifierDehumidifierStateEnum state);
/**
* Valid values for target state.
*
* @return array of valid target states.
*/
default TargetHumidifierDehumidifierStateEnum[]
getTargetHumidifierDehumidifierStateValidValues() {
return TargetHumidifierDehumidifierStateEnum.values();
}
/**
* Subscribes to changes in the humidifier/dehumidifier current state.
*
* @param callback the function to call when the state changes.
*/
void subscribeCurrentHumidifierDehumidifierState(HomekitCharacteristicChangeCallback callback);
/** Unsubscribes from changes in humidifier/dehumidifier current state. */
void unsubscribeCurrentHumidifierDehumidifierState();
/**
* Subscribes to changes in the humidifier/dehumidifier target state.
*
* @param callback the function to call when the state changes.
*/
void subscribeTargetHumidifierDehumidifierState(HomekitCharacteristicChangeCallback callback);
/** Unsubscribes from changes in humidifier/dehumidifier target state. */
void unsubscribeTargetHumidifierDehumidifierState();
/**
* Subscribes to changes in the active state of the humidifier/dehumidifier .
*
* @param callback the function to call when the active state changes.
*/
void subscribeActive(HomekitCharacteristicChangeCallback callback);
/** Unsubscribes from changes in the active state of the humidifier/dehumidifier . */
void unsubscribeActive();
/**
* Subscribes to changes in the current humidity.
*
* @param callback the function to call when the state changes.
*/
void subscribeCurrentHumidity(HomekitCharacteristicChangeCallback callback);
/** Unsubscribes from changes in the current humidity. */
void unsubscribeCurrentHumidity();
@Override
default Collection<Service> getServices() {
return Collections.singleton(new HumidifierDehumidifierService(this));
}
}