]> git.basschouten.com Git - openhab-addons.git/blob
993209ee88f03871f9876bdc78d7fed06a092880
[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.miio.internal.robot;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.core.thing.type.ChannelTypeUID;
17
18 /**
19  * List of additional capabilities
20  *
21  * @author Marcel Verpaalen - Initial contribution
22  */
23 @NonNullByDefault
24 public enum RobotCababilities {
25
26     WATERBOX_STATUS("water_box_status", "status#water_box_status", "miio:water_box_status", ""),
27     LOCKSTATUS("lock_status", "status#lock_status", "miio:lock_status", ""),
28     WATERBOX_MODE("water_box_mode", "status#water_box_mode", "miio:water_box_mode", ""),
29     WATERBOX_CARRIAGE("water_box_carriage_status", "status#water_box_carriage_status", "miio:water_box_carriage_status",
30             ""),
31     MOP_FORBIDDEN("mop_forbidden_enable", "status#mop_forbidden_enable", "miio:mop_forbidden_enable", ""),
32     LOCATING("is_locating", "status#is_locating", "miio:is_locating", ""),
33     SEGMENT_STATUS("", "status#segment_status", "miio:segment_status", "get_segment_status"),
34     MAP_STATUS("", "status#map_status", "miio:map_status", "get_map_status"),
35     LED_STATUS("", "status#led_status", "miio:led_status", "get_led_status"),
36     CARPET_MODE("", "info#carpet_mode", "miio:carpet_mode", "get_carpet_mode"),
37     FW_FEATURES("", "info#fw_features", "miio:fw_features", "get_fw_features"),
38     ROOM_MAPPING("", "info#room_mapping", "miio:room_mapping", "get_room_mapping"),
39     MULTI_MAP_LIST("", "info#multi_maps_list", "miio:multi_maps_list", "get_multi_maps_list"),
40     CUSTOMIZE_CLEAN_MODE("", "info#customize_clean_mode", "miio:customize_clean_mode", "get_customize_clean_mode"),
41     SEGMENT_CLEAN("", "actions#segment", "miio:segment", "");
42
43     private final String statusFieldName;
44     private final String channel;
45     private final String channelType;
46     private final String command;
47
48     RobotCababilities(String statusKey, String channel, String channelType, String command) {
49         this.statusFieldName = statusKey;
50         this.channel = channel;
51         this.channelType = channelType;
52         this.command = command;
53     }
54
55     public String getStatusFieldName() {
56         return statusFieldName;
57     }
58
59     public String getChannel() {
60         return channel;
61     }
62
63     public ChannelTypeUID getChannelType() {
64         return new ChannelTypeUID(channelType);
65     }
66
67     public String getCommand() {
68         return command;
69     }
70
71     @Override
72     public String toString() {
73         return String.format("Capability %s: status field name: '%s', channel: '%s', channeltype: '%s'%s%s.",
74                 this.name(), statusFieldName, channel, channelType, command.isBlank() ? "" : ", custom command: ",
75                 command);
76     }
77 }