My SmartThings multisensor is a great little piece of technology. It reports, in real time, motion, temperature, and open/close state of my back door. The iOS app is slick, too, but I wanted a way to view it from my computer and have access to historical data.
Enter Dweet and Freeboard from Buglabs.
There's actually no setup required on Dweet (but be sure to check out their nifty demo). It just starts eating data and making it available for use via HTTP/JSON!
To create a SmartApp you neeed to be a SmartThings developer (free and simple process). Then the app is built in the SmartThings web-based IDE, and installed directly to your SmartThings system.
- Create a new SmartApp
- Edit the code of your project and paste in the
dweet.groovy
file below- You can leave the license info and definition section at the top if you'd like
- Click Save
- Select your SmartThings hub location (i.e. "Home") in the right sidebar
- Fill in your preferences
- Select a physical device that has a temperature sensor
- Enter any string you want to dweet as
- It should be unique so as to not conflict with others, UUID Generator is helpful
- Click Install
A simulator tile of that device should appear.
A developer console will pop up. Check for any red errors.
If there are no errors, your device should have dweeted! You can confirm by visiting http://dweet.io/follow/THE-NAME-YOU-CHOSE-EARLIER and see some JSON like:
{
"contact": "closed",
"degrees": 68,
"unit": "F"
}
The device will continue to dweet when the temperature or contact change.
Let's add the dweeted data to a slick (free!) dashboard from Freeboard.io.
Set up a free account, and walk through the tutorial.
Now make a gauge for the sensor's temperature:
- Add a Dweet datasource using the "Thing Name" your SmartThings sensor "dweets" as
- Add a new pane to the Freeboard
- Add a new widget to the new pane of type "Gauge"
- Click "+ Datasource" and select your dweet source and its
degrees
attribute- Mine looks like this:
datasources["Deck Door"].degrees
- Mine looks like this:
- Save
You should see the current temperature of your sensor in the gauge.
TODO: Add set up for temp sparkline
TODO: Add set up for open/closed indicator light
This is based on @alexking's implementation.
I simply added a datapoint about the "contact" (open/close) attribute of the sensor.
If you're trying to graph values over time, it would be better to set up an interval in your SmartThings SmartApp rather than subscribing to changes in temperature as they may not come in regularly.
Dweets are public by default, so data about your sensor is public. Not a huge deal since you can easily lock them down.
A more adaptable approach may be to create a generic SmartApp that dweets a devices entire status. I'm working on this next.
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Thanks @tbeseda! Great writeup.