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.tapocontrol.internal.constants;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
18 * The {@link TapoBindingSettings} class defines common constants, which are
19 * used across the whole binding.
21 * @author Christian Wild - Initial contribution
24 public class TapoBindingSettings {
25 public static final String BINDING_ID = "tapocontrol";
27 // List of all constant configurations
28 public static final String HTTP_HEADER_AUTH = "Authorization";
29 public static final String HTTP_AUTH_TYPE_BASIC = "Basic";
30 public static final String HTTP_AUTH_TYPE_COOKIE = "cookie";
31 public static final String CONTENT_CHARSET = "UTF-8";
32 public static final String CONTENT_TYPE_JSON = "application/json";
33 public static final String TAPO_CLOUD_URL = "https://eu-wap.tplinkcloud.com";
34 public static final String TAPO_APP_TYPE = "Tapo_Ios";
35 public static final String TAPO_DEVICE_URL = "http://%s/app";
36 public static final Integer HTTP_MAX_CONNECTIONS = 10; // setMaxConnectionsPerDestination for HTTP-Client
37 public static final Integer HTTP_MAX_QUEUED_REQUESTS = 10; // setMaxRequestsQueuedPerDestination for HTTP-Client
38 public static final Integer TAPO_HTTP_TIMEOUT_MS = 5000; // http request timeout
39 public static final Integer TAPO_PING_TIMEOUT_MS = 2000; // ping timeout
40 public static final Integer TAPO_REFRESH_MIN_GAP_MS = 5000; // min gap between sending refresh request
41 public static final Integer TAPO_SEND_MIN_GAP_MS = 1000; // min gap between sending command request
42 public static final Integer TAPO_LOGIN_MIN_GAP_MS = 5000; // min gap between sending login request
43 public static final Integer TAPO_LOGIN_MAX_GAP_M = 1440; // max minutes to relogin to device
44 public static final Integer TAPO_DISCOVERY_TIMEOUT_S = 6; // timout device discovery in seconds
45 public static final Integer POLLING_MIN_INTERVAL_S = 10; // min polling interval (settings)
47 // FORMATING CONSTANTS
48 public static final String IPV4_REGEX = "(([0-1]?[0-9]{1,2}\\.)|(2[0-4][0-9]\\.)|(25[0-5]\\.)){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))";
49 public static final char MAC_DIVISION_CHAR = '-';
51 // LIST OF DEVICE-COMMANDS
52 public static final String DEVICE_CMD_GETINFO = "get_device_info";
53 public static final String DEVICE_CMD_SETINFO = "set_device_info";
54 public static final String DEVICE_CMD_GETENERGY = "get_energy_usage";
55 public static final String DEVICE_CMD_CUSTOM = "custom_command";