]> git.basschouten.com Git - openhab-addons.git/blob
05962ef777cf2d430c5c77b7b052cfa85b23aca9
[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.gree.internal;
14
15 import java.util.Collections;
16 import java.util.Set;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.openhab.core.thing.ThingTypeUID;
20
21 /**
22  * The {@link GreeBindingConstants} class defines common constants, which are
23  * used across the whole binding.
24  *
25  * @author John Cunha - Initial contribution
26  * @author Markus Michels - Refactoring, adapted to OH 2.5x
27  */
28 @NonNullByDefault
29 public class GreeBindingConstants {
30
31     public static final String BINDING_ID = "gree";
32
33     public static final ThingTypeUID THING_TYPE_GREEAIRCON = new ThingTypeUID(BINDING_ID, "airconditioner");
34     public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections.singleton(THING_TYPE_GREEAIRCON);
35
36     // List of all Thing Type UIDs
37     public static final ThingTypeUID GREE_THING_TYPE = new ThingTypeUID(BINDING_ID, "airconditioner");
38
39     // Thing configuration items
40     public static final String PROPERTY_IP = "ipAddress";
41     public static final String PROPERTY_BROADCAST = "broadcastAddress";
42
43     // List of all Channel ids
44     public static final String POWER_CHANNEL = "power";
45     public static final String MODE_CHANNEL = "mode";
46     public static final String TURBO_CHANNEL = "turbo";
47     public static final String LIGHT_CHANNEL = "light";
48     public static final String TARGET_TEMP_CHANNEL = "temperature";
49     public static final String CURRENT_TEMP_CHANNEL = "currentTemperature";
50     public static final String SWINGUD_CHANNEL = "swingUpDown";
51     public static final String SWINGLR_CHANNEL = "swingLeftRight";
52     public static final String WINDSPEED_CHANNEL = "windspeed";
53     public static final String QUIET_CHANNEL = "quiet";
54     public static final String AIR_CHANNEL = "air";
55     public static final String DRY_CHANNEL = "dry";
56     public static final String HEALTH_CHANNEL = "health";
57     public static final String PWRSAV_CHANNEL = "powersave";
58
59     // Mode channel
60     public static final String MODE_AUTO = "auto";
61     public static final String MODE_COOL = "cool";
62     public static final String MODE_DRY = "dry";
63     public static final String MODE_FAN = "fan";
64     public static final String MODE_FAN2 = "fan-only";
65     public static final String MODE_HEAT = "heat";
66     public static final String MODE_ECO = "eco";
67     public static final String MODE_ON = "on";
68     public static final String MODE_OFF = "off";
69     public static final int GREE_MODE_AUTO = 0;
70     public static final int GREE_MODE_COOL = 1;
71     public static final int GREE_MODE_DRY = 2;
72     public static final int GREE_MODE_FAN = 3;
73     public static final int GREE_MODE_HEAT = 4;
74
75     // Quiet channel
76     public static final String QUIET_OFF = "off";
77     public static final String QUIET_AUTO = "auto";
78     public static final String QUIET_QUIET = "quiet";
79     public static final int GREE_QUIET_OFF = 0;
80     public static final int GREE_QUIET_AUTO = 1;
81     public static final int GREE_QUIET_QUIET = 2;
82
83     // UDPPort used to communicate using UDP with GREE Airconditioners. .
84     public static final String VENDOR_GREE = "gree";
85     public static final int GREE_PORT = 7000;
86
87     public static final String GREE_CID = "app";
88     public static final String GREE_CMDT_BIND = "bind";
89     public static final String GREE_CMDT_SCAN = "scan";
90     public static final String GREE_CMDT_STATUS = "status";
91     public static final String GREE_CMDT_CMD = "cmd";
92     public static final String GREE_CMDT_PACK = "pack";
93
94     public static final String GREE_CMD_OPT_NAME = "name"; // unit name
95     public static final String GREE_CMD_OPT_HOST = "host"; // remote host (cloud)
96
97     /*
98      * Note : Values can be:
99      * "Pow": Power (0 or 1)
100      * "Mod": Mode: Auto: 0, Cool: 1, Dry: 2, Fan: 3, Heat: 4
101      * "SetTem": Requested Temperature
102      * "WdSpd": Fan Speed : Low:1, Medium Low:2, Medium :3, Medium High :4, High :5
103      * "Air": Air Mode Enabled
104      * "Blo": Dry
105      * "Health": Health
106      * "SwhSlp": Sleep
107      * "SlpMod": ???
108      * "Lig": Light On
109      * "SwingLfRig": Swing Left Right
110      * "SwUpDn": Swing Up Down: // Ceiling:0, Upwards : 10, Downwards : 11, Full range : 1
111      * "Quiet": Quiet mode
112      * "Tur": Turbo
113      * "StHt": 0,
114      * "TemUn": Temperature unit, 0 for Celsius, 1 for Fahrenheit
115      * "HeatCoolType"
116      * "TemRec": (0 or 1), Send with SetTem, when TemUn==1, distinguishes between upper and lower integer Fahrenheit
117      * temp
118      * "SvSt": Power Saving
119      */
120     public static final String GREE_PROP_POWER = "Pow";
121     public static final String GREE_PROP_MODE = "Mod";
122     public static final String GREE_PROP_SWINGUPDOWN = "SwUpDn";
123     public static final String GREE_PROP_SWINGLEFTRIGHT = "SwingLfRig";
124     public static final String GREE_PROP_WINDSPEED = "WdSpd";
125     public static final String GREE_PROP_AIR = "Air";
126     public static final String GREE_PROP_DRY = "Blo";
127     public static final String GREE_PROP_TURBO = "Tur";
128     public static final String GREE_PROP_QUIET = "Quiet";
129     public static final String GREE_PROP_NOISE = "NoiseSet";
130     public static final String GREE_PROP_LIGHT = "Lig";
131     public static final String GREE_PROP_HEALTH = "Health";
132     public static final String GREE_PROP_SLEEP = "SwhSlp";
133     public static final String GREE_PROP_SLEEPMODE = "SlpMod";
134     public static final String GREE_PROP_PWR_SAVING = "SvSt";
135     public static final String GREE_PROP_SETTEMP = "SetTem";
136     public static final String GREE_PROP_TEMPUNIT = "TemUn";
137     public static final String GREE_PROP_TEMPREC = "TemRec";
138     public static final String GREE_PROP_HEAT = "StHt";
139     public static final String GREE_PROP_HEATCOOL = "HeatCoolType";
140     public static final String GREE_PROP_NOISESET = "NoiseSet";
141     public static final String GREE_PROP_CURRENT_TEMP_SENSOR = "TemSen";
142
143     // Temperatur types and min/max ranges
144     public static final int TEMP_UNIT_CELSIUS = 0;
145     public static final int TEMP_UNIT_FAHRENHEIT = 1;
146     public static final int TEMP_MIN_C = 16;
147     public static final int TEMP_MAX_C = 30;
148     public static final int TEMP_MIN_F = 61;
149     public static final int TEMP_MAX_F = 86;
150     public static final int TEMP_HALFSTEP_NO = 0;
151     public static final int TEMP_HALFSTEP_YES = 1;
152
153     /*
154      * The timeout for the Datagram socket used to communicate with Gree Airconditioners.
155      * This is particularly important when scanning for devices because this will effectively
156      * be the amount of time spent scanning.
157      */
158     public static final int DATAGRAM_SOCKET_TIMEOUT = 5000; // regular read timeout
159     public static final int DISCOVERY_TIMEOUT_MS = 7000; // do not change!!
160     public static final int MAX_SCAN_CYCLES = 3;
161     public static final int REFRESH_INTERVAL_SEC = 5;
162     public static final int MAX_API_RETRIES = 3;
163
164     public static final int DIGITS_TEMP = 1;
165
166     /**
167      * The internal offset for the temperature sensor which is set to a constant of -40 degrees Celsius. GREE
168      * airconditioners usually return a value from the temperature sensor which is offset by +40 degrees Celsius. The
169      * temperature value shown on the device LCD display should match the value shown by this binding when the config
170      * parameter currentTemperatureOffset is set to 0.
171      *
172      * @See https://github.com/tomikaa87/gree-remote#getting-the-current-temperature-reading-from-the-internal-sensor
173      *      for more details.
174      */
175     public static final double INTERNAL_TEMP_SENSOR_OFFSET = -40.0;
176 }