EcoAdaptor for Nest

Overview

This document covers the steps required to integrate a Customer Application with Arrayent’s EcoAdaptor for Nest.

Arrayent’s EcoAdaptor for Nest provides customers the ability to link its product’s functionality with the end user’s Nest account. Arrayent will represent a Nest user account as an Arrayent device associated to an Arrayent user account. The device representing the Nest user account is referred to as the Nest Virtual Device in Arrayent Connect Cloud (ACC) and uses the Nest Virtual Device Data Model. Attributes in the Nest Virtual Device data model represent attributes at the account level as well as the device level of the Nest User account. The Nest User account has Nest Structures (usually corresponding to physical locations) and Nest Devices within the Nest Structures (such as thermostats and smoke detectors). Devices “belong” to a certain Nest Structure, usually where they are physically installed.

Getting Started

Background

A Customer Application can interact with the Arrayent Connect Cloud and the Arrayent EcoAdaptor for Nest via an Application SDK (for iOS or Android) or by accessing Arrayent’s Web APIs directly. Application Developers should be familiar with how to read and write attributes from the Arrayent Connect Cloud and be familiar with the Arrayent Alert Engine. For an overview of the Arrayent Web APIs, please see the online documentation Web Service API Reference. For a general overview of Arrayent Cloud Alerts, read the Alerts Guide. Arrayent Cloud Alerts consists of a set of triggers defined for a device that will cause an action if a certain attribute value meets a specific criteria. For example, a trigger can be defined such that if the attribute representing the Nest structure home/away status is equal to ‘home’, then the Arrayent Cloud Alert can send an attribute update to the Arrayent Device associated to the same user account. This attribute update can command the Arrayent Device to perform some action based on the change in the Home/Away status.

Assumptions

