My Next Alarm

The Unofficial SmartThings Blog
Jump to navigation Jump to search


NestProtect.jpg


Brand: Nest®

Models: Nest Protect wired & battery powered

Type: 'Smart Alarm

Protocol: Wi-Fi

Link to Nest website [1]

Device Type Author:Yves Racine

ST Community handle http://community.smartthings.com/users/yvesracine/activity

Hubitat Community handle https://community.hubitat.com/u/yracine66/activity

Company Link: http://www.ecomatiqhomes.com#!home/mainPage


 LAST UPDATE 
 The Works with Nest program ended on August 31,2019, so the "official" Nest APIs are no longer available.  However, my code uses the Nest Web APIs which are not official but provide faster responses without rate limiting as the old ones.



Contribution fee is required

The Next devices have required hundreds of hours of development & testing efforts to build, so a mandatory contribution fee is required to get the code.


To download the code, go to

http://www.ecomatiqhomes.com/store

Instructions for My Next devices installation (readme):

https://github.com/yracine/device-type-myNext/blob/master/README.md

Technical support packages are also available.


If you want to contribute more, here is the paypal link below.

https://paypal.me/ecomatiqhomes

Prerequisites

  • Nest Protect(s) operational & connected to Nest Backend via the internet.
  • Your automation hub fully operational

Information

Here is a list of Capabilities

   capability "Smoke Detector"
   capability "Carbon Monoxide Detector"
   capability "Sensor"

