2 * Copyright (c) 2010-2021 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.nest.internal;
15 import java.time.Duration;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.core.thing.ThingTypeUID;
21 * The {@link NestBindingConstants} class defines common constants, which are
22 * used across the whole binding.
24 * @author David Bennett - Initial contribution
27 public class NestBindingConstants {
29 public static final String BINDING_ID = "nest";
31 /** The URL to use to connect to Nest with. */
32 public static final String NEST_URL = "https://developer-api.nest.com";
34 /** The URL to get the access token when talking to Nest. */
35 public static final String NEST_ACCESS_TOKEN_URL = "https://api.home.nest.com/oauth2/access_token";
37 /** The path to set values on the thermostat when talking to Nest. */
38 public static final String NEST_THERMOSTAT_UPDATE_PATH = "/devices/thermostats/";
40 /** The path to set values on the structure when talking to Nest. */
41 public static final String NEST_STRUCTURE_UPDATE_PATH = "/structures/";
43 /** The path to set values on the camera when talking to Nest. */
44 public static final String NEST_CAMERA_UPDATE_PATH = "/devices/cameras/";
46 /** The path to set values on the camera when talking to Nest. */
47 public static final String NEST_SMOKE_ALARM_UPDATE_PATH = "/devices/smoke_co_alarms/";
49 /** The JSON content type used when talking to Nest. */
50 public static final String JSON_CONTENT_TYPE = "application/json";
52 /** To keep the streaming REST connection alive Nest sends every 30 seconds a message. */
53 public static final long KEEP_ALIVE_MILLIS = Duration.ofSeconds(30).toMillis();
55 /** To avoid API throttling errors (429 Too Many Requests) Nest recommends making at most one call per minute. */
56 public static final int MIN_SECONDS_BETWEEN_API_CALLS = 60;
58 // List of all Thing Type UIDs
59 public static final ThingTypeUID THING_TYPE_THERMOSTAT = new ThingTypeUID(BINDING_ID, "thermostat");
60 public static final ThingTypeUID THING_TYPE_CAMERA = new ThingTypeUID(BINDING_ID, "camera");
61 public static final ThingTypeUID THING_TYPE_SMOKE_DETECTOR = new ThingTypeUID(BINDING_ID, "smoke_detector");
62 public static final ThingTypeUID THING_TYPE_BRIDGE = new ThingTypeUID(BINDING_ID, "account");
63 public static final ThingTypeUID THING_TYPE_STRUCTURE = new ThingTypeUID(BINDING_ID, "structure");
65 // List of all channel group prefixes
66 public static final String CHANNEL_GROUP_CAMERA_PREFIX = "camera#";
67 public static final String CHANNEL_GROUP_LAST_EVENT_PREFIX = "last_event#";
69 // List of all Channel IDs
70 // read only channels (common)
71 public static final String CHANNEL_LAST_CONNECTION = "last_connection";
73 // read/write channels (thermostat)
74 public static final String CHANNEL_MODE = "mode";
75 public static final String CHANNEL_SET_POINT = "set_point";
76 public static final String CHANNEL_MAX_SET_POINT = "max_set_point";
77 public static final String CHANNEL_MIN_SET_POINT = "min_set_point";
78 public static final String CHANNEL_FAN_TIMER_ACTIVE = "fan_timer_active";
79 public static final String CHANNEL_FAN_TIMER_DURATION = "fan_timer_duration";
81 // read only channels (thermostat)
82 public static final String CHANNEL_ECO_MAX_SET_POINT = "eco_max_set_point";
83 public static final String CHANNEL_ECO_MIN_SET_POINT = "eco_min_set_point";
84 public static final String CHANNEL_LOCKED = "locked";
85 public static final String CHANNEL_LOCKED_MAX_SET_POINT = "locked_max_set_point";
86 public static final String CHANNEL_LOCKED_MIN_SET_POINT = "locked_min_set_point";
87 public static final String CHANNEL_TEMPERATURE = "temperature";
88 public static final String CHANNEL_HUMIDITY = "humidity";
89 public static final String CHANNEL_PREVIOUS_MODE = "previous_mode";
90 public static final String CHANNEL_STATE = "state";
91 public static final String CHANNEL_CAN_HEAT = "can_heat";
92 public static final String CHANNEL_CAN_COOL = "can_cool";
93 public static final String CHANNEL_FAN_TIMER_TIMEOUT = "fan_timer_timeout";
94 public static final String CHANNEL_HAS_FAN = "has_fan";
95 public static final String CHANNEL_HAS_LEAF = "has_leaf";
96 public static final String CHANNEL_SUNLIGHT_CORRECTION_ENABLED = "sunlight_correction_enabled";
97 public static final String CHANNEL_SUNLIGHT_CORRECTION_ACTIVE = "sunlight_correction_active";
98 public static final String CHANNEL_TIME_TO_TARGET = "time_to_target";
99 public static final String CHANNEL_USING_EMERGENCY_HEAT = "using_emergency_heat";
101 // read/write channels (camera)
102 public static final String CHANNEL_CAMERA_STREAMING = "camera#streaming";
104 // read only channels (camera)
105 public static final String CHANNEL_CAMERA_AUDIO_INPUT_ENABLED = "camera#audio_input_enabled";
106 public static final String CHANNEL_CAMERA_VIDEO_HISTORY_ENABLED = "camera#video_history_enabled";
107 public static final String CHANNEL_CAMERA_WEB_URL = "camera#web_url";
108 public static final String CHANNEL_CAMERA_APP_URL = "camera#app_url";
109 public static final String CHANNEL_CAMERA_PUBLIC_SHARE_ENABLED = "camera#public_share_enabled";
110 public static final String CHANNEL_CAMERA_PUBLIC_SHARE_URL = "camera#public_share_url";
111 public static final String CHANNEL_CAMERA_SNAPSHOT_URL = "camera#snapshot_url";
112 public static final String CHANNEL_CAMERA_LAST_ONLINE_CHANGE = "camera#last_online_change";
114 public static final String CHANNEL_LAST_EVENT_HAS_SOUND = "last_event#has_sound";
115 public static final String CHANNEL_LAST_EVENT_HAS_MOTION = "last_event#has_motion";
116 public static final String CHANNEL_LAST_EVENT_HAS_PERSON = "last_event#has_person";
117 public static final String CHANNEL_LAST_EVENT_START_TIME = "last_event#start_time";
118 public static final String CHANNEL_LAST_EVENT_END_TIME = "last_event#end_time";
119 public static final String CHANNEL_LAST_EVENT_URLS_EXPIRE_TIME = "last_event#urls_expire_time";
120 public static final String CHANNEL_LAST_EVENT_WEB_URL = "last_event#web_url";
121 public static final String CHANNEL_LAST_EVENT_APP_URL = "last_event#app_url";
122 public static final String CHANNEL_LAST_EVENT_IMAGE_URL = "last_event#image_url";
123 public static final String CHANNEL_LAST_EVENT_ANIMATED_IMAGE_URL = "last_event#animated_image_url";
124 public static final String CHANNEL_LAST_EVENT_ACTIVITY_ZONES = "last_event#activity_zones";
126 // read/write channels (smoke detector)
128 // read only channels (smoke detector)
129 public static final String CHANNEL_UI_COLOR_STATE = "ui_color_state";
130 public static final String CHANNEL_LOW_BATTERY = "low_battery";
131 public static final String CHANNEL_CO_ALARM_STATE = "co_alarm_state"; // Also in structure
132 public static final String CHANNEL_SMOKE_ALARM_STATE = "smoke_alarm_state"; // Also in structure
133 public static final String CHANNEL_MANUAL_TEST_ACTIVE = "manual_test_active";
134 public static final String CHANNEL_LAST_MANUAL_TEST_TIME = "last_manual_test_time";
136 // read/write channel (structure)
137 public static final String CHANNEL_AWAY = "away";
139 // read only channels (structure)
140 public static final String CHANNEL_COUNTRY_CODE = "country_code";
141 public static final String CHANNEL_POSTAL_CODE = "postal_code";
142 public static final String CHANNEL_PEAK_PERIOD_START_TIME = "peak_period_start_time";
143 public static final String CHANNEL_PEAK_PERIOD_END_TIME = "peak_period_end_time";
144 public static final String CHANNEL_TIME_ZONE = "time_zone";
145 public static final String CHANNEL_ETA_BEGIN = "eta_begin";
146 public static final String CHANNEL_RUSH_HOUR_REWARDS_ENROLLMENT = "rush_hour_rewards_enrollment";
147 public static final String CHANNEL_SECURITY_STATE = "security_state";