This document assumes the following:

  1. Developer is familiar with the Arrayent API.
  2. Developer is familiar with the Nest data model. (See Nest data model <https://developer.nest.com/documentation/api-reference).

Prerequisites

Prerequisite for “Works With Nest”

  1. Developer has a Nest developer account and has created a Nest client (https://developer.nest.com/clients/new) that represents his application for Nest. Developer has recorded the client_id and client_secret provided by Nest. Developer must provide a redirect_URI when setting up the client.
  2. Developer must have a Nest User account to mimic an end user. To create a Nest User account go to https://home.nest.com/
  3. Developer should keep Nest Best Practices in mind when designing their app to ensure a smooth Nest certification process.

Prerequisite to create a Nest Access Token

A Nest Access token is a token used to represent the end user when accessing his/her data in the Nest cloud. The authorization is specific to a particular application so each auth_token is not only Nest User specific but also application specific and should be used to identify and authorize access to the end user information in the Nest cloud. To create a Nest authorization token, the client application requires the following information:

  1. Client ID
  2. Client Secret

Arrayent’s Data Model

Arrayent represents the Nest User Account as an Arrayent Data Model named Nest. After successfully federating the Nest User Account to an Arrayent Connect Cloud (ACC) User Account, the Nest virtual data model will be instantiated for the ACC User. Nest will then stream updates from the Nest User Account to the Arrayent EcoAdaptor, and the Arrayent EcoAdaptor will translate the Nest updates to attribute updates on Arrayent’s Nest virtual data model for the given Arrayent user. As of EcoAdaptor 1.1, Arrayent’s Nest data model contains about 400 attributes. These attributes represent the values of all possible Nest Structure states, Nest Thermostat states and Nest Protect states. Arrayent’s Nest data model supports a total of 40 Nest Thermostats (20 per Nest Structure) and 36 Nest Protects (18 per Nest Structure).

Nest Structures Overview

A Nest User Account may have at most two structures defined. A Nest Structure is synonymous to a user’s home. Therefore a user may have at most two ‘homes’ defined, typically a primary residence and a vacation residence. Nest Devices (Thermostats, Protects, etc) are associated with a particular structure. This is logical since a Thermostat or Protect is physically located in just one of the two possible user homes. Arrayent’s Nest User Account Data Model represents all possible Nest Structure that a user may have. If a Nest Structure is not in use, then the attribute value associated with that Nest Structure is left blank. The attribute names in the Arrayent Data Model for a Nest Structure looks like the following example:

d.structures[1].a.away
d.structures[2].a.away

The above example illustrates the two possible structures a user may have. Each one of the attributes may have a value indicating the Home/Away state for the structure. Arrayent applies an index to the attribute name to differentiate between the two structure attributes. d.structures[1].a.away represents the Home/Away status of structure 1, and d.structures[2].a.away represents the Home/Away status of structure 2. But index values 1 and 2 are arbitrary Arrayent-assigned indexes. To obtain a mapping of the Arrayent-assigned Nest Structure Index to the Nest Structure Identifier, call the GET largestrings API on the EcoAdaptor. The largestrings API takes two parameters, an Arrayent user security token and the id of the Nest Virtual device on the Arrayent’s user account. Sample largestrings API:

https://example.arrayent.com:8081/ecoadaptors/largestrings?secToken=1234-abcd&id=5678

Return value:

{
  "labels": {
    "Albert's Office": "yv0MKPfnpbP8WP2EGPKpviGr4xJyd3rzagYV6niscawAM3TeEjSdpw",
    "Albert's Home": "O3RvyQDBopx4Tx7qToKHsMyF5jwZ9AnJ06qydu2e5XKc86c-h6hkMA"
  },
  "identifiers": {
    "yv0MKPfnpbP8WP2EGPKpviGr4xJyd3rzagYV6niscawAM3TeEjSdpw": [
      "1"
    ],
    "ivbUNOPk-JbavyqnfjgvNeMx2Nrb3s7F": [
      "1",
      "thermostats",
      "Bedroom (FF64)",
      "yv0MKPfnpbP8WP2EGPKpviGr4xJyd3rzagYV6niscawAM3TeEjSdpw"
    ],
    "O3RvyQDBopx4Tx7qToKHsMyF5jwZ9AnJ06qydu2e5XKc86c-h6hkMA": [
      "2"
    ],
    "ivbUNOPk-JYV-F1lJya3FeMx2Nrb3s7F": [
      "1",
      "thermostats",
      "Basement (C84B)",
      "O3RvyQDBopx4Tx7qToKHsMyF5jwZ9AnJ06qydu2e5XKc86c-h6hkMA"
    ]
  }
}

The largestrings API returns a JSON mapping of Nest IDs to Arrayent Index values. The “labels” tag will provide a mapping between the Nest Structure Friendly Names and the Nest Structure IDs. The “identifiers” tags will then provide a mapping between the Nest Structure IDs and the Arrayent Index IDs used in the Arrayent Nest User Data Model attribute names.

Nest Devices Overview

Each Nest Structure may contain up to 20 Nest Thermostats and 18 Nest Protects. Arrayent’s Nest User Account Data Model represents all possible Nest Devices that a user may have within each Nest Structure. If a Nest Device is not populated in the Nest Structure, then the attribute value associated with that Nest Device is left blank. The attribute names in the Arrayent Data Model for a Nest Device looks like the following example:

d.structures[1].d.smokeCoAlarms[1].co_alarm_state
d.structures[1].d.thermostats[2].has_fan

The first example, d.structures[1].d.smokeCoAlarms[1].co_alarm_state, represents the Carbon Monoxide alarm state for the first Nest Protect in Nest Structure 1. The second example, d.structures[1].d.thermostats[2].has_fan, represents the presence of a fan in the second Nest Thermostat in Nest Structure 1. To obtain a mapping between the Arrayent device index used in the attribute names and the Nest Device IDs, use the GET largestrings EcoAdaptor API.

Arrayent Nest Device Attribute Overview

The following table describes the set of Arrayent Attributes representing the overall status of a Nest User account. The attribute names uses the variable X, where X represents the Nest Structure index used by Arrayent (1 or 2).

Attribute Name Data Type Possible Values Description
o.totalStructures readonly Integer 1 or 2 Number of Nest Structures in Nest User Account
o.structures[X].totals.thermostats readonly Integer 0-20 Number of Nest Thermostats in a given Nest Structure
o.structures[X].totals.smokeCOAlarms readonly Integer 0-18 Number of Nest Protects in a given Nest Structure
o.structures[X].warnings.all readonly Boolean string true/false Boolean representing if a any type of warning is detected on any Nest Protects in a given Nest Structure
o.structures[X].warnings.smoke readonly Boolean string true/false Boolean representing if a smoke warning is detected on any Nest Protects in a given Nest Structure
o.structures[X].warnings.CO readonly Boolean string true/false Boolean representing if a CO warning is detected on any Nest Protects in a given Nest Structure
o.structures[X].emergencies.all readonly Boolean string true/false Boolean representing if a any type of emergency is detected on any Nest Protects in a given Nest Structure
o.structures[X].emergencies.smoke readonly Boolean string true/false Boolean representing if a smoke emergency is detected on any Nest Protects in a given Nest Structure
o.structures[X].emergencies.CO readonly Boolean string true/false Boolean representing if a CO emergency is detected on any Nest Protects in a given Nest Structure

The following table describes the set of Arrayent Attributes representing the status of an individual Nest Device in the Nest User account. The attribute names uses the variable X and Y, where X represents the Nest Structure index used by Arrayent (1 or 2) and Y represents the Nest Device index used by Arrayent (1-20 for Nest Thermostats, 1-18 for Nest Protects).

Attribute Name Data Type Possible Values Description
d.structures[X].a.away readonly String home, away, auto-away, unknown Home/Away state for a given Nest Structure
d.structures[X].a.name readonly String Any valid string User assigned friendly name for a given Nest Structure
d.structures[X].a.structure_id readonly String Any valid string Nest assigned ID for a given Nest Structure
d.structures[X].d.thermostat[Y].name readonly String Any valid string User assigned friendly name for a given Nest Thermostat
d.structures[X].d.thermostat[Y].device_id readonly String Any valid string Nest assigned ID for a given Nest Thermostat
d.structures[X].d.thermostat[Y].is_online readonly Boolean String true/false Online status of a Nest Thermostat
d.structures[X].d.thermostat[Y].has_fan readonly Boolean String true/false Fan presence status of a Nest Thermostat
d.structures[X].d.thermostat[Y].fan_timer_active readonly Boolean String true/false Fan timer active status of a Nest Thermostat
d.structures[X].d.thermostat[Y].fan_timer_active.requestWrite writable String true/false Attribute to request fan to turn on.
d.structures[X].d.thermostat[Y].fan_timer_timeout readonly Date and TIme String ISO 8601 representation of date and time. Date and time string representing when a fan time reaches 0 (end of timer duration) for a given Nest Thermostat in ISO 8601 format
d.structures[X].d.smokeCoAlarms[Y].name readonly String Any valid string User assigned friendly name for a given Nest Protect
d.structures[X].d.smokeCoAlarms[Y].device_id readonly String Any valid string Nest assigned ID for a given Nest Protect
d.structures[X].d.smokeCoAlarms[Y].is_online readonly Boolean String true/false Online status of a Nest Protect
d.structures[X].d.smokeCoAlarms[Y].co_alarm_state readonly String ok, warning, emergency CO Alarm state for a given Nest Protect
d.structures[X].d.smokeCoAlarms[Y].smoke_alarm_state readonly String ok, warning, emergency Smoke Alarm state for a given Nest Protect
d.structures[X].d.smokeCoAlarms[Y].ui_color_state readonly String gray, green, yellow, red UI color state for a given Nest Protect

Federating/Defederating Nest User Account

Federating with Nest is a 5 step process.

  1. Redirect end user to the Nest Cloud for end user to authorize your application to Work With Nest (WWNest)
  2. Obtain a Nest authorization token for the end user account
  3. Provide the authorizastion token to Arrayent EcoAdaptor using Arrayent EcoAdaptor API or the Arrayent Application SDK to federate the user’s Arrayent account with the user’s Nest account
  4. Retrieve friendly names for Nest User Account’s structures.
  5. Define Arrayent Cloud Alerts to perform actions based on changes in Nest Account attributes and visa versa.

Detailed Nest Account and Arrayent Account Federation Flow

The best description of how to federate is found in https://developer.nest.com/documentation/cloud/how-to-auth A brief description of the steps required to work with Arrayent are:

  1. The application redirects the end user to the Nest cloud and using the client_id obtained from Nest do a GET on the URL specified in the Authorization URL in the client page for the application. For example:
    GET https://home.nest.com/login/oauth2?client_id=XXXX&state=STATE.
    

    This will prompt the end user to enter his/her Nest credentials to authorize the application to work with Nest. A brief description of what the application will do with Nest is displayed as a reminder to the end user. If the end user authorizes the application to work with Nest, Nest cloud will respond with the redirect_URI and a temporary code in the form of:

    REDIRECT_URI?code="yyyyy"&state=STATE
    
  1. The application must capture the REDIRECT and extract the “code” out of it and then submit to the Access token URL as specified in the client page for the application. For example:
    POST https://api.home.nest.com/oauth2/access_token?code=STRING&client_id=XXXX&client_secret=YYYY&grant_type=authorization_code
    
  2. This will respond with something like:
    {
     "access_token": "c.FmDPkzyzaQe...",
     "expires_in": 315569260
    }
    
  3. Using the value from access_token, Application must POST this value to Arrayent cloud to federate between the end user Arrayent account and the end user Nest account.
    1. If using Web APIs:
      POST https://example.arrayent.com:8081/ecoadaptors/federatedtokens?secToken=923-4987123&anEcosystemName=Nest&anAccessToken=c.FmDPkzyzaQe
      

      If successful Arrayent returns the deviceId of the Nest Virtual Device created in the Arrayent Connect Cloud to represent the Nest account. For example:

      { "DeviceId": "201338848" }
      
    2. If using Application SDK (Android/iOS) developers:
      1. First initialize Application SDK with URL for Arrayent’s Nest EcoAdapter. This URL will be provided by Arrayent. Call Arrayent Application SDK’s setEcoCloudUrl() method with Arrayent’s Nest Adapter URL. Note: In iOS this is in the AppEngine class and in Android, this is in the Arrayent class.
      2. Call Arrayent Application SDK’s updateFederatedToken() method with the Access Token obtained from Nest. See appendix for more details.
  4. Obtain the Arrayent DeviceId for the Nest Account. You may have captured the Arrayent DeviceId for the Nest account in the previous step, but you may wish to obtain it again in future login sessions:
    1. Obtain the deviceId for Nest device
      1. If using Web APIs – call Arrayent getDeviceListThe getDeviceList Web API will return something list this:
        <devList>
         <devId>201338848</devId>
         <devName>Nest13724_1</devName>
         <typeId>384</typeId>
         <sleepMode>SHORT</sleepMode>
         <appID>1124</appID>
         <userID>13724</userID>
        </devList>
        
      2. If using Application SDK’s call getDevices() method to obtain the list of devices associated to user account.
    2. If the Nest User Account device is present, move on to next step.
    3. If the Nest User Account device is not present, inform user that an error occurred.
  5. Customer App defines Arrayent Cloud Alerts to perform Arrayent Device actions based on changes in Nest Home/Away state.
    1. Use Arrayent APIs to create an Arrayent Alert and pass in a valid alert definition.
    2. In iOS, the AlertInfo object describes the alert definition
    3. In Android, the TriggerConfig object describes the alert definition.
    4. See appendix for more details.

Common Use Cases

Home/Away State Change Causes Device State Change

When Nest updates the Home/Away state in their cloud, the Nest Structure attribute change will show up in the Arrayent Nest Data Model. The change will show up in either attribute d.structures[1].a.away or attribute d.structures[2].a.away, depending on the Nest Structure. To have this Nest state change perform an action on a Device, define an ‘Attribute Alert’ so that the update of the Home/Away attribute in the Arrayent Nest Data Model will trigger a corresponding attribute update on the Device. For example, let’s assume we have a simple Device with attribute setled1 that accepts two possible values, 0 for off and 1 for on. In this example, we’ll want to turn the led on when Nest reports Home/Away status is ‘home’ and turn the led off when when Nest reports Home/Away status is ‘away’ or ‘auto-away’. In order to satisfy this use case, we’ll call Arrayent’s addTrigger API to define an Attribute Alert. The addTrigger takes a series of parameters that defines alerts in general. For the specific use case of interacting with the Arrayent Nest Data Model, the following parameters should be set:

Parameter Name Value Description
secToken string This is the user’s security token.
devId int This is the device Id of the Nest device in Arrayent.
action attribute Set to ‘attribute’ for Attribute Alerts.
attrName d.structures[X].a.away The Nest Home/Away status. Note X needs represents 1 or 2, depending on the Nest Structure the end user has selected.
operation regex Use Regular expression matching of the attribute value
stringThreshold *.away or home *.away will match against ‘away’ or ‘auto-away’. That will be used for the alert to turn LED off. home will match against ‘home’. This will be used for a second alert to turn LED on.
address “” Set to empty string
msg “” Set to empty string
autoDisarm true Set auto-disarm to True. See auto-disarm documentation for more information.
autoDelete false Set auto-delete to False. See auto-delete documentation for more information.
autoDisable false Set auto-disable to False. See auto-disable documentation for more information.
enable true Enable the alert.
targetDeviceAttributes 12345,setLed:”1” A comma separated string denoting: DeviceId,attributeName:”attributeValue”. For example, assuming that the Arrayent Device ID is 12345, the attributeName is setLed, and the attributeValue is 1. Then this value will be: 12345,setLed:"1". Note 12345 represents the deviceId of the destination device, not the Nest device.

Turn On Nest Fan Based On User Action

Overview

A user may use their application to trigger their Thermostat’s Fan to turn on. The application will update an attribute in the Arrayent Nest Data Model to turn on the fan. Arrayent Nest EcoAdaptor can send an update to the Nest Cloud to turn on the end user’s fan for a user-defined duration. This duration is defined via the Nest Application.

Steps

Before updating the Nest Data Model to turn on the fan, first determine if the end user’s thermostat supports a fan. If the thermostat does not support turning on a fan, then there is no point to enabling the fan integration. To determine if a thermostat supports a fan, ask the end user to select a thermostat from the list of active thermostats in the user’s Nest Structure. Once the user has selected a thermostat, note the Arrayent index number of that thermostat. Then reference the following attribute to determine if fan operations are supported: d.structures[X].d.thermostats[Y].has_fan where X is the structure index number and Y is the thermostat number. If this value is true, then the target thermostat supports fan operations. Next, determine if the thermostat is online. The online status of the thermostat can be determine from the following attribute: d.structures[X].d.thermostats[Y].is_online where X is the structure index number and Y is the thermostat number. If this value is true, then the target thermostat is online. Lastly, confirm that the target structure’s home/away status is set to ‘home’. Nest will not allow you to turn on a fan if the home/away status is not set to ‘home’. The home/away status for a structure is determine from the following attribute: d.structures[x].a.away. If this value is ‘home’, then the structure’s home/away status is set to home and Nest will allow you to turn on the fan. Call Arrayent’s setDeviceAttribute API to turn on the target fan. Use setDeviceAttribute to set attribute d.structures[X].d.thermostats[Y].fan_timer_active.requestWrite to the value ‘true’. Note that you can not specify the time the fan should run, that is controlled via a setting exposed only via the Nest App.

Rate Limits

When using Arrayent’s setDeviceAttribute API to turn on the target fan, the developer should be aware that Nest has a rate limiting policy in place. This means that excessive commands to a single Nest device will cause commands to be rejected. See the Nests Developers Documention for more details: https://developer.nest.com/documentation/cloud/data-rate-limits/

Handling Errors

After enabling the Fan, the application must check for errors and display any errors to the end user for Nest Certification. After setting the attribute to turn on the fan, the application should check that the status of the fan has been updated. The status of the fan can be determined from the following attribute: d.structures[X].d.thermostats[Y].fan_timer_active. If the value is true, then the target fan is running. Be sure to note the timestamp of the value for d.structures[X].d.thermostats[Y].fan_time_active and ensure the timestamp reported is after the timestamp when the fan command was sent. This ensures that you are reading the new state of the fan and not an older state. If the value is not true, then the fan is not running. The value of d.structures[X].d.thermostats[Y].fan_timer_active is updated asynchronously and there may be some delay between sending the fan command, the fan turning on, and the d.structures[X].d.thermostats[Y].fan_timer_active value being updated to true. If the d.structures[X].d.thermostats[Y].fan_timer_active is not set to true, then check the value of d.structures[X].d.thermostats[Y].fan_timer_active.requestWrite. The attribute used to enable the fan will also be used to report back any error codes from Nest. If the fan is running, then Arrayent EcoAdaptor will erase the d.structures[X].d.thermostats[Y].fan_timer_active.requestWrite attribute and you will read back a null value. If there is an error, then the value of the attribute will contain:

error: <errormsg>, <badvalue>, <timestamp>
  • <errormsg> – This is the message to display to user.
  • <badvalue> – This is the value passed to d.structures[X].d.thermostats[Y].fan_timer_active.requestWrite attribute that generated the error
  • <timestamp> – This is the timestamp the error was generated at.

An example of an error:

error:Cannot change fan_timer_active while structure is away, true, 2015-09-18 12:51:05.917

In the above error, the message returned is “Cannot change fan_timer_active while structure is away”. The error was generated when attempting to set d.structures[X].d.thermostats[Y].fan_timer_active.requestWrite attribute to ‘true’, and the timestamp the error occured was on 2015-09-18 12:51:05.917 When an error is encountered, the application should inform the user that an error has occurred. Optionally, provide additional guidance on how to resolve the error, if applicable. For a complete list of possible error messages, please see the Nest Developers Documentation on error messages:https://developer.nest.com/documentation/cloud/error-messages

Summary

  1. Select a particular thermostat to target. This can be done with every attempt to enable the fan, or done once in a settings page and remembered for future use. Ensure that the target thermostat has fan support by checking attribute d.structures[X].d.thermostats[Y].has_fan
  1. When user wishes to turn on the fan, perform the following checks:
    1. Confirm that the thermostat supports a fan by checking the value of d.structures[X].d.thermostat[Y].has_fan.
    2. Confirm that the thermostat is online by checking the value of d.structures[X].d.thermostats[Y].is_online
    3. Confirm that the target thermostat’s structure’s home/away status is set to ‘home’ by checking the value of d.structures[X].a.away
  2. Enable the fan by updating the attribute d.structures[X].d.thermostats[Y].fan_timer_active.requestWrite to true
  3. Confirm the fan is running by polling for the value of attribute d.structures[X].d.thermostats[Y].fan_timer_active. The value should be true.
  4. Confirm that no error messages show up under attribute d.structures[X].d.thermostats[Y].fan_timer_active.requestWrite.
  5. If an error shows up, display to end user. Optionally, provide some tips on how to deal with the errors.

Application SDK API Details

Nest Access Tokens

setEcoCloudUrl()

Arrayent.setEcoCloudUrl() – Android ConfigUtils.setEcoCloudUrl() – iOS

Parameter Value
String url The string representing the URL for Arrayent’s Nest Adapter. Will be provided by Arrayent.

updateFederatedToken()

IAccountMgmt.updateFederatedToken() – Android AccountManager.updateFederatedToken() – iOS

Parameter Value
String ecoSystemName Nest
String accessToken The Access Token provided by Nest
SuccessCallback successCallback Callback to handle success response
ArrayentErrorCallback errorCallback Callback to handle error response

The AppEngine SDK internally handles error code 118 and 119. If AppEngine SDK receive the error code 118 forupdateFedaratedToken then SDK internally invoke the “PUT” request for updateFederatedToken, similarly if AppEngine SDK receive the error code 119 for updateFedaratedToken then SDK internally invoke the “POST” request for updateFederatedToken.

Arrayent Device Attributes

getDevice()

IDeviceMgmt.getDevice() – Android DeviceManagerProtocol.getDeviceById() – iOS This API call returns a list of attributes associated with a given DeviceId.

Alerts

For details on the Arrayent Application SDK Alert methods, please consult the Application SDK Documentation.

For a summary of the details, please see the following online documentation for Android and for iOS. You may require credentials to access these portals, please contact your Arrayent team for access.

addTrigger()

AlertManagerProtocol.addTrigger() – Android

IAlertMgmt.addTrigger() – iOS

The following values must be defined in the alert definition. This information is contained in AlertInfo ojbect for iOS, and TriggerConfig object in Android.

iOS Parameter Android Parameter Value
initWithDeviceId deviceId The Arrayent deviceId of the Nest thermostat. Obtained via the getDevices() API call in above workflow.”
action action The string ‘attribute’
attributeName attrName d.structures[1].a.away
operation operation The string ‘equals’
stringThreshold stringThreshold ‘away’ or ‘home’
address address Null string
msg msg Null string
autoDisarm autoDisarm True
autoDelete autoDelete False
autoDisable autoDisable False
enable enable True
targetDeviceAttributes targetDeviceAttributes A comma separated string denoting: DeviceId,attributeName:”attributeValue”. For example, assuming that the Arrayent Device ID is 12345, the attributeName is ledState, and the attributeValue is 1, then this value will be: 12356,ledState:"1"

For full details on the meaning of each of the above parameters, please see the online documentation for the Web API addTrigger.