Difference between revisions of "My Ecobee Init"

The Unofficial SmartThings Blog
Jump to navigation Jump to search
(Issue #1: I don't know how to create a custom smartapp)
(Issue #1: I don't know how to create a custom smartapp)
Line 80: Line 80:
 
[[File:HubitatSmartapp_page1.PNG|1000px]]
 
[[File:HubitatSmartapp_page1.PNG|1000px]]
  
Enable "oAuth" for the smartapp.
 
  
[[File:HubitatSmartapp_OAuth.png|800px]]
+
Enable "oAuth" for the smartapp and press the "update" button.
  
 +
[[File:HubitatSmartapp_EnableOAuth.png|800px]]
  
 
<big>
 
<big>

Revision as of 17:23, 6 February 2021


This smartapp isEcobee approved badge YVESR.png

<al imagesize="Large">B00ZIRV39M</al>

Category: My Apps

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



If you like My Ecobee Device and related smartapps, please support the developer by clicking on the paypal link below:

https://paypal.me/ecomatiqhomes




Summary

My Ecobee Init, the smartapp that connects your Ecobee thermostat(s) to your hub via cloud-to-cloud integration (Service Manager).

Supported Features

  • All ecobee thermostat models are supported (SmartThermostat, ecobee4, lite, ecobee3, Smart-02, Smart-SI) except the EMS thermostats
  • Multiple thermsostats can be selected to be exposed to SmartThings or Hubitat.
  • Do a poll at regular intervals (input parameter) to maintain the authorization with ecobee.
  • Notify you if there is any issue with your cloud-to-cloud ecobee connection (optional).



Code location: http://github.com/yracine/device-type.myecobee/tree/master/smartapps

Instructions for installation (readme): https://github.com/yracine/device-type.myecobee/blob/master/README.md

Prerequisites

  • ecobee thermostat connected via wi-fi to ecobee (lite, ecobee4, ecobee3, Smart-SI, Smart, EMS)
  • SmartThings or Hubitat hub fully operational
  • Some basic skills to add custom DTH and smartapps (see troubleshooting section, item 1)
  • For ST users, determine your shard, please consult this thread:

https://community.smartthings.com/t/faq-how-to-find-out-what-shard-cloud-slice-ide-url-your-account-location-is-on/53923

Or the SmartThings documentation here for more details:

http://docs.smartthings.com/en/latest/publishing/index.html#ensure-proper-location

Troubleshooting

See troubleshooting section under My Ecobee Device

   http://thingsthataresmart.wiki/index.php?title=My_Ecobee_Device


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

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

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

Hubitat

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

HubitatSmartapp page1.PNG


Enable "oAuth" for the smartapp and press the "update" button.

HubitatSmartapp EnableOAuth.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

To avoid any issue, please to do the steps below using a well known browser (Chrome, IE, Edge) from a desktop/laptop (not a tablet) to copy and paste the code into the IDE.

And, here are some basic explanations with screenshots.

  • Point your browser to you SmartThings IDE for your country (i.e. http://ide.smartthings.com or whatever your shard is, refer to the prerequisites at the readme) and Log In.

Loginscreen.jpg

  • Once you are logged in, find the My SmartApps link on the top of the page. Clicking My SmartApps will allow you to produce a new SmartApp.

MySmartApps.png

  • Find the button on this page labeled +New SmartApp and click it.

+NewSmartApp.png

  • Since you already have the code in your computer’s clipboard, find the tab along the top section called From Code. In the area provided, paste (typically CTRL+V) the code you copied from GitHub. Click Create in the bottom left corner of the page.

NewSmartAppCreate.png

  • This will bring up another page, with the code now formatted within the IDE. If the code was copied correctly, there are no other steps except to save and publish the code. In the upper right corner of the page, find and click Save. Now, click Publish (For Me), and you should receive a confirmation that the code has been published successfully.

SavePublish.png

To enable OAuth, first find and click the App Settings button in the upper right corner of the page.

From here, find the OAuth section toward the bottom of the page.

OAuthBtn.png

Clicking the OAuth link will reveal a button labeled Enable OAuth in Smart App. Click this button. The screen will change, giving you a unique code for your Client ID and Client Secret. These are the foundations of the security of your app and should be kept secret. You do not need to memorize or write down these codes; nor do you need to add any other information to this page. OAuth simply needs to be enabled for


OAuth.jpg


N.B. To create a DTH (Device Type Handler), it's basically the same steps above, but you need to click on My Device Handlers in the upper menu of the IDE, copy and paste the code, hit the create button and after, save & publish.

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

Issue #2: I created the smartapp in the IDE, but I don't know where to execute it

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


For the initial setup, under the new Samsung connect app, click on '+' sign in the upper right corner of the main page, and then on Smartapp. The smartapp should be under the Custom section.

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 Samsung connect app, click on the 'hamburger' menu in the upper left corner. The list of installed smartapps will then appear under Smartapps.


P.S. If you don't see your smartapp, it could be that you're not using the right shard for the installation. Refer to

https://community.smartthings.com/t/faq-how-to-find-out-what-shard-cloud-slice-ide-url-your-account-location-is-on/53923

Or the SmartThings documentation here:

http://docs.smartthings.com/en/latest/publishing/index.html#ensure-proper-location

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

Issue #3: java.lang.NullPointerException: Cannot get property 'X' on null object

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


Just update your smartapp by going through all the smartapp setup pages by pressing 'Next' till 'Done'.

The smartapp was recently modified to include some defensive code to ensure that the smartapp is rescheduled. This is intended to alleviate some of the ST scheduling issue as discussed in these threads:


http://community.smartthings.com/t/scheduler-and-polling-quits-after-some-minutes-hours-or-days/16997

http://community.smartthings.com/t/schedule-not-working/3895

http://community.smartthings.com/t/is-it-me-or-schedules-not-firing-this-evening/10176


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

Issue #4: 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 integrations, these rate limiting constraints are sometimes too low, 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 #5: 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 smartapp's code into the IDE at:

https://graph.api.smartthings.com/ide/apps (or whatever your shard is)

Click on the smartapp that you want to update

Paste the code into the code window (and make sure to copy all the lines)

And save & publish.

The same principle applies for the DTHs (Device Type Handlers).


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

Issue #6: I have some scheduling issues and the smartapp is not rescheduled properly

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

There have been some serious ST scheduler issues for months, but it seems to be more prevalent now.

See this thread for more details about the ST scheduler issue:

https://community.smartthings.com/t/scheduler-and-polling-quits-after-some-minutes-hours-or-days/16997

Some workarounds have been implemented in my code to get around the scheduling issues.

You have 4 options available in the last page of the smartapp ("Other Options" under the "watchdogs" section):

(a)- The smartapp can subscribe to some temp sensor(s) for any change of values, and if so, reschedules the smartapp when values at the temp sensor are refreshed. By using some temp sensor(s) that regularly poll(s), this "heartbeat" is used to make sure that the smartapp is rescheduled when needed.

(b)- The smartapp can subscribe to some motion sensor(s) for any change of values, and if so, reschedules the smartapp when values at the motion sensor are refreshed. By using some motion sensor(s) that regularly poll(s), this "heartbeat" is used to make sure that the smartapp is rescheduled when needed.

(c)- The smartapp can subscribe to energy meter device for any change of values, and if so, reschedules the smartapp when energy values are refreshed. By using some energy meter(s) that regularly poll(s), this "heartbeat" is used to make sure that the smartapp is rescheduled when needed.

(d)- You'd can also used a (virtual or physical) switch in the smartapp and use Rule Machine to trigger the virtual/physical switch based on a timer.

To activate the subscriptions, you need to go through the smartapp's setup, press "Next" till the last Page (Other Options) and enter the new subscriptions indicated below:

   section("Watchdogs") {
       "What do I use as temperature sensor to restart smartapp processing?",type:"capability.temperatureMeasurement"
       "What do I use as a motion sensor to restart smartapp processing?",type:"capability.motionSensor"
       "What do I use as energy sensor to restart smartapp processing?",type:"capability.powerMeter"
       "What do I use as Master on/off switch to restart smartapp processing?",type:"capability.switch"
   }

In order to verify that the smartapp has been re-scheduled properly, follow the steps described below:

i) Go to https://graph.api.smartthings.com/location/list (or whatever your shard is)

ii) Click on list Smartapps

iii) Click on the smartapp to be checked

