forked from supersjimmie/IthoEcoFanRFT
-
Notifications
You must be signed in to change notification settings - Fork 4
/
fan_accessory.c
69 lines (62 loc) · 2.8 KB
/
fan_accessory.c
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
#include <homekit/homekit.h>
#include <homekit/characteristics.h>
void my_accessory_identify(homekit_value_t _value) {
printf("accessory identify\n");
}
homekit_characteristic_t ch_fan_active = HOMEKIT_CHARACTERISTIC_(ACTIVE, 0);
homekit_characteristic_t ch_fan_rotation_speed = HOMEKIT_CHARACTERISTIC_(ROTATION_SPEED, 0, .min_step = (float[]) {25});
homekit_characteristic_t ch_timer_short_name = HOMEKIT_CHARACTERISTIC_(NAME, "Korte timer");
homekit_characteristic_t ch_timer_short_on = HOMEKIT_CHARACTERISTIC_(ON, false);
homekit_characteristic_t ch_timer_long_name = HOMEKIT_CHARACTERISTIC_(NAME, "Lange timer");
homekit_characteristic_t ch_timer_long_on = HOMEKIT_CHARACTERISTIC_(ON, false);
homekit_accessory_t *accessories[] = {
HOMEKIT_ACCESSORY(.id=1, .category=homekit_accessory_category_fan, .services=(homekit_service_t*[]) {
HOMEKIT_SERVICE(ACCESSORY_INFORMATION, .characteristics=(homekit_characteristic_t*[]) {
HOMEKIT_CHARACTERISTIC(NAME, "Ventilatie 3"),
HOMEKIT_CHARACTERISTIC(MANUFACTURER, "Itho CVE"),
HOMEKIT_CHARACTERISTIC(SERIAL_NUMBER, "123-456-789"),
HOMEKIT_CHARACTERISTIC(MODEL, "IthoCVE ECO RFT Ventilatie"),
HOMEKIT_CHARACTERISTIC(FIRMWARE_REVISION, "1.0"),
HOMEKIT_CHARACTERISTIC(IDENTIFY, my_accessory_identify),
NULL
}),
HOMEKIT_SERVICE(FAN2, .primary=true, .characteristics=(homekit_characteristic_t*[]){
HOMEKIT_CHARACTERISTIC(NAME, "Ventilatie 3"),
&ch_fan_active,
&ch_fan_rotation_speed,
NULL
}),
NULL
}),
HOMEKIT_ACCESSORY(.id=2, .category=homekit_accessory_category_switch, .services=(homekit_service_t*[]) {
HOMEKIT_SERVICE(ACCESSORY_INFORMATION, .characteristics=(homekit_characteristic_t*[]) {
HOMEKIT_CHARACTERISTIC(NAME, "Toilet timer"),
HOMEKIT_CHARACTERISTIC(IDENTIFY, my_accessory_identify),
NULL
}),
HOMEKIT_SERVICE(SWITCH, .primary=true, .characteristics=(homekit_characteristic_t*[]){
&ch_timer_short_name,
&ch_timer_short_on,
NULL
}),
NULL
}),
HOMEKIT_ACCESSORY(.id=3, .category=homekit_accessory_category_switch, .services=(homekit_service_t*[]) {
HOMEKIT_SERVICE(ACCESSORY_INFORMATION, .characteristics=(homekit_characteristic_t*[]) {
HOMEKIT_CHARACTERISTIC(NAME, "Douche timer"),
HOMEKIT_CHARACTERISTIC(IDENTIFY, my_accessory_identify),
NULL
}),
HOMEKIT_SERVICE(SWITCH, .primary=false, .characteristics=(homekit_characteristic_t*[]){
&ch_timer_long_name,
&ch_timer_long_on,
NULL
}),
NULL
}),
NULL
};
homekit_server_config_t config = {
.accessories = accessories,
.password = "111-11-111"
};