]> git.basschouten.com Git - openhab-addons.git/blob
33ce0f8cac9aad18371da9b14f65f9334b0a508e
[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     COLLECT_DUST("auto_dust_collection", "actions#collect_dust", "miio:collect_dust", ""),
43     CLEAN_MOP_START("dry_status", "actions#clean_mop_start", "miio:clean_mop_start", ""),
44     CLEAN_MOP_STOP("dry_status", "actions#clean_mop_stop", "miio:clean_mop_stop", ""),
45     MOP_DRYING("dry_status", "status#is_mop_drying", "miio:is_mop_drying", ""),
46     MOP_DRYING_REMAINING_TIME("dry_status", "status#mop_drying_time", "miio:mop_drying_time", ""),
47     DOCK_STATE("dock_error_status", "status#dock_state", "miio:dock_state", ""),
48     DOCK_STATE_ID("dock_error_status", "status#dock_state_id", "miio:dock_state_id", "");
49
50     private final String statusFieldName;
51     private final String channel;
52     private final String channelType;
53     private final String command;
54
55     RobotCababilities(String statusKey, String channel, String channelType, String command) {
56         this.statusFieldName = statusKey;
57         this.channel = channel;
58         this.channelType = channelType;
59         this.command = command;
60     }
61
62     public String getStatusFieldName() {
63         return statusFieldName;
64     }
65
66     public String getChannel() {
67         return channel;
68     }
69
70     public ChannelTypeUID getChannelType() {
71         return new ChannelTypeUID(channelType);
72     }
73
74     public String getCommand() {
75         return command;
76     }
77
78     @Override
79     public String toString() {
80         return String.format("Capability %s: status field name: '%s', channel: '%s', channeltype: '%s'%s%s.",
81                 this.name(), statusFieldName, channel, channelType, command.isBlank() ? "" : ", custom command: ",
82                 command);
83     }
84 }