]> git.basschouten.com Git - openhab-addons.git/blob
e7b8708f2049562b21ab7128e8dc20f730e73cda
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.netatmo.internal.api.data;
14
15 import java.util.Set;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18
19 import com.google.gson.annotations.SerializedName;
20
21 /**
22  * This enum describes events generated by webhooks and the type of
23  * module they are related to according to API documentation
24  *
25  * @author GaĆ«l L'hopital - Initial contribution
26  */
27 @NonNullByDefault
28 public enum EventType {
29     UNKNOWN(),
30
31     @SerializedName("person") // When the Indoor Camera detects a face
32     PERSON(ModuleType.PERSON, ModuleType.WELCOME),
33
34     @SerializedName("person_away") // When geofencing indicates that the person has left the home
35     PERSON_AWAY(ModuleType.PERSON, ModuleType.HOME),
36
37     @SerializedName("person_home") // When the person is declared at home
38     PERSON_HOME(ModuleType.PERSON, ModuleType.HOME),
39
40     @SerializedName("outdoor") // When the Outdoor Camera detects a human, a car or an animal
41     OUTDOOR(ModuleType.PRESENCE, ModuleType.DOORBELL),
42
43     @SerializedName("daily_summary") // When the Outdoor Camera video summary of the last 24 hours is available
44     DAILY_SUMMARY(ModuleType.PRESENCE),
45
46     @SerializedName("movement") // When the Indoor Camera detects motion
47     MOVEMENT(ModuleType.WELCOME),
48
49     @SerializedName("human") // When the camera detects human motion
50     HUMAN(ModuleType.WELCOME, ModuleType.OUTDOOR, ModuleType.DOORBELL),
51
52     @SerializedName("animal") // When the camera detects animal motion
53     ANIMAL(ModuleType.WELCOME, ModuleType.OUTDOOR),
54
55     @SerializedName("vehicle") // When the Outdoor Camera detects a car
56     VEHICLE(ModuleType.OUTDOOR),
57
58     @SerializedName("new_module") // A new Module has been paired with the Indoor Camera
59     NEW_MODULE(ModuleType.WELCOME),
60
61     @SerializedName("module_connect") // Module is connected with the Indoor Camera
62     MODULE_CONNECT(ModuleType.WELCOME),
63
64     @SerializedName("module_disconnect") // Module lost its connection with the Indoor Camera
65     MODULE_DISCONNECT(ModuleType.WELCOME),
66
67     @SerializedName("module_low_battery") // Module's battery is low
68     MODULE_LOW_BATTERY(ModuleType.WELCOME),
69
70     @SerializedName("module_end_update") // Module's firmware update is over
71     MODULE_END_UPDATE(ModuleType.WELCOME),
72
73     @SerializedName("connection") // When the camera connects to Netatmo servers
74     CONNECTION(ModuleType.WELCOME, ModuleType.PRESENCE),
75
76     @SerializedName("disconnection") // When the camera loses connection with Netatmo servers
77     DISCONNECTION(ModuleType.WELCOME, ModuleType.PRESENCE),
78
79     @SerializedName("on") // When Camera Monitoring is resumed
80     ON(ModuleType.WELCOME, ModuleType.PRESENCE),
81
82     @SerializedName("off") // When Camera Monitoring is turned off
83     OFF(ModuleType.WELCOME, ModuleType.PRESENCE),
84
85     @SerializedName("boot") // When the Camera is booting
86     BOOT(ModuleType.WELCOME, ModuleType.PRESENCE),
87
88     @SerializedName("sd") // When Camera SD Card status changes
89     SD(ModuleType.WELCOME, ModuleType.PRESENCE),
90
91     @SerializedName("alim") // When Camera power supply status changes
92     ALIM(ModuleType.WELCOME, ModuleType.PRESENCE),
93
94     @SerializedName("accepted_call") // When a call is incoming
95     ACCEPTED_CALL(ModuleType.DOORBELL),
96
97     @SerializedName("incoming_call") // When a call as been answered by a user
98     INCOMING_CALL(ModuleType.DOORBELL),
99
100     @SerializedName("missed_call") // When a call has not been answered by anyone
101     MISSED_CALL(ModuleType.DOORBELL),
102
103     @SerializedName("hush") // When the smoke detection is activated or deactivated
104     HUSH(ModuleType.SMOKE_DETECTOR),
105
106     @SerializedName("smoke") // When smoke is detected or smoke is cleared
107     SMOKE(ModuleType.SMOKE_DETECTOR),
108
109     @SerializedName("tampered") // When smoke detector is ready or tampered
110     TAMPERED(ModuleType.SMOKE_DETECTOR),
111
112     @SerializedName("wifi_status") // When wifi status is updated
113     WIFI_STATUS(ModuleType.SMOKE_DETECTOR),
114
115     @SerializedName("battery_status") // When battery status is too low
116     BATTERY_STATUS(ModuleType.SMOKE_DETECTOR),
117
118     @SerializedName("detection_chamber_status") // When the detection chamber is dusty or clean
119     DETECTION_CHAMBER_STATUS(ModuleType.SMOKE_DETECTOR),
120
121     @SerializedName("sound_test") // Sound test result
122     SOUND_TEST(ModuleType.SMOKE_DETECTOR),
123
124     @SerializedName("new_device")
125     NEW_DEVICE(ModuleType.HOME);
126
127     private final Set<ModuleType> appliesTo;
128
129     EventType(ModuleType... appliesTo) {
130         this.appliesTo = Set.of(appliesTo);
131     }
132
133     @Override
134     public String toString() {
135         return name().toLowerCase();
136     }
137
138     public boolean validFor(ModuleType searched) {
139         return appliesTo.contains(searched);
140     }
141 }