There is a known issue with Debian 10 (esp. on Raspberry Pi) where the SSL connection to the Sense server will fail. Until this is resolved, I suggest using Debian 9 or something else.
Connects SmartThings with Sense
- This SmartApp is considered an early "beta" - functionality is limited and there are likely to be bugs. Feel free to create and track issues here.
- This SmartApp is currently only supported in the SmartThings Classic mobile app; the new app does not yet support custom apps like this.
- The app requires a node server running on a machine (PC, Raspberry PI, etc.) on the same LAN as your SmartThings hub (don't worry - setup is quite simple). The node server creates a realtime websocket connection with Sense. On relevant events, the node server sends data over your LAN to the hub. The SmartApp listens for this data and then updates devices in SmartThings as needed.
- Special thanks to blandman for his work on the unofficial sense API node library
- This app automatically creates devices in SmartThings based on Sense devices. It also handles when those devices are renamed.
- Device status (on/off) and power usage is kept in sync within SmartThings. You can use these values to drive various other routines or ActionTiles panels.
- This app offers the option to send push notifications when devices turn on or off. Access push notification settings at each individual device in the SmartThings mobile app.
- You can set "quiet modes" during which notifications will not be sent. Go to the Sense SmartApp in the SmartThings mobile app to configure this.
There are 2 code files needed: 1 SmartApp and 1 Device Handler.
- Log in to the SmartThings IDE. If you don't have a login yet, create one.
- The first step is to create the device handler.
- Click on My Device Handlers -> Create new Device Handler -> From Code.
- Copy contents of Sense Device and paste into text area. Click Create. Click Publish > For Me
- Now we create the SmartApp code. Click My SmartApps -> New Smartapp -> From Code.
- Copy contents of SmartApp and paste into text area. Click Create. Click Publish > For Me
- In your SmartThings mobile app, tap Automation -> SmartApps -> Add a SmartApp. Scroll down and tap My Apps. Tap Sense. Tap save to complete the installation. Your SmartApp is now listening for Sense data. Move on to the node server setup!
If you have not set up the GitHub integration yet or do not know about it, take a look at the SmartThings documentation here. Note that if you do not have a GitHub account or are not familiar with GitHub, the manual method of installation is recommended.
- If you haven't already, click on enable GitHub button (upper right). Add a new repository with user
brbeaird
, repositorySmartThings_SenseMonitor
, and branchmaster
. This can be done in either the "My Device Handlers" or "My SmartApps" sections - Go to "My Device Handlers". Click "Update from Repo". Select the "SmartThings_SenseMonitor" repository. You should see the device type in the "New (only in GitHub)" section. Check the box next to it. Check the "Publish" checkbox in the bottom right hand corner. Click "Execute Update".
- Go to "My SmartApps". Click "Update from Repo". Select the "SmartThings_SenseMonitor" repository. You should see the SmartApp in the "New (only in GitHub)" section. Check both box next to it. Check the "Publish" checkbox in the bottom right hand corner. Click "Execute Update".
- In your SmartThings mobile app, tap Automation -> SmartApps -> Add a SmartApp. Scroll down and tap My Apps. Tap Sense. Tap save to complete the installation. Your SmartApp is now listening for Sense data. Move on to the node server setup!
In the future, should you wish to update, simply repeat steps 2 and 3. The only difference is you will see the device type/SmartApp show up in the "Obsolete (updated in GitHub)" column instead.
- If you don't already have it, Download and install Node.js
- Download (or git clone) the files in this repository. If you're new to git, you can click the green Download button and grab a zip file of everything. Extract the zip file.
- Open a command prompt and navigate to the location where you downloaded the files in step 2. Navigate down to SmartThings_SenseMonitor\node_server.
- Run
npm install
(this grabs needed libraries) - Open the config.js file in a text editor and put in your Sense login information and SmartThings hub IP under the required settings section. You can find your hub IP in the SmartThings IDE by clicking the Hub link, then clicking your hub, then scrolling down to IP Address. Be sure to save your changes.
- Run
node server.js
. This starts up the data connection. If all goes well, you should see a successful connection message. Leave this window running to continue collecting data and sending it to SmartThings. - I strongly recommend using something like PM2 to keep the node server running in the background. Will add more detailed steps on that later.