2 * Copyright (c) 2010-2022 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.netatmo.internal.api.data;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import com.google.gson.annotations.SerializedName;
22 * This enum describes events generated by webhooks and the type of
23 * module they are related to according to API documentation
25 * @author Gaƫl L'hopital - Initial contribution
28 public enum EventType {
31 @SerializedName("person") // When the Indoor Camera detects a face
32 PERSON(ModuleType.PERSON, ModuleType.WELCOME),
34 @SerializedName("person_away") // When geofencing indicates that the person has left the home
35 PERSON_AWAY(ModuleType.PERSON, ModuleType.HOME),
37 @SerializedName("person_home") // When the person is declared at home
38 PERSON_HOME(ModuleType.PERSON, ModuleType.HOME),
40 @SerializedName("outdoor") // When the Outdoor Camera detects a human, a car or an animal
41 OUTDOOR(ModuleType.PRESENCE, ModuleType.DOORBELL),
43 @SerializedName("daily_summary") // When the Outdoor Camera video summary of the last 24 hours is available
44 DAILY_SUMMARY(ModuleType.PRESENCE),
46 @SerializedName("movement") // When the Indoor Camera detects motion
47 MOVEMENT(ModuleType.WELCOME),
49 @SerializedName("human") // When the camera detects human motion
50 HUMAN(ModuleType.WELCOME, ModuleType.OUTDOOR, ModuleType.DOORBELL),
52 @SerializedName("animal") // When the camera detects animal motion
53 ANIMAL(ModuleType.WELCOME, ModuleType.OUTDOOR),
55 @SerializedName("vehicle") // When the Outdoor Camera detects a car
56 VEHICLE(ModuleType.OUTDOOR),
58 @SerializedName("new_module") // A new Module has been paired with the Indoor Camera
59 NEW_MODULE(ModuleType.WELCOME),
61 @SerializedName("module_connect") // Module is connected with the Indoor Camera
62 MODULE_CONNECT(ModuleType.WELCOME),
64 @SerializedName("module_disconnect") // Module lost its connection with the Indoor Camera
65 MODULE_DISCONNECT(ModuleType.WELCOME),
67 @SerializedName("module_low_battery") // Module's battery is low
68 MODULE_LOW_BATTERY(ModuleType.WELCOME),
70 @SerializedName("module_end_update") // Module's firmware update is over
71 MODULE_END_UPDATE(ModuleType.WELCOME),
73 @SerializedName("connection") // When the camera connects to Netatmo servers
74 CONNECTION(ModuleType.WELCOME, ModuleType.PRESENCE),
76 @SerializedName("disconnection") // When the camera loses connection with Netatmo servers
77 DISCONNECTION(ModuleType.WELCOME, ModuleType.PRESENCE),
79 @SerializedName("on") // When Camera Monitoring is resumed
80 ON(ModuleType.WELCOME, ModuleType.PRESENCE),
82 @SerializedName("off") // When Camera Monitoring is turned off
83 OFF(ModuleType.WELCOME, ModuleType.PRESENCE),
85 @SerializedName("boot") // When the Camera is booting
86 BOOT(ModuleType.WELCOME, ModuleType.PRESENCE),
88 @SerializedName("sd") // When Camera SD Card status changes
89 SD(ModuleType.WELCOME, ModuleType.PRESENCE),
91 @SerializedName("alim") // When Camera power supply status changes
92 ALIM(ModuleType.WELCOME, ModuleType.PRESENCE),
94 @SerializedName("accepted_call") // When a call is incoming
95 ACCEPTED_CALL(ModuleType.DOORBELL),
97 @SerializedName("incoming_call") // When a call as been answered by a user
98 INCOMING_CALL(ModuleType.DOORBELL),
100 @SerializedName("missed_call") // When a call has not been answered by anyone
101 MISSED_CALL(ModuleType.DOORBELL);
103 private final Set<ModuleType> appliesTo;
105 EventType(ModuleType... appliesTo) {
106 this.appliesTo = Set.of(appliesTo);
110 public String toString() {
111 return name().toLowerCase();
114 public boolean validFor(ModuleType searched) {
115 return appliesTo.contains(searched);