In this tutorial we describe step by step process of integration LaMetric Time into SmartThings ecosystem.
SmartThings account (www.smartthings.com)
LaMetric Time device
On a high level you will need to create:
- Device handler that will handle communication with LaMetric Time device (no worries, source code is available here).
- LaMetric (Connect) smart app, that will discover your LaMetric Time devices inside your network.
- LaMetric Notifier smart app, that will send notifications to your smart clock when something happens.
So, let's get started by creating device handler.
Choose ‘My Device Handlers’ menu item and then click on ‘Create New Device Handler’ button.
Select ‘From Code’ tab, paste the code and press ‘Create’ button.
Press ‘Save’ and ‘Publish’
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.
Choose ‘My SmartApps’ section and press ‘New SmartApp’ button.
Select ‘From Code’ tab, paste the code and press ‘Create’.
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 . 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!
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.