iv) Verify that the takeAction job is scheduled in the future (check the timestamp associated to the Next Run Time) under "Scheduled Jobs"

If it's not the case, you may want to re-execute the smartapp by pressing the arrow next to its name under My Home/Smartapps.

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

Issue #7: I want detailed Logging/Notifications or I want to enable Ask Alexa Notifications

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



Hubitat

  • a) go to your installed apps and select the right app amongst the list

go to http://192.168.xx.xx/installedapp/list (insert your own hub's IP address)

  • b) In Notifications & Other Settings Setup> On the last setup page, set the following flag to true
   "Detailed Logging & Notifications?"


  • c) go to the logs section of your hub

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

SmartThings


In order to have detailed Logging/Notifications, you'd need to set the following parameters in the smartapp:

  • a) Notifications & Other Settings Setup> On the last setup page, set the following flag to true
   "Detailed Logging & Notifications?"


  • b) To receive push notifications, answer 'Yes' to the following input parameter
   "Send a push notification?", metadata: [values: ["Yes", "No"]]


  • c) To receive the notifications configured above through Ask Alexa, set the following flag to true
   "Ask Alexa verbal Notifications?"


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

https://graph.api.smartthings.com/ide/logs (or whatever your shard is, under Live Logging in the IDE)

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

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


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

Issue #8 - My new Ask Alexa's Message Queues are not showing up in the smartapp

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


You'd need to execute the MyEcobeeInit smartapp under Automation/Smartapps in the ST mobile app by doing "Next" till "Done" to subscribe to the new AskAlexaMQHandler. The new handler will then be able to process any Queue refresh value from Ask Alexa.


You can then go to the AskAlexa smartapp, and make any queue changes... The updated queue values will be then sent to the smartapp.


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

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

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


If some of your ecobee devices are disconnected under the new Samsung app, you may have created many of the same devices by executing MyEcobeeInit 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.


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

Issue #10: I'd like to uninstall My Ecobee devices

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

a) Like any connected device, first you'd need to unselect My Ecobee and remote sensors device(s) from all smartapps, automations, and/or routines (ex. Amazon echo).

To know which smartapps are using My Ecobee devices (Switch and thermostat), go to

https://graph.api.smartthings.com/device/list (or whathever your shard is)

b) Click on each of My Ecobee and remote sensor devices instantied under your ST account

And note all smartapps under the list "In Use By".

c) Then, you'd need to unselect the device(s) from the smartapps or routines using the ST mobile app.

d) Finally, you can remove the installed EcobeeRemoteSensornit & MyEcobeeInit smartapps by pressing on the corresponding 'delete' button after clicking on the smartapp name and the ':' sign in the upper right corner.

To access the installed smartapps, go first under the hamburger menu in the upper left corner of the Samsung connect app, and press on 'Smartapps' to get the list of installed smartapps under your ST account.