Integrating a wifi controlled system with SmartThings


(Bryan Lemon) #1

So I see how you can use a SmartApp Endpoint to allow an external system (such as a website I wrote to control a LiFx lightbulb) to trigger an actuator, or read the current value of a sensor. However, looking at the SmartThings documentation, I don’t see a way to trigger an external system with a SmartApp.

For example, I would like to write a SmartApp that would turn a light on when a SmartMotion sensor detects motion, and turn it off after a certain number of minutes without motion.
As it stands, I could write a polling app, but that would introduce an undesired delay into the equation.

Alternatively, if its not possible to call an external URL via a SmartApp, I can always hook it up to ifttt.com to send a twitter message, and write a php app to pull the twitter userstream, but that is just adding in 3 more layers of complexity for events to get lost in. I mean SmartMotion -> SmartHub -> SmartThings -> REST API -> LiFx is much shorter than SmartMotion -> SmartHub -> SmartThings -> Ifttt -> twitter -> twitter user stream consumer -> REST API -> LiFx.


(Dbarak) #2

It is possible to use any REST API with a smartapp. You can use a httpPost and httpGet command


(Bryan Lemon) #3

Huh. I have been pouring over the examples and documentation on the website, and never saw it. Thanks! Next time to integrate the systems.


(Chrisb) #4

@bryan-lemon-icclegmail-com,

If I may make a suggestion, I would write your program in a manner similar to my Wireless-3Way app. Essentially connecting your Lifx bulb to an existing Zwave switch. Then I’d add a Virtual On/Off Tile to your SmartThings setup and use your app to tie the Bulb and the On/Off tile together.

Here’s the big benefit of doing that: Now you have a device (Virtual On/Off Tile) that will work is ANY existing SmartApp. You can now use it just like that Tile in existing programs that turn on with Motion or with programs that turn on when a door is open, etc, etc.

Basically you’re writing one program that allows you to turn your Lifx bulb into a virtual device that will work with any SmartApp instead of re-writing any existing app to work with the Lifx Bulb.

Oh, and on a side note: If you get this up and working, I’d LOVE if you’d share it. I’m hoping to get my Lifx bulbs soon and I’d like to be able to integrate them on some level.


(Bryan Lemon) #5

Huh. Do you have an example of a virtual on/off tile? If so, I can have this running tonight.


(Chrisb) #6

@bryan-lemon-icclegmail-com

Just go to your Device List in the IDE, click the New Device button in the top right. Give it a name and a made up Hexi-decimal number for the Device Network ID. Type is “On/Off Button Tile.” Pick your Hub and then click on the Create Button. Now it’ll show up in your Mobile App.


(King) #7

Did you have any luck with the code on the virtual switch to turn on and off Lifx bulbs?

Thanks.

Jesse