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.
Operation | Description |
---|---|
viewThermostats | Retrieves all thermostats in the home. |
viewSmokeCOAlarms | Retrieves all Smoke and CO alarms in home. |
viewEnergyEventPeekStart | Retrieves the start time of the rush hour rewards energy event . |
viewEnergyEventPeekEnd | Retrieves the end time of the rush hour rewards energy event . |
viewAwayState | Retrieves state of the structure. |
viewPostalCode | Retrieves the postal zip code of the structure. |
setAwayState | Sets the state of the structure. |
setETA | Sets 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
anddeviceId
are not needed for the operations of Structures.
<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.
{ "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.
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.
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.
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.
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.
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.
<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.
{ "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.
<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.
{ "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.
<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>