]> git.basschouten.com Git - openhab-addons.git/blob
d5e7301e8cadb557a5be3b8edd7d9d99cc133f59
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 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.mqtt.homie.internal.homie300;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.openhab.binding.mqtt.generic.mapping.AbstractMqttAttributeClass;
18 import org.openhab.binding.mqtt.generic.mapping.MQTTvalueTransform;
19 import org.openhab.binding.mqtt.generic.mapping.MandatoryField;
20 import org.openhab.binding.mqtt.generic.mapping.TopicPrefix;
21
22 /**
23  * Homie 3.x Device attributes
24  *
25  * @author David Graeff - Initial contribution
26  */
27 @TopicPrefix
28 @NonNullByDefault
29 public class DeviceAttributes extends AbstractMqttAttributeClass {
30     // Lower-case enum value names required. Those are identifiers for the MQTT/homie protocol.
31     public enum ReadyState {
32         unknown,
33         init,
34         ready,
35         disconnected,
36         sleeping,
37         lost,
38         alert
39     }
40
41     public @MandatoryField @Nullable String homie;
42     public @MandatoryField @Nullable String name;
43     public @MandatoryField ReadyState state = ReadyState.unknown;
44     public @MandatoryField @MQTTvalueTransform(splitCharacter = ",") String @Nullable [] nodes;
45
46     @Override
47     public Object getFieldsOf() {
48         return this;
49     }
50 }