Coder Social home page Coder Social logo

yracine-myautomatic-last-open-src's Introduction

device-type.myautomatic

Author: Yves Racine

linkedIn profile: ca.linkedin.com/pub/yves-racine-m-sc-a/0/406/4b/

Date: 2015-08-08


/*********************************************************************************************

please take note of the following statement:**

http://thingsthataresmart.wiki/index.php?title=My_Automatic_Device#Notes_to_MyAutomatic_Device_Users_-_Contribution_is_now_require

/*********************************************************************************************

You can now download the code at

http://www.maisonsecomatiq.com/#!store/tc3yr

P.S. Technical support packages are also available.

Setup time: About 5 minutes

===================== INSTALLATION STEPS

/**************************************************************************************************/

1) Create a new device type (My Automatic Device) for your device(s) /**************************************************************************************************/

a) Go to https://graph.api.smartthings.com/ide/devices

b) Hit the "+New Device Type" at the top right corner

c) Hit the "From Code" tab on the left corner

d) Copy and paste the code from myautomatic.devicetype under https://github.com/yracine/device-type.myautomatic/blob/master/myautomatic.devicetype

e) Hit the create button at the bottom

f) Hit the "publish/for me" button at the top right corner (in the code window)

/**************************************************************************************************/

2) Create a new smartapp (MyAutomaticServiceMgr) /**************************************************************************************************/

a) Go to https://graph.api.smartthings.com/ide/apps

b) Hit the "+New SmartApp" at the top right corner

c) Hit the "From Code" tab on the left corner

d) Copy and paste the code from MyAutomaticServiceMgr under http://github.com/yracine/device-type.myautomatic/blob/master/smartapps/myAutomaticServiceMgr

e) Hit the create button at the bottom

f) Make sure that enable OAuth in Smartapp settings is active

  • Goto app settings (top right corner),
  • Click on Oauth (middle of the page), and enable OAuth in Smart app
  • Hit "Update" at the bottom

g) Go back to the code window, and hit the "publish/for me" button at the top right corner

h) Keep the smartapp open in your IDE for the next step

/**************************************************************************************************/

3) Create/login to your Automatic Developer account /**************************************************************************************************/

a) Open a new browser tab, and go to http://developer.automatic.com and create your developer account if needed

b) Go to https://developer.automatic.com/my-apps

c) Create a new app and name it "SmartThings"

d) Copy and paste your Automatic client id to the MyAutomaticServiceMgr smartapp at the bottom of the file where "insert Automatic Public Key here!" is indicated

e) Copy and paste your Automatic secret id to the MyAutomaticServiceMgr smartapp at the bottom of the file where "insert Automatic private Key here!" is indicated

Examples of keys, not valid at Automatic:

def getSmartThingsClientId() { "kjPlS3AAQtaUGlmB30IU9g" }

def getSmartThingsPrivateKey() { "6Qg0niXeQDSk-dkfU475og" }

f) Using the ST IDE, save and Publish the MyAutomaticServiceMgr smartapp with your credentials.

/**************************************************************************************************/

4) Activate live logging for more tracing /**************************************************************************************************/

Go to

https://graph.api.smartthings.com/ide/logs

Note: In the next step, as Automatic does not presently support wildcard URL redirection to many ST users, you'd need to copy and paste the redirect URL generated by the smartapp at the Automatic portal.

/**************************************************************************************************/

5) Execute MyAutomaticServiceMgr /**************************************************************************************************/

a) From your phone or tablet, within the smartThings app and on the main screen, click on '+' at the bottom, under SmartApps, scroll down to My Apps, and execute MyAutomaticServiceMgr.

If you have upgraded to the new UI, click on the Smartapps link in the upper section of any of the following screens: Home & Marketspace, and then MyApps (last item in the list).

b) The smartapp will ask you to authenticate on the Automatic portal (by pressing Next on the first page)

c) Press on MyAutomatic in the middle of the login page

d) The Automatic login page will appear with the following error message:

Error: invalid request

e) In the IDE, under https://graph.api.smartthings.com/ide/logs, you should see the following trace:

buildRedirectUrl,redirectURL=https://graph.api.smartthings.com/api/token/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/smartapps/installations/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/swapToken

f) Copy and paste the redirect URL to the Automatic Developer portal under OAuth Redirect URL

g) Save the URL redirect value at the Automatic Developer Portal

h) Press back on your device to re-login by pressing again on MyAutomatic in the middle of the page

i) The Automatic login page should re-appear without any error message, enter your Automatic credentials

j) After being authenticated and pressing 'done' and 'next', the smartapp will show you the list of device(s) under your Automatic Account

If you get a blank screen after pressing 'Next or you get the following error: " Error - bad state. Unable to complete page configuration", you'd need to enable oAuth as specified in step 2f) above.

k) You may then select the Automatic device(s) to be exposed to SmartThings.

After pressing 'Done' on the last page, the smartapp will instantiate the MyAutomatic device object under

https://graph.api.smartthings.com/device/list

/**************************************************************************************************/

7) Under the SmartThings app (on your tablet or smartphone), you should then see the new Automatic Object(s) under the 'Things' shortcut on the dashboard

/**************************************************************************************************/

Click on it and press refresh several times to populate its fields

/**************************************************************************************************/

8) (optional) After instantiation of MyAutomatic object, you can edit its preferences and set your home address for presence purposes

/**************************************************************************************************/

Edit the preferences of MyAutomatic device(s) to set your home address or enable more tracing

  • Go to https://graph.api.smartthings.com/device/list
  • Click on the My Automatic object in the list
  • Edit the preferences by clicking on 'edit' (middle of the page)
  • Set the homeAddress parameter to your zipcode or street name, city
  • Set the trace input parameter to true (for debugging purposes only)
  • Save the changes by clicking 'Save' at the bottom.

/**************************************************************************************************/

9) (optional) Install some of my SmartApp(s) /**************************************************************************************************/

See Under

https://github.com/yracine/device-type.myautomatic/tree/master/smartapps

a) MonitorAutomaticCar

Typical Use Case: Parents may want to closely monitor their kids' car driving abilities.

The smartapp can detect any Speeding, Hard Acceleration, Hard Brake events after a trip has been completed and alerts parents of bad driving behaviors.

Parents may want to set a minimum Speeding Score or Events Score and if the kids' scores go below these thresholds, the parents will be notified ASAP.

The monitoring could be even more tight during the wet/snow season. Based on weatherStation, it can automatically switch to a monitoring cycle interval in minutes instead of hours when it's raining or snowing outside.....

See the virtual weather station at

https://github.com/yracine/device-type.weatherstation

b) automaticReport

The smartapp allows a ST user to generate daily reports on Automatic Connected vehicle's events.

yracine-myautomatic-last-open-src's People

Contributors

yracine avatar amaiman avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.