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