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 Smoke + CO Alarms in Nest



Overview

The following operations allow you to work with Smoke and Carbon Monoxide alarms. Click an operation name to see details on how to use it.

For a sample proxy service that illustrates how to work with Smoke and Carbon Monoxide alarms, see Sample configuration.

OperationDescription
viewCOAlarmStateRetrieves the  status of the CO alarm.
viewSmokeAlarmStateRetrieves the  status of the smoke alarm.
viewBatteryHealthRetrieves  battery health state .
viewManualTestStateRetrieves last manual test status.
viewLastManualTestStatusRetrieves test status of last manual test.
viewLastManualTestTimestampRetrieves time stamp of last manual test.
viewOnlineStatusRetrieves the online status .
viewLastConnectionInformationRetrieves the last connection information .

Operation details

This section provides the details on each operation related to Smoke and CO alarms.

  • All operations in Smoke and CO Alarms use getServices method with relevant properties.
  • structureId is not needed for the operations of Smoke and CO Alarms.
getServices
<nest.getServices>
    <device>{$ctx:device}</device>
    <deviceId>{$ctx:deviceId}</deviceId>
    <operation>viewCOAlarmState{$ctx:operation}</operation>
    <structureId>{$ctx:structureId}</structureId>
</nest.getServices>
Properties
  • device    :Type of the Nest device(smoke_co_alarms).
  • deviceId  :Id of the above mentioned device.
  • operation :The operation to perform.

View Carbon Monoxide Alarm State

This operation retrieves CO alarm state. This property is read-only with Smoke+CO read permission. It can be “ok or warning or emergency”.

Sample request

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

Sample Request for viewCOAlarmState
{
"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",
"operation":"viewCOAlarmState"
}

View Smoke Alarm State

This operation retrieves Smoke alarm state. This property is read-only with Smoke+CO read permission. It can be “ok or warning or emergency”.

Sample request

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

Sample Request for viewSmokeAlarmState
{
"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",
"operation":"viewSmokeAlarmState"
}

View Battery Health

This operation retrieves battery life/health status. This is the estimate of remaining battery power level. It can be “ok or replace”. This property is read-only with Smoke+CO read permission.

Sample request

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

Sample Request for viewBatteryHealth
{
"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",
"operation":"viewBatteryHealth"
}

View Manual Test 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  viewManualTestState operation.

Sample Request for viewManualTestState
{
"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",
"operation":"viewManualTestState"
}

View Last Manual Test Status

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  viewLastManualTestStatus operation.

Sample Request for viewLastManualTestStatus
{
"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",
"operation":"viewLastManualTestStatus"
}

View Last Manual Test Time Stamp

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.

Sample request

Following is a sample REST/JSON request that can be handled by the  viewLastManualTestTimestamp 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",
"device":"smoke_co_alarms",
"deviceId":"VhVmm7HOhEcL5sSzblcDOMMSoJ03t2br",
"operation":"viewLastManualTestTimestamp"
}

View Online Status

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.

Sample request

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

Sample Request for viewOnlineStatus
{
"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",
"operation":"viewOnlineStatus"
}

View Last Connection Information

This operation retrieves the time stamp of the last successful interaction with the Nest service, in ISO 8601 format. This property is read-only with Smoke+CO read permission.

Sample request

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

Sample Request for viewLastConnectionInformation
{
"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",
"operation":"viewLastConnectionInformation"
}

Sample configuration

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

Sample Proxy
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="nest_getServices"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
    <target>
        <inSequence>
            <property name="device" expression="json-eval($.device)"/>
            <property name="deviceId" expression="json-eval($.deviceId)"/>
            <property name="operation" expression="json-eval($.operation)"/>
            <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)"/>
            <property name="apiUrl" expression="json-eval($.apiUrl)"/>
           <nest.init>
                <apiUrl>{$ctx:apiUrl}</apiUrl>
           </nest.init>
            <nest.getAccessToken>
                <clientId>{$ctx:clientId}</clientId>
                <clientSecret>{$ctx:clientSecret}</clientSecret>
                <code>{$ctx:code}</code>
            </nest.getAccessToken>
            <nest.getServices>
                <device>{$ctx:device}</device>
                <deviceId>{$ctx:deviceId}</deviceId>
                <operation>{$ctx:operation}</operation>
                <structureId>{$ctx:structureId}</structureId>
            </nest.getServices>
            <respond/>
        </inSequence>
        <outSequence>
            <log/>
            <send/>
        </outSequence>
    </target>
    <description/>
</proxy>