public class NestFunctions
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
apiKey |
private static com.google.gson.JsonObject |
model |
private static java.lang.String |
thermId |
private static java.lang.String |
thermName |
private static java.lang.String |
units |
| Constructor and Description |
|---|
NestFunctions() |
| Modifier and Type | Method and Description |
|---|---|
static com.amazon.speech.speechlet.SpeechletResponse |
failedCard(java.lang.String message,
java.lang.String cardContent)
A method for sending a failure response to the user
|
static com.amazon.speech.speechlet.SpeechletResponse |
fanSwitch(boolean on)
Sets the fan on or off
|
static com.amazon.speech.speechlet.SpeechletResponse |
InitiateResponse(com.amazon.speech.slu.Intent intent) |
static com.amazon.speech.speechlet.SpeechletResponse |
modeChange(com.amazon.speech.slu.Intent intent)
A method to change between thermostat modes, either heat, cool, heat-cool or off
|
static java.lang.String |
nameToThermId(java.lang.String thermNameRaw)
A utility for identifying the thermostat ID based on the name passed by the user
|
private static java.util.HashMap<java.lang.String,java.lang.String> |
nestCom(java.lang.String JSON)
A method that sends data to the Nest via the Nest API
|
private static java.util.HashMap<java.lang.String,com.google.gson.JsonObject> |
queryDevice()
A method that builds a model of the device's current state
|
static com.amazon.speech.speechlet.SpeechletResponse |
quickAdjust(boolean warmer)
Method to quickly adjust temperature by two degrees with a simple "quick" request
|
static com.amazon.speech.speechlet.SpeechletResponse |
quickFilter(com.amazon.speech.slu.Intent intent)
A utility method to determine which direction a user desired the temperature to move in a "quick" 2 degree adjustment
|
static com.amazon.speech.speechlet.SpeechletResponse |
setTemp(boolean high,
int temp)
Sets either the high or low temperature of the range in heat-cool mode
|
static com.amazon.speech.speechlet.SpeechletResponse |
setTemp(int low,
int high)
The following method sets the tempearutre between the given values
|
static com.amazon.speech.speechlet.SpeechletResponse |
singleTemp(com.amazon.speech.slu.Intent intent)
Sets a temperature when in heat or cool mode
|
static com.amazon.speech.speechlet.SpeechletResponse |
specAdjustment(com.amazon.speech.slu.Intent intent)
Method to adjust the temperature a given direction and specified number of degrees.
|
static com.amazon.speech.speechlet.SpeechletResponse |
tempAdjuster(int degrees,
java.lang.String direction)
A method for adjusting the temperature the given amount in the given direction
|
static com.amazon.speech.speechlet.SpeechletResponse |
tempCall(com.amazon.speech.slu.Intent intent)
Interprets the type of temperature call, whether it be range or single temperature
|
static com.amazon.speech.speechlet.SpeechletResponse |
tempCall(com.amazon.speech.slu.Slot lowSlot,
com.amazon.speech.slu.Slot highSlot,
com.amazon.speech.slu.Slot rangeSlot) |
static com.amazon.speech.speechlet.SpeechletResponse |
tempQuery()
Returns an information response to the user including the current temperature and settings
|
static com.amazon.speech.speechlet.SpeechletResponse |
whereTempCall(com.amazon.speech.slu.Intent intent) |
private static java.lang.String thermName
private static java.lang.String thermId
private static java.lang.String apiKey
private static java.lang.String units
private static com.google.gson.JsonObject model
public static com.amazon.speech.speechlet.SpeechletResponse InitiateResponse(com.amazon.speech.slu.Intent intent)
throws com.amazon.speech.speechlet.SpeechletException
com.amazon.speech.speechlet.SpeechletExceptionpublic static com.amazon.speech.speechlet.SpeechletResponse whereTempCall(com.amazon.speech.slu.Intent intent)
public static com.amazon.speech.speechlet.SpeechletResponse tempCall(com.amazon.speech.slu.Intent intent)
intent - an Intent indicating a temperature requestpublic static com.amazon.speech.speechlet.SpeechletResponse tempCall(com.amazon.speech.slu.Slot lowSlot,
com.amazon.speech.slu.Slot highSlot,
com.amazon.speech.slu.Slot rangeSlot)
public static com.amazon.speech.speechlet.SpeechletResponse setTemp(int low,
int high)
low - an Integer indicating the low value for the temperature range in heat-cool modehigh - an Integer indicating the high value for the temperature range in heat-cool modepublic static com.amazon.speech.speechlet.SpeechletResponse setTemp(boolean high,
int temp)
high - a Boolean indicating if the temperature to be changed is the high (true) or low (false)temp - an Integer of the desired temperature for the rangepublic static com.amazon.speech.speechlet.SpeechletResponse tempQuery()
public static com.amazon.speech.speechlet.SpeechletResponse singleTemp(com.amazon.speech.slu.Intent intent)
intent - an Intent indicating a single temperature changepublic static com.amazon.speech.speechlet.SpeechletResponse modeChange(com.amazon.speech.slu.Intent intent)
intent - an Intent indicating a mode change requestpublic static com.amazon.speech.speechlet.SpeechletResponse fanSwitch(boolean on)
on - a Boolean indicating if the fan is to be turned on or shut offpublic static com.amazon.speech.speechlet.SpeechletResponse quickFilter(com.amazon.speech.slu.Intent intent)
intent - an Intent indicating a "quick" adjustment intentpublic static com.amazon.speech.speechlet.SpeechletResponse quickAdjust(boolean warmer)
warmer - a Boolean to indicate if the temperature should be increased or decreasedpublic static com.amazon.speech.speechlet.SpeechletResponse specAdjustment(com.amazon.speech.slu.Intent intent)
intent - an Intent indicating a directional temperature commandpublic static com.amazon.speech.speechlet.SpeechletResponse tempAdjuster(int degrees,
java.lang.String direction)
degrees - an Integer representing the desired number of degreesdirection - the direction to move the temperaturepublic static com.amazon.speech.speechlet.SpeechletResponse failedCard(java.lang.String message,
java.lang.String cardContent)
message - a String with the method-specific failure message to read to the usercardContent - a String with content for a card to be passed with the responseprivate static java.util.HashMap<java.lang.String,com.google.gson.JsonObject> queryDevice()
private static java.util.HashMap<java.lang.String,java.lang.String> nestCom(java.lang.String JSON)
JSON - a JSON string of the fields to be updatedpublic static java.lang.String nameToThermId(java.lang.String thermNameRaw)
thermNameRaw - a String representing the thermostat's raw name