New to Lhings? Then you are in the right place. This section will explain you the main concepts behind Lhings and will guide you through the process of connecting your first device to Lhings.
Lhings allows you to connect your devices to the internet and interact with you and other devices. To ease this interaction and make it more powerful there are two more components in the Lhings ecosystem: the apps and the rules. Furthermore, to provide some semantics to these interactions, features of devices have been categorized into actions, events and status. This section explains in more detail all these core concepts of Lhings.
The main three components of the Lhings ecosystem are:
- Devices: A device is a physical object which can perform a set of actions, and can notify about the occurrence of some events. In principle anything can be a device. A sensor, an actuator, a ball, a computer, a table and a button could interact among themselves whenever they are made able to connect to the internet and communicate to Lhings.
- Apps: Similarly to devices, in Lhings the apps are entities which can perform actions and notify events. However, they will let you interact with external web services and applications, unlike devices, they do not have a physical counterpart. An example of external service your devices can interact with using apps are social networks, like Twitter. In Lhings apps also provide horizontal services, like scheduling of tasks and alert notifications.
- Rules: Rules are relationships between events and actions that allow the interaction among different devices. They provide the way of telling Lhings: when device A notifies about this event, then tell device B to perform that action. You can create and edit your own Rules and automate the interaction between your devices and apps. For example, you can configure our Android and Iphone app PlugLhings to send an event whenever you leave home. Then, if your lighting system is also connected to Lhings, you can create a rule that turns off the lights when this event is received.
Interaction in Lhings is build around three core concepts:
- Actions: actions are what a device or app can do. Turning on or off a light, changing the temperature of a heating system, opening a door, or sending a tweet, are examples of actions. Actions can have parameters that define in more detail how to perform the action. In the example of the heating system, a parameter can be the set point temperature.
- Events: events are messages sent by devices or apps to tell Lhings that something has happened or to send some information. For example, a door was closed or the heating system is not working properly.
- Status: the status a set of values that represents the current state of the device. For example, the thermomether can have a status called temperature. The status of a device is not limited to one value, it can be composed of several values, for example, if the device is a cooker the status could be composed of several temperatures, one for each heater.
It is the device itself who defines which are the actions, events and status it has. It does this by sending to Lhings a description of its own features the first time it connects.
The best way to understand all this is through an example. Let's connect your first device to Lhings! The first thing to do is to create an account if you have not done it yet.
Once you have a Lhings account the next step is to install PlugLhings Android or iPhone app (coming soon). Basically, PlugLhings transforms your phone in a device connected to Lhings with some action, events, and statuses:
- Vibrate: makes your phone vibrate remotely.
- Notification: makes your phone show some text notification.
- Geofence In: sends an event whenever you enter a given geographic location (e. g. the neighborhood of your home). The location can be configured from the app itself.
- Geofence Out: the same as Geofence In, but the event is sent when you leave the location.
- Battery: the status of the PlugLhings device has only one component, the battery level of your phone.
Open the app and enter your Lhings username and password. You may want to see the built-in "Get started" tutorial, to have a quick overview. You will see a screen similar to this one:
You can enable or disable actions, events and statuses by touching its icon. Be sure all actions and status are enabled (we will enable geofences later), do not close the application, and log in Lhings at http://www.lhings.com/laas/. Go to the devices tab. You will see only one device in your list of devices, called PlugLhings, like in the screenshot below:
Click on its name to access the control panel. In the screen that will appear you will see on the left the battery level of your phone. On the right you will see the two actions enabled. Click the button Do on action Vibration and you will see your phone vibrate inmediately. You can control it remotely!! Try also the notification action out, entering some text on the input box. Go again to PlugLhings, disable some action or the status, reload the control panel in Lhings and see how it changes accordingly.
But we can do even fancier things. In PlugLhings go to the events tab and enter in Edit your geofence location. Enter a location of your choice (e. g. your home, or your workplace) and save it. Do the same for both Geofence In and Geofence Out events, and enable them.
Now your phone will notify Lhings every time you enter or leave the location you defined. You can link these events to actions in other devices or apps through a rule. In order to see this in action do the following. In Lhings go to the Apps tab and install the Twitter app. You will need a Twitter account to do this. The Twitter app has only one action called Send Tweet. We will link the Geofence Out event with this action, so that a Tweet is sent whenever you leave the location you configured.
Go to the Rules tab and click on Create a rule button. Rule creation is composed of five steps: 1. Select the device whose events will trigger the action. In this case select PlugLhings. 2. Select the particular event of the device that will trigger the action. In this case select Geofence Out. 3. Select the target device or app, which will perform the action. In this case select Twitter. 4. Select the target action, in this case, Send Tweet. 5. Finally, give a name to your rule (e. g. "Tweet when leaving home") and click on Create rule.
You will see a screen similar to this one when finished:
Now, every time you leave your location a Tweet will be sent. In this example you have linked the Geofence Out event with Twitter, but you could link it to any action of any of your devices. Notice the power of this, you could link it for instance to your air conditioning system, so that it turns off when you leave home! The possibilities are countless.