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