Here we will describe the basic concepts that are used in CommonSense, and how they are related. We will introduce them by the functionality they provide.
CommonSense is primarily about storing sensor data, and so it should come as no surprise that two basic building blocks are sensors and data. Since its always a user that owns, uploads and retrieves data, this is the third basic building block.
A user is a person or entity owning an account on CommonSense. Access control is done based on users, so as a user you have access to your own sensors and your own data.
A sensor is an object with a collection of data, coming from a single data stream.
Data is... data. Data points have a value and a timestamp and always belong to exactly one sensor. A data value can be anything that is serializable to a string, or a json object.
When the amount of sensors you own grows, it can be very useful to group your sensors in meaningful ways. There are two ways of doing this: using devices and environments or using metatags.
Devices represent real world objects that physically pack multiple sensors. Think, for example of a smartphone or a fridge or a car.
Environments represent real world environments in which multiple sensors exist and which are somehow meaningful to an application. Think for instance of an office buidling, a house, or a city.
A metatag is a key-value pair describing a sensor. It can be anything, and so allows you to organize, group or describe your sensors in any way you want.
A namespace is a grouping of metatags that have the same application domain, for instance "domotics" or "greenhouses". As metatags are free-form, namespace will allow you to structure them and impose some limitations on them.
Sharing your data with others can be extremely useful. As a user, you can do this by creating groups and sharing individual sensors in a group.
A group is a set of users that wish to share data with each other. A group can be private or public, can be anonymous, and individual users can be granted different rights within a group. If you share a sensor in a group, all users with the correct rights in the group can access the data of that sensor. They can never upload data to your sensor though.
Gathering sensor data is all well and good, but you will probably want something to happen. You can do this by using triggers, events and notifications.
A trigger inspects sensors data values when they come in and decides whether they satisfy a customizable condition (such as "> 20"). Triggers can be connected to any sensor you have access to, including shared sensors.
An event is not connected to a specific sensors, but rather watches for user-based events, such as the creation or deletion of a sensor.
A notification informs you of a trigger or event firing. This can be done in a variety of ways, for instance using email, an http request or a text message. Since notifications are separated from the triggers and events themselves, you can choose to be notified in a number of way or use one notification for many triggers and events.
CommonSense can interpret raw sensor data for you, generating meaningful information. For instance, from the data gathered by the sensors in your smartphone, CommonSense can deduce when you are asleep. This is done by using state sensors.
A state sensor takes the data from one or more sensors as input, and performs some calculation on this data. Its output is stored as just another sensor stream, and treated like a sensor. This means you can connect state sensors to other state sensors!