This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with Structures in Nest



Overview

The following operations allow you to work with Structures(Homes). Click an operation name to see details on how to use it.

For a sample proxy service that illustrates how to work with Structures, see Sample configuration.

OperationDescription
viewThermostatsRetrieves all thermostats in the home.
viewSmokeCOAlarmsRetrieves all Smoke and CO alarms in home.
viewEnergyEventPeekStartRetrieves the start time of the rush hour rewards energy event .
viewEnergyEventPeekEndRetrieves the end time of the rush hour rewards energy event .
viewAwayStateRetrieves state of the structure.
viewPostalCodeRetrieves the postal zip code of the structure.
setAwayStateSets the state of the structure.
setETASets a trip.

Operation details

This section provides the details on each operation related to Structures.

  • All get operations of Structures use getServices method with relevant properties.
  • device and deviceId are not needed for the operations of Structures.
getServices
<nest.getServices>
    <device>{$ctx:device}</device>
    <deviceId>{$ctx:deviceId}</deviceId>
    <operation>viewCOAlarmState{$ctx:operation}</operation>
    <structureId>{$ctx:structureId}</structureId>
</nest.getServices>
Properties
  • structureId :Id of the Structure(Home).
  • operation   :The operation to perform.

View Thermostats

This operation retrieves the list of thermostats in the structure. This is an array of JSON objects that includes IDs of all thermostats in the structure.

This is readable when Thermostat read or Thermostat read/write or Smoke+CO read or Away read or Away read/write or ETA write is set.

Sample request

Following is a sample REST/JSON request that can be handled by the viewThermostats operation.

Sample Request for viewThermostats
{
"clientId":"b44cdb3-f056-4c5b-b8a5-e3fd2c6d055f",
"clientSecret":"fjdp7dKJ7p8ipXhAmjNIeF9R",
"code":"E9GW2BQH",
"apiUrl":"https://firebase-apiserver01-tah01-iad01.dapi.production.nest.com:9553",
"structureId":"k5l5SlveC-k80_7Kb0KyqnBFCCFOo7AV6w6tmpAvfbfehgSlUsc-uw",
"operation":"viewThermostats"
}

View Smoke and CO Alarms

This operation retrieves the list of smoke & CO alarms in the structure. This is an array of JSON objects that includes IDs of all smoke & CO alarms in the structure.

This is readable when Thermostat read or Thermostat read/write or Smoke+CO read or Away read or Away read/write or ETA write is set.

Sample request

Following is a sample REST/JSON request that can be handled by the viewSmokeCOAlarms operation.

Sample Request for viewSmokeCOAlarms
{
"clientId":"b44cdb3-f056-4c5b-b8a5-e3fd2c6d055f",
"clientSecret":"fjdp7dKJ7p8ipXhAmjNIeF9R",
"code":"E9GW2BQH",
"apiUrl":"https://firebase-apiserver01-tah01-iad01.dapi.production.nest.com:9553",
"structureId":"k5l5SlveC-k80_7Kb0KyqnBFCCFOo7AV6w6tmpAvfbfehgSlUsc-uw",
"operation":"viewSmokeCOAlarms"
}

View Energy Event Peek Start

This operation retrieves the s tart time of the rush hour rewards energy event, in ISO 8601 format. This is readable when Thermostat read/write is set .

Sample request

Following is a sample REST/JSON request that can be handled by the viewEnergyEventPeekStart operation.

Sample Request for viewEnergyEventPeekStart
{
"clientId":"b44cdb3-f056-4c5b-b8a5-e3fd2c6d055f",
"clientSecret":"fjdp7dKJ7p8ipXhAmjNIeF9R",
"code":"E9GW2BQH",
"apiUrl":"https://firebase-apiserver01-tah01-iad01.dapi.production.nest.com:9553",
"structureId":"k5l5SlveC-k80_7Kb0KyqnBFCCFOo7AV6w6tmpAvfbfehgSlUsc-uw",
"operation":"viewEnergyEventPeekStart"
}

View Energy Event Peek End

This operation retrieves the e nd time of the rush hour rewards energy event, in ISO 8601 format. This is readable when Thermostat read/write is set.

Sample request

Following is a sample REST/JSON request that can be handled by the viewEnergyEventPeekEnd operation.

Sample Request for viewEnergyEventPeekEnd
{
"clientId":"b44cdb3-f056-4c5b-b8a5-e3fd2c6d055f",
"clientSecret":"fjdp7dKJ7p8ipXhAmjNIeF9R",
"code":"E9GW2BQH",
"apiUrl":"https://firebase-apiserver01-tah01-iad01.dapi.production.nest.com:9553",
"structureId":"k5l5SlveC-k80_7Kb0KyqnBFCCFOo7AV6w6tmpAvfbfehgSlUsc-uw",
"operation":"viewEnergyEventPeekEnd"
}

View Away State

This operation retrieves the manual test state of the Smoke and CO alarm. This property is read-only with Smoke+CO read permission. State of the manual smoke and CO alarm test. It can be true or false.

Sample request

Following is a sample REST/JSON request that can be handled by the viewAwayState operation.

