A Smart Sensing Application For The impExplorer Kit
Important This example has not yet been updated to make use of Electric Imp’s new IDE, impCentral™, so some screenshots and instructions here may not match what you see in your browser. We will be updating this tutorial shortly.
And if you want to install the board into a fridge:
First we will need to assemble the Electric Imp impExplorer Kit. The kit comes with:
Assembled it should look like this:
Use the Electric Imp mobile app to configure your device for network access:
If you have any issues getting started with your Electric Imp account or device, see the full Getting Started Guide.
The Electric Imp Platform has two main components: the device and the impCloud™. The device runs the device code, which in this use case consolidates the data gathered by the temperature, humidity and light sensors. Each device is paired one-to-one with its own ‘agent’, which runs the agent code in the impCloud. The device sends the data it gathers to its agent. In this example the agent code executes the logic on the sensor data (eg. light levels show the fridge is open) and communicates with the Salesforce cloud. Here’s a broad overview of this flow:
The Electric Imp IDE provides all the tools you need to write and deploy the software (to the device and agent) that will control your imp-enabled connected product. The IDE runs in a desktop web browser.
If you'd like a quick overview of the IDE, please visit the full Getting Started Guide.
Note To follow this section, please switch to the Salesforce Classic view by clicking on the profile icon at the top right corner of the screen and selecting ‘Switch to Salesforce Classic’.
You will need to create a custom object with fields that correspond to each key in the data table sent by the impExplorer via its agent:
We want the cases opened to contain the Device ID for our refrigerator. To do this we need to create a custom field for our Salesforce case:
index.js
, package.json
and Procfile
) to your Dropbox account (Dropbox/Apps/Heroku/\<your-app-name\>
)</>
)*HEROKU APP URL*
section at the bottom of the agent code and replace **URL of the Heroku application**
with the URL from the Heroku site:Your App should now be up and running. You can monitor the device logs in the IDE, or log into Salesforce web portal to see updates there.
Open your refrigerator and place the impExplorer on a shelf in your refrigerator door.
If you don't have a fridge handy for this scenario, you can test the door being open by moving or tapping the Kit, and keeping it in a lit room. A door open for 30 seconds should register a case.
Now that you have connected your impExplorer to Salesforce, it might be handy to see that data on a mobile device. It’s easy to keep track of your Smart Fridge on the go using Salesforce1.
First, let’s give the custom object a tab so that Salesforce1 can add it to the left navigation.
You can access the Salesforce1 mobile app in three ways:
For this step, we’ll use the last option. First ensure that Salesforce1 is available through a desktop browser and is enabled for your user:
Next, we’ll emulate the Salesforce1 Mobile App in the Chrome web browser:
salesforce.com/
. For example:/one/one.app
to the end of the URL after salesforce.com
to start the Salesforce1 Application simulator. For example:Finally, let’s add some finesse to our application by using Process Builder to drive a Chatter conversation based on the incoming readings.
Next, we’ll set up the criteria that will fire the process:
In the ‘Immediate Actions’ box next to your new criteria, click ‘Add Action’ and configure as follows:
The case ({![Case].Id}) was opened regarding the Smart Fridge {![Case].Related_Fridge__r.DeviceId__c}.
This fridge was recorded at a temperature of {![Case].Related_Fridge__r.Temperature__c},
humidity of {![Case].Related_Fridge__r.Humidity__c}, and a door status of {![Case].Related_Fridge__r.Door__c}.
Now whenever a case is created that has a related Smart Fridge, the important data about that fridge will be accessible right from the case owner’s Chatter feed.
Let’s try out the process by keeping the fridge door open for over 30 seconds. This should trigger Salesforce to create a case. Because the case is related to a fridge, the case will be posted to your Chatter feed: