Writing Smartapp/Device Handler for API/Smartthings sensor


I’m new to smartthings app writing, but not new to technology and I’m hoping I can get some ideas/pointers on writing a decent smartapp/device handler for the following situation.

I’m using these Xiaomi plant sensors here to measure moisture, fertilization level, temp and lux for my plants.

Instead of using the app, I’ve leveraged a slightly customized version of this Project to gather the data from the BLE sensors.

Things are working great, I’m using influxdb and grafana to graph the data, and I have the MQTT messages being passed to beebotte.com, which can then expose it to API calls.

I would now like to present this plant data as a thing in SmartThings. What’s the best approach here? Do I start my development path on the classic method, or jump straight into the new? Do I create this as a cloud device, or try to connect it over the LAN? I had assumed that this would be fairly straight forward, but I gave this a cursory overview last night and realized it would not be as straight forward as I assumed. I could really use some help in understanding a path forward, or just some general ideas around making this possible.

Kukuhome -

I created this repository to integrate any MQTT device with ST fairly robustly and easily
check it out

I’m not sure exactly where to start here, but I’ll give it a go.

I would start with the readme there. If you are familiar with node js and or docker the server side should be fairly straightforward.

If you have never used the SmartThings IDE there is some learning curve there but the appropriate SmartApp are already in the package.

In most cases you would not need a custom device handler but not sure if your use case can be mapped to an existing ST virtual device - if not you might need to modify a custom device handles - examples for that are also included in the package

Hello, @kukuhome

Speaking from the Connected platform side:

I’d recommend you to create your device controller app as an AWS Lambda Function so you don’t need to worry about running a server. Check if next libraries suits you:

Regarding the Lambda Function, check this tutorial.

And for your integration, the quickest integration is st-schema. Here is the proper documentation:

And if you need examples, you can always check the SmartThings available samples.


© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.