# Smart Device
The Wi-Fi enabled [Belkin WeMo Insight Switch] connects appliances and electronic devices to your Wi-Fi network, allowing you to turn devices on or off, program customized notifications and change device status - from anywhere. WeMo Insight Switch can monitor your electronics and will send information about the device’s energy usage directly to your smartphone or tablet. Perfect to pair with space heaters, wall A/C units, TVs, washers, dryers, fans, lights and more.
# UPnP Protocol
The WeMo Insight Switch uses [Universal Plug And Play (UPnP)] as the underlying discovery and control mechanism. This API allows you to make RESTful calls to the device, which then converts it to UPnP in the API implementation.
**PS: This API works with the version of WeMo Insight as of Feb 2015. There is no guarantee that future versions of Belkin's switches will support the same underlying protocol or operations**
[Belkin WeMo Insight Switch]:http://www.belkin.com/us/p/P-F7C029/
[Universal Plug And Play (UPnP)]:http://en.wikipedia.org/wiki/Universal_Plug_and_Play
### This ReSTFul API allows you to:
* Discover all WeMo devices on the network that can be controlled via UPnP
* Query the device for current state, power usage, time the device has been ON, etc
* Turn the device ON or OFF or FLASH ON/OFF repeatedly (for instance, as flashing alerts using a light connected to the switch)
## What Next?
The next step is to use an implementation of this API to control and monitor your Insight switch(es). You can build your own implementation of this API from the RAML. To see what free RAML code generators are available, check out http://raml.org/projects.html.
### MuleSoft Implementation
I have implemented this API using the open source Mule ESB. Mule allows you to auto-generate a scaffolding project from this RAML. Then you may use the WeMo connector to talk to the actual switch. Based on intelligent rules, this application can leverage other connectors to talk to any number of systems. These could be enterprise systems (Salesforce, SAP, Email servers, Databases, Messaging Servers, etc), Social media (LinkedIn, Facebook, Twitter, etc) and other services (Zendesk, Box, BigData, SMS, Paypal, Zuora, etc). The full list of connectors are available here:
### How is this different from IFTTT.com Rules
IFTTT does exactly what the name says - If This Then That. It is great for simple rules, and for personal use (e.g. email, SMS, dropbox). However, 'channels' do not exist for many Enterprise level systems. Similarly, complex rules and controlling multiple devices are not currently possible with IFTTT.
### Example usages:
* Automatically flash lights to celebrate a Salesforce deal closing
* Turn an appliance OFF if it has been ON for over a pre-set limit or has drawn more power than it should
* Open a ticket in a ticketing system if power usage goes above a certain limit, then send an email to the technician who should have the device checked out in person
* Turn one or more devices ON/OFF when you get an email, SMS, tweet, poke, etc
* Use the WeMo in combination with any number of systems with REST API's, SOAP API's, Java API's
* Trasform and map data in multiple formats (JSON, XML, CSV) when interfacing the WeMo with multiple systems with their own data formats
* Secure access to your otherwise unsecure WeMo device (one of the flaws with the underlying UPnP protocol) if you plan to allow control over the internet via HTTP
* Other use cases for the WeMo and MuleESB: **Use your imagination here!**