In this tutorial we describe step by step process of integration LaMetric Time into SmartThings ecosystem.
Requirements:

On a high level you will need to create:

  1. Device handler that will handle communication with LaMetric Time device (no worries, source code is available here).
  2. LaMetric (Connect) smart app, that will discover your LaMetric Time devices inside your network.
  3. LaMetric Notifier smart app, that will send notifications to your smart clock when something happens.

So, let's get started by creating device handler.

Device Handler

Steps:

  1. Go to https://graph.api.smartthings.com/ 

  2. Choose ‘My Device Handlers’ menu item and then click on ‘Create New Device Handler’ button.

  3. Select ‘From Code’ tab, paste the code and press ‘Create’ button.


  4. Press ‘Save’ and ‘Publish’

  5. After that you will able to see newly created device handler in ‘My Device Handlers’ menu.

Now we are ready to create some SmartApps.

LaMetric (Connect) SmartApp

This smart app is responsible for discovering your LaMetric Time devices in the local network. Lets create one.

Steps:

  1. Go to https://graph.api.smartthings.com/ 

  2. Choose ‘My SmartApps’ section and press ‘New SmartApp’ button.

  3. Select ‘From Code’ tab, paste the code and press ‘Create’.

  4. Press ‘Save’ and ‘Publish’ buttons.

LaMetric Notifier SmartApp

This smart app is responsible for handling events and sending notifications to LaMetric Time devices. Let's repeat steps 3-4 from previous section but this time, use LaMetric Notifier source code.
Now, when device handler and smart apps are ready, one last step is left. We need to connect LaMetric and SmartThings ecosystems. Our smart apps will use LaMetric API to get some additional data, like the list of clock faces.


Connecting LaMetric with SmartThings (OAuth2)

First of all, you need to create a Notification App at  https://developer.lametric.com . As redirect URL use https://graph.api.smartthings.com/oauth/callback . Also, you will need to provide your Privacy Policy URL. You may use this Privacy Policy Generator to create your own Privacy Policy and host it on your site or any file storage cloud service like Google Drive or Dropbox. Do not forget to enable 'basic' and 'devices_read' permissions. 

After that, click on your app and obtain your Client ID and Client Secret. 

Go to https://graph.api.smartthings.com/, open ‘My SmartApps’ and edit LaMetric (Connect) application.


Paste your Client ID and Client Secret in LaMetric (Connect) application under Settings section. Do not forget to turn on OAuth2 for this application. After that, click on ‘Update’ button.


Now, let's try it!


Testing

Open SmartThings  app on your phone, select Marketplace, tap SmartApps and scroll down to ‘MyApps’


Tap on LaMetric (connect) and login with your LaMetric Account credentials


Tap ‘Done’. After that application will find your LaMetric Time devices in the network. Tap on them to select and tap ‘Done’.


You should see this screen


Great, all is setup! Now you can use SmartApps to send notifications to LaMetric. Also you can customize them by changing default text, adding icon, sound and set notification priority. 

As an example, let's create a rule to send notification to LaMetric Time when movement is detected. So, go to ‘Marketplace’, scroll down to ‘My Apps’ and tap on LaMetric Notifier.

In section 'Show message when' choose SmartSense Motion and select LaMetric Time, which will receive a notification.


For the icon let's use Alarm,  barking dog as a sound and set this event as very important.

After that click 'Save'. Your rule will be visible in 'Automation' tab under 'SmartApps' section


Let us know if you had any issues with the tutorial, so we could improve. 

Thanks!