// capability "Battery" / Not present as a percentage

   capability "Health Check"
   capability "Polling"
   capability "Refresh"
   capability "Motion Sensor"
  • Here is the complete list of commands (see the signature in the DTH code, next to command's implementation for details about parameters):
   command "setStructure"  
   command "setStructureHome"
   command "setStructureAway"

// To set your whole Nest structure to away

   command "away"               

// To reset your structure to home

   command "present"           
   
   command "getProtectInfo"        
   command "setProtectSettings"        
   command "produceSummaryReport"        

List of Attributes available for subscription (in any rule engine like CoRE/WebCoRE/SmartRules)

Please refer to the Nest Developer APIs documentation for more details on each attribute.

https://developers.nest.com/documentation/cloud/api-overview

// Structure attributes

   attribute "structure_id"    
   attribute "st_away"    
   attribute "st_name"    
   attribute "st_country_code"    
   attribute "st_postal_code"    
   attribute "st_time_zone"    
   attribute "st_members"    
   attribute "st_user"    
   attribute "st_away_timestamp"    
   attribute "st_manual_away_timestamp"    
   attribute "st_manual_eco_timestamp"    
   attribute "st_away_setter"    
   attribute "st_eta"    
   attribute "st_eta_preconditioning_active"    
   attribute "st_eta_unique_id"    
   attribute "st_set_manual_eco_all"    
   attribute "st_vacation_mode"    
   attribute "st_demand_charge_enabled"    

// Protect attributes

   attribute "protectId"
   attribute "NestAlarmState"
   attribute "alarmState"
   attribute "locale"
   attribute "battery_state"
   attribute "software_version"
   attribute "where_id"
   attribute "where_name"
   attribute "label"
   attribute "name_long"
   attribute "co_alarm_state"
   attribute "smoke_alarm_state"
   attribute "last_manual_test_time"
   attribute "is_manual_test_active"
   attribute "last_api_check" // last date/time of last api connection attempt
   attribute "last_connection" // last date/time of valid Nest connection
   attribute "verboseTrace"    // verbose trace of all exceptions
   New Attributes in V2   attribute "last_api_check"  // last api check (date/time)


   attribute "component_smoke_test_passed"
   attribute "component_co_test_passed"
   attribute "component_pir_test_passed"
   attribute "component_speaker_test_passed"
   attribute "component_heat_test_passed"
   attribute "auto_away"
   attribute "auto_away_decision_time_secs"
   attribute "heat_status"
   attribute "night_light_enable"
   attribute "night_light_continuous"
   attribute "night_light_enable"
   attribute "night_light_brightness"
   attribute "wired_or_battery"
   attribute "capability_level"
   attribute "home_away_input"
   attribute "model"
   attribute "hushed_state"
   attribute "night_light_brightness"
   attribute "home_alarm_link_capable"
   attribute "home_alarm_link_connected"
   attribute "home_alarm_link_type"
   attribute "replace_by_date_utc_secs"
   attribute "device_born_on_date_utc_secs",

Look & Feel

UI Fields

Hubitat

HubitatMyNextAlarm.PNG


In the new Samsung connect app

MyNextAlarm Custom p1.jpg MyNextAlarm Custom p2.jpg MyNextAlarm Custom p3.jpg

In the ST classic app

MyNextAlarmV2.jpeg

List of Events (refreshed up to the minute)

MyNextAlarmEvents.png


Upper section of the multi-tile

  • Current SmartThings alarm state (clear, co, smoke, tested)
  • Online status

Lower section of the multi-tile

  • Current Nest Alarm state (clear, co_warning, co_emergency, smoke_warning, smoke_emergency)
  • Battery status (OK or replace)
  • Battery type (wired or battery operated)
  • Nest Last connection - date& time
  • Nest last API check - date& time
  • Nest software version (firmware)
  • Last manual test time
  • Motion
  • Refresh

Known issues

.................................................................................................................................


.................................................................................................................................

Need to keep home.nest.com session active for Nest APIs to work

.................................................................................................................................


For Nest users who have migrated to a Google Account, the Nest Web APIs work only when the home.nest.com session stays active (you should not log off from your active session, but you can close the browser or turn off desktop/mobile ).


.................................................................................................................................

UI elements are partially compatible with new STSC (Samsung) new app

.................................................................................................................................

Use of the SmartThings classic mobile app is required: all custom DTHs & smartapps above are partially compatible with the new Samsung Connect mobile app as ST is working on the required migration steps and UI tiles. However, you can create the devices in the ST classic mobile app, and use them in the new Samsung connect app.

Some UI elements not totally compatible are the scale (appearing sometimes in Celsius unless you change the setpoints), thermostat icon, and status that seems to be checking constantly as it's a cloud-to-cloud integration, etc.

.................................................................................................................................

Structures are cached

.................................................................................................................................

In order to avoid querying the Nest APIs for the structure data and for better performances, some information is locally cached in the device.

If you make changes to some stucture data and want to update the device immediately (by default, it's done once a day at midnight), please manually press the "refresh" tile.


You may want to change the cache settings (accessible at the bottom of the 1st page in MyNextManager) if you feel that the cached values are too prevalent.

.................................................................................................................................

Events are polled (not in real-time)

.................................................................................................................................

Even with a high refresh rate, the events trigerred at the Nest Protect are polled, so there is no real time event processing possible at this time (Nest APIs and ST UI limitations).

So, you cannot rely on this SmartThings integration (like any others) as a real time warning procedure.

Troubleshooting

Here are some typical troubleshooting cases explained below. For your specific use cases, you may want to contact the author (there may be some support fees to be applied).'

.................................................................................................................................

Issue #1: I don't know how to create a custom device

.................................................................................................................................

Hubitat

Copy the code from the text files under apps in the Hubitat IDE, and then press "Save".

CaptureHubitatDriver.PNG


SmartThings

See the explanations of a fellow community member here:

http://community.smartthings.com/t/faq-an-overview-of-using-custom-code-in-smartthings/16772 http://thingsthataresmart.wiki/index.php?title=Using_Custom_Code


Please refer to the installation readme (prerequisites) to find out what is the right shard for the procedure.


.................................................................................................................................

Issue #2: I created My Next Alarm handler and MyNextManager in the IDE, but I don't know where to execute it

.................................................................................................................................


For the initial setup, under the ST app, click on the Marketspace? item in the bottom menu, and then, on the smartapps link and finally, MyApps (last item in the list).

If you still do not see your smartapp, please make sure that you have published it in the IDE!

For any subsequent execution, under the ST app, click on the "hamburger" menu in the upper right section and then, Smartapps. You should see the smartapp in the list.'


.................................................................................................................................

Issue #3: I executed MyNextManager smartapp, but the 3rd page -after doing the login, and pressing Next- is blank

.................................................................................................................................

If you get a blank screen after pressing 'Next or you get the following error: " Error - bad state. Unable to complete page configuration" or any other ST errors, please check that you've enabled oAuth as specified in step 2f) in the readme.

https://github.com/yracine/device-type-myNext/blob/master/README.md

Also, make sure that you've followed all prerequisites:

http://thingsthataresmart.wiki/index.php?title=My_Next_Alarm#Prerequisites

Refer to MyNextManager smartapp's installation for more details:

http://thingsthataresmart.wiki/index.php?title=MyNextServiceMgr#Issue_.231:_I_don.27t_know_how_to_create_a_custom_smartapp

.................................................................................................................................

Issue #4: My Next Alarm is off with the Nest mobile app or portal

.................................................................................................................................

First try to refresh the UI by pressing the 'refresh' tile. The UI does not allow automatic refresh at the moment.

Please note also that the cloud-to-cloud integration may introduce some delays in getting the latest values.


.................................................................................................................................

Issue #5: I want to disable any notifications from MyNextManager

.................................................................................................................................

Go to the smartapp's last page, and answer 'no' to the following question:

Send a push notification?"''

Be aware that you won't be notified of any connection issues.

.................................................................................................................................

Issue #6: "An unexpected error has occurred" or 'deleteObserver onError: %s' messages in MyNextManager when I press 'Remove'

.................................................................................................................................

'Like any connected device, you need first to unselect all your Next devices from all the smartapps & routines as MyNextManager will not uninstall w/o doing this step.

MyNextManager is the Service Manager for all Next Devices, so uninstalling the smartapp means that all Next devices will be deleted. .................................................................................................................................

Issue #7: I want to get more tracing in the IDE

.................................................................................................................................


Hubitat

a) Click on the device that you just created

