]> git.basschouten.com Git - openhab-addons.git/blob
6f48291f73906861a2b149079690056ade88fa99
[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 Indoor Camera detects human motion
50     HUMAN(ModuleType.WELCOME),
51
52     @SerializedName("animal") // When the Indoor Camera detects animal motion
53     ANIMAL(ModuleType.WELCOME),
54
55     @SerializedName("new_module") // A new Module has been paired with the Indoor Camera
56     NEW_MODULE(ModuleType.WELCOME),
57
58     @SerializedName("module_connect") // Module is connected with the Indoor Camera
59     MODULE_CONNECT(ModuleType.WELCOME),
60
61     @SerializedName("module_disconnect") // Module lost its connection with the Indoor Camera
62     MODULE_DISCONNECT(ModuleType.WELCOME),
63
64     @SerializedName("module_low_battery") // Module's battery is low
65     MODULE_LOW_BATTERY(ModuleType.WELCOME),
66
67     @SerializedName("module_end_update") // Module's firmware update is over
68     MODULE_END_UPDATE(ModuleType.WELCOME),
69
70     @SerializedName("connection") // When the Camera connects to Netatmo servers
71     CONNECTION(ModuleType.WELCOME, ModuleType.PRESENCE),
72
73     @SerializedName("disconnection") // When the Camera loses connection with Netatmo servers
74     DISCONNECTION(ModuleType.WELCOME, ModuleType.PRESENCE),
75
76     @SerializedName("on") // When Camera Monitoring is resumed
77     ON(ModuleType.WELCOME, ModuleType.PRESENCE),
78
79     @SerializedName("off") // When Camera Monitoring is turned off
80     OFF(ModuleType.WELCOME, ModuleType.PRESENCE),
81
82     @SerializedName("boot") // When the Camera is booting
83     BOOT(ModuleType.WELCOME, ModuleType.PRESENCE),
84
85     @SerializedName("sd") // When Camera SD Card status changes
86     SD(ModuleType.WELCOME, ModuleType.PRESENCE),
87
88     @SerializedName("alim") // When Camera power supply status changes
89     ALIM(ModuleType.WELCOME, ModuleType.PRESENCE);
90
91     private final Set<ModuleType> appliesTo;
92
93     EventType(ModuleType... appliesTo) {
94         this.appliesTo = Set.of(appliesTo);
95     }
96
97     @Override
98     public String toString() {
99         return name().toLowerCase();
100     }
101
102     public boolean appliesOn(ModuleType searched) {
103         return appliesTo.contains(searched);
104     }
105 }