Sample Request for viewAwayState
{
"clientId":"b44cdb3-f056-4c5b-b8a5-e3fd2c6d055f",
"clientSecret":"fjdp7dKJ7p8ipXhAmjNIeF9R",
"code":"E9GW2BQH",
"apiUrl":"https://firebase-apiserver01-tah01-iad01.dapi.production.nest.com:9553",
"structureId":"k5l5SlveC-k80_7Kb0KyqnBFCCFOo7AV6w6tmpAvfbfehgSlUsc-uw",
"operation":"viewAwayState"
}

View Postal Code

This operation retrieves the manual test state of the Smoke and CO alarm that indicates device status by the color in the Nest UI . This property is read-only with Smoke+CO read permission. The status is noticed by ui_color_state. It is an aggregate condition for battery+smoke+co states, and reflects the actual color indicators displayed in the Nest app.

Last manual test status can be “gray (offline) or green (ok) or yellow (warning) or red (emergency)”.

Sample request

Following is a sample REST/JSON request that can be handled by the viewPostalCode operation.

Sample Request for viewPostalCode
{
"clientId":"b44cdb3-f056-4c5b-b8a5-e3fd2c6d055f",
"clientSecret":"fjdp7dKJ7p8ipXhAmjNIeF9R",
"code":"E9GW2BQH",
"apiUrl":"https://firebase-apiserver01-tah01-iad01.dapi.production.nest.com:9553",
"structureId":"k5l5SlveC-k80_7Kb0KyqnBFCCFOo7AV6w6tmpAvfbfehgSlUsc-uw",
"operation":"viewPostalCode"
}

Set Away State

This operation retrieves the time stamp of the last successful manual smoke and CO alarm test, in ISO 8601 format. This property is read-only with Smoke+CO read permission.

getServices
<nest.setAwayState>
    <awayState>{$ctx:awayState}</awayState>
    <structureId>{$ctx:structureId}</structureId>
</nest.setAwayState>
Properties
  • awayState     : State of the structure.
  • structureId     : Id of the structure.
Sample request

Following is a sample REST/JSON request that can be handled by the setAwayState operation.

Sample Request for viewLastManualTestTimestamp
{
"clientId":"b44cdb3-f056-4c5b-b8a5-e3fd2c6d055f",
"clientSecret":"fjdp7dKJ7p8ipXhAmjNIeF9R",
"code":"E9GW2BQH",
"apiUrl":"https://firebase-apiserver01-tah01-iad01.dapi.production.nest.com:9553",
"structureId":"k5l5SlveC-k80_7Kb0KyqnBFCCFOo7AV6w6tmpAvfbfehgSlUsc-uw",
"awayState":"away"
}

Set ETA

This operation retrieves the device connection status with the Nest Service. This property is read-only with Smoke+CO read permission. It can be true or false.

getServices
<nest.setETA>
    <tripId>{$ctx:tripId}</tripId>
    <begin>{$ctx:begin}</begin>
    <end>{$ctx:end}</end>
    <structureId>{$ctx:structureId}</structureId>
</nest.setETA>
Properties
  • tripId           : Id of the trip.
  • begin          : Estimated arrival window begin time.
  • end             : Estimated arrival window end time.
  • structureId   : Id of the structure.
Sample request

Following is a sample REST/JSON request that can be handled by the setETA operation.

Sample Request for setETA
{
"clientId":"b44cdb3-f056-4c5b-b8a5-e3fd2c6d055f",
"clientSecret":"fjdp7dKJ7p8ipXhAmjNIeF9R",
"code":"E9GW2BQH",
"apiUrl":"https://firebase-apiserver01-tah01-iad01.dapi.production.nest.com:9553",
"device":"smoke_co_alarms",
"deviceId":"VhVmm7HOhEcL5sSzblcDOMMSoJ03t2br",
"tripId":"myTripHome1024",
"begin":"2014-12-01T22:42:59.000Z",
"end":"2014-12-02T23:59:59.000Z"
}

 

Sample configuration

Following is a sample proxy service that illustrates how to connect to Nest with the init and getAccessToken operations to use the setAwayState operation. The sample request for this proxy can be found in setAwayState sample request.

Sample Proxy
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="nest_setAwayState"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
    <target>
        <inSequence>
            <nest.init/>
            <property name="awayState" expression="json-eval($.awayState)"/>
            <property name="structureId" expression="json-eval($.structureId)"/>
            <property name="clientId" expression="json-eval($.clientId)"/>
            <property name="clientSecret" expression="json-eval($.clientSecret)"/>
            <property name="code" expression="json-eval($.code)"/>
            <nest.getAccessToken>
                <clientId>{$ctx:clientId}</clientId>
                <clientSecret>{$ctx:clientSecret}</clientSecret>
                <code>{$ctx:code}</code>
            </nest.getAccessToken>
            <nest.setAwayState>
                <awayState>{$ctx:awayState}</awayState>
                <structureId>{$ctx:structureId}</structureId>
            </nest.setAwayState>
            <respond/>
        </inSequence>
        <outSequence>
            <log/>
            <send/>
        </outSequence>
    </target>
    <description/>
</proxy>