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