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 Indoor Camera detects human motion
50 HUMAN(ModuleType.WELCOME),
52 @SerializedName("animal") // When the Indoor Camera detects animal motion
53 ANIMAL(ModuleType.WELCOME),
55 @SerializedName("new_module") // A new Module has been paired with the Indoor Camera
56 NEW_MODULE(ModuleType.WELCOME),
58 @SerializedName("module_connect") // Module is connected with the Indoor Camera
59 MODULE_CONNECT(ModuleType.WELCOME),
61 @SerializedName("module_disconnect") // Module lost its connection with the Indoor Camera
62 MODULE_DISCONNECT(ModuleType.WELCOME),
64 @SerializedName("module_low_battery") // Module's battery is low
65 MODULE_LOW_BATTERY(ModuleType.WELCOME),
67 @SerializedName("module_end_update") // Module's firmware update is over
68 MODULE_END_UPDATE(ModuleType.WELCOME),
70 @SerializedName("connection") // When the Camera connects to Netatmo servers
71 CONNECTION(ModuleType.WELCOME, ModuleType.PRESENCE),
73 @SerializedName("disconnection") // When the Camera loses connection with Netatmo servers
74 DISCONNECTION(ModuleType.WELCOME, ModuleType.PRESENCE),
76 @SerializedName("on") // When Camera Monitoring is resumed
77 ON(ModuleType.WELCOME, ModuleType.PRESENCE),
79 @SerializedName("off") // When Camera Monitoring is turned off
80 OFF(ModuleType.WELCOME, ModuleType.PRESENCE),
82 @SerializedName("boot") // When the Camera is booting
83 BOOT(ModuleType.WELCOME, ModuleType.PRESENCE),
85 @SerializedName("sd") // When Camera SD Card status changes
86 SD(ModuleType.WELCOME, ModuleType.PRESENCE),
88 @SerializedName("alim") // When Camera power supply status changes
89 ALIM(ModuleType.WELCOME, ModuleType.PRESENCE);
91 private final Set<ModuleType> appliesTo;
93 EventType(ModuleType... appliesTo) {
94 this.appliesTo = Set.of(appliesTo);
98 public String toString() {
99 return name().toLowerCase();
102 public boolean appliesOn(ModuleType searched) {
103 return appliesTo.contains(searched);