2 * Copyright (c) 2010-2023 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.innogysmarthome.internal.client.entity.message;
15 import java.util.List;
17 import com.google.gson.annotations.SerializedName;
20 * Defines the structure of a {@link Message}. Messages are part of the innogy system and besides other things are used
21 * to raise battery warnings.
23 * @author Oliver Kuhl - Initial contribution
25 public class Message {
26 /** device related messages */
27 public static final String TYPE_DEVICE_UNREACHABLE = "DeviceUnreachable";
28 public static final String TYPE_DEVICE_ACTIVITY_LOGGING_ENABLED = "DeviceActivityLoggingEnabled";
29 public static final String TYPE_DEVICE_FACTORY_RESET = "DeviceFactoryReset";
30 public static final String TYPE_DEVICE_LOW_BATTERY = "DeviceLowBattery";
31 public static final String TYPE_DEVICE_MOLD = "DeviceMold";
32 public static final String TYPE_DEVICE_LOW_RF_QUALITY = "DeviceLowRfQuality";
33 public static final String TYPE_DEVICE_FREEZE = "DeviceFreeze";
34 public static final String TYPE_SH_DEVICE_UPDATE_AVAILABLE = "ShDeviceUpdateAvailable";
35 public static final String TYPE_SH_DEVICE_UPDATE_FAILED = "ShDeviceUpdateFailed";
37 /** user related messages */
38 public static final String TYPE_USER_EMAIL_ADDRESS_NOT_VALIDATED = "UserEmailAddressNotValidated";
39 public static final String TYPE_USER_INVITATION_ACCEPTED = "UserInvitiationAccepted";
40 public static final String TYPE_USER_FOREIGN_DELETION = "UserForeignDeletion";
42 /** SHC related messages */
43 public static final String TYPE_SHC_REMOTE_REBOOTED = "ShcRemoteRebooted";
44 public static final String TYPE_SHC_UPDATE_COMPLETED = "ShcUpdateCompleted";
45 public static final String TYPE_SHC_UPDATE_CANCELED = "ShcUpdateCanceled";
46 public static final String TYPE_SHC_DEFERRABLE_UPDATE = "ShcDeferrableUpdate";
47 public static final String TYPE_SHC_REAL_TIME_CLOCK_LOST = "ShcRealTimeClockLost";
48 public static final String TYPE_SHC_ONLINE_SWITCH_IS_OFF = "ShcOnlineSwitchIsOff";
49 public static final String TYPE_SHC_MANDATORY_UPDATE = "ShcMandatoryUpdate";
50 public static final String TYPE_SHC_NO_CONNECTION_TO_BACKEND = "ShcNoConnectionToBackend";
52 /** app related messages */
53 public static final String TYPE_APP_ADDED_TO_SHC = "AppAddedToShc";
54 public static final String TYPE_APP_UPDATED_ON_SHC = "AppUpdatedOnShc";
55 public static final String TYPE_APP_TOKEN_SYNC_FAILURE = "AppTokenSyncFailure";
56 public static final String TYPE_APP_DOWNLOAD_FAILED = "AppDownloadFailed";
57 public static final String TYPE_APPLICATION_LOADING_ERROR = "ApplicationLoadingError";
58 public static final String TYPE_APPLICATION_EXPIRED = "ApplicationExpired";
59 public static final String TYPE_INVALID_CUSTOM_APP = "InvalidCustomApp";
60 public static final String TYPE_CUSTOM_APP_WAS_UPGRADED = "CustomAppWasUpgraded";
61 public static final String TYPE_CUSTOM_APP_UPGRADE_FAILED = "CustomAppUpgradeFailed";
64 public static final String TYPE_BID_COS_INCLUSION_TIMEOUT = "BidCosInclusionTimeout";
65 public static final String TYPE_ADDRESS_COLLISION = "AddressCollision";
66 public static final String TYPE_BACKEND_CONFIG_OUT_OF_SYNC = "BackendConfigOutOfSync";
67 public static final String TYPE_SMOKE_DETECTED = "SmokeDetected";
68 public static final String TYPE_LEMON_BEAT_DONGLE_INITIALIZATION_FAILED = "LemonBeatDongleInitializationFailed";
69 public static final String TYPE_USB_DEVICE_UNPLUGGED = "USBDeviceUnplugged";
70 public static final String TYPE_INVALID_AES_KEY = "InvalidAesKey";
71 public static final String TYPE_MEMORY_SHORTAGE = "MemoryShortage";
72 public static final String TYPE_LOG_LEVEL_CHANGED = "LogLevelChanged";
73 public static final String TYPE_RULE_EXCEPTION_FAILED = "RuleExecutionFailed";
74 public static final String TYPE_SEND_MESSAGE_LIMIT_EXCEEDED = "SendMessageLimitExceeded";
75 public static final String TYPE_CONFIG_FIX_ENTITY_DELETED = "ConfigFixEntityDeleted";
78 * Identifier of the message – must be unique.
83 * Specifies the type of the message.
88 * Defines whether the message has been viewed by a user.
90 @SerializedName("read")
91 private boolean isRead;
94 * Defines whether it is an alert or a message, default is message.
96 @SerializedName("class")
97 private String messageClass;
99 * Timestamp when the message was created.
103 private String timestamp;
106 * Reference to the underlying devices, which the message relates to.
110 private List<String> devices;
113 * Container for all parameters of the message. The parameters are contained in Property entities.
117 private MessageProperties properties;
120 * The product (context) that generated the message.
122 private String namespace;
127 public String getId() {
132 * @param id the id to set
134 public void setId(String id) {
141 public String getType() {
146 * @param type the type to set
148 public void setType(String type) {
153 * @return the messageClass
155 public String getMessageClass() {
160 * @param messageClass the messageClass to set
162 public void setMessageClass(String messageClass) {
163 this.messageClass = messageClass;
167 * @return the timestamp
169 public String getTimestamp() {
174 * @param timestamp the timestamp to set
176 public void setTimestamp(String timestamp) {
177 this.timestamp = timestamp;
183 public boolean isRead() {
188 * @param isRead the isRead to set
190 public void setRead(boolean isRead) {
191 this.isRead = isRead;
195 * @return the devices
197 public List<String> getDevices() {
202 * @param devices the devices to set
204 public void setDevices(List<String> devices) {
205 this.devices = devices;
209 * @return the dataPropertyList
211 public MessageProperties getProperties() {
216 * @param properties the dataPropertyList to set
218 public void setProperties(MessageProperties properties) {
219 this.properties = properties;
223 * @return the namespace
225 public String getNamespace() {
230 * @param namespace the namespace to set
232 public void setNamespace(String namespace) {
233 this.namespace = namespace;
237 * Returns true, if the message is of type "DeviceUnreachable".
241 public boolean isTypeDeviceUnreachable() {
242 return TYPE_DEVICE_UNREACHABLE.equals(type);
246 * Returns true, if the message is of type "DeviceLowBattery".
250 public boolean isTypeDeviceLowBattery() {
251 return TYPE_DEVICE_LOW_BATTERY.equals(type);