http://192.168.xx.xx/device/edit/"device number" (Device number can vary from one location to the next)

b) Edit the preferences in the middle section of the screen)

You only need to edit the following parameters

(a) <trace> when needed, set to true to get more tracing (no spaces)

(b) <logFilter:1..5> Values=[Level 1=ERROR only,2=<Level 1+WARNING>,3=<2+INFO>,4=<3+DEBUG>,5=<4+TRACE>]

c) Save the preferences by clicking on the corresponding button.

N.B. The logs are available under the IDE at:

http://192.168.xx.xx/logs (insert your own hub's IP address)

You can click at the top of the window on the device name to filter the logs.

SmartThings

a) Go to https://graph.api.smartthings.com/device/list (or whatever your shard is and click on My Devices in the IDE's top menu)

b) Click on the device that you just created

c) Click on Preferences (edit)

You only need to edit the following parameters

(a) <trace> when needed, set to true to get more tracing (no spaces) (b) <logFilter:1..5> Values=[Level 1=ERROR only,2=<Level 1+WARNING>,3=<2+INFO>,4=<3+DEBUG>,5=<4+TRACE>]


.................................................................................................................................

Issue #8: I want to upgrade the code but I don't know how.

.................................................................................................................................

Most of the time (unless specified otherwise), you just need to copy and paste the MyNextAlarm Device's code from the the related txt files, and save & publish.

The same approach should be used for the smartapps.

For more details, please follow the instructions provided at:

https://github.com/yracine/device-type-myNext/blob/master/README.md


.................................................................................................................................

Issue #9: java.util.concurrent.TimeoutException: Execution time exceeded 'x' app execution seconds

.................................................................................................................................

ST has introduced some generic rate limiting rules for all smartapps and device handlers.

For cloud-to-cloud integration, these rate limiting constraints are sometimes too low (due to network latency, servers involved, etc.), and this exception can be raised from time to time. There are some threads about it in the ST community forum:

http://community.smartthings.com/t/rate-limiting-too-restrictive-max-execution-time-exceptions/17985

http://community.smartthings.com/t/execution-times-increasing/19979

http://community.smartthings.com/t/unschedule-api-execution-time-too-long/11232


................................................................................................................................

Issue #10: com.datastax.driver.core.exceptions.ReadTimeoutException

.................................................................................................................................

These exceptions are thrown by the ST backend from time to time. I've been told that ST is working on it. This is not a specific issue with my code.

https://community.smartthings.com/t/cassandra-timeout-during-read-query/46227/3

...............................................................................................................................

Issue #11: I want to change all scales to the metric system.

.................................................................................................................................


The temperature scale needs to be changed for your account, so that all your devices will be in the metric system.

Press the "hamburger" menu (upper left), and then the "gear" icon. You'll find the option to change the temperature scale there and press "save".

At the next "refresh", My Next Alarm will display the values in the metric system.


...............................................................................................................................

Issue #12: Some of my devices under the new Samsung app are disconnected

.................................................................................................................................


If some of your Next devices are disconnected under the new Samsung app, you may have created many of the same devices by executing MyNextManager many times... Under the new Samsung mobile app, you then need to clean them up by pressing the "edit" button next to your location and removing them.


For further execution of the MyNextManager smartapp, Refer to issue #2 http://thingsthataresmart.wiki/index.php?title=My_Next_Alarm#Issue_.232:_I_created_My_Next_Alarm_handler_and_MyNextManager_in_the_IDE.2C_but_I_don.27t_know_where_to_execute_it

.................................................................................................................................

Issue #13: My NextAlarm is not reporting motion

.................................................................................................................................

Please make sure that your Protect model supports motion detection and has the latest firmware. You may want to contact Nest support if your software is not up to date.

As a reference, the following wired model (topaz 2.7) and software version (3.1.4rc3) are working fine. Battery operated models seem not to be able to report motion as indicated by some Nest users in my ST community forum thread.

The auto_away attribute below is used to detect motion (true or false).

MyNextProtectWithAttributesForMotion.png