Things¶
Things represent real-world devices, parts of devices, actuators, sensors or other entities. They are fine-grained digital twins which are typically contained inside Instances. They have a strict type and there may be many things of the same type running inside SMIP Agents.
Thing facts:
- has a globally unique id which consists of two parts:
the namespace UUID like:
TI-f6ab19b0-20ed-41ef-99cc-40bf287f25b7the local thing id like:
rgb_light_01there may be more things grouped together under the same namespace
has a strict type
- may have various custom (searchable) attributes
may be searched or filtered by using Thing Selectors
may affect its entity (e.g., switch light on/off, change temperature setpoint, open door etc.)
declares its own alarms (e.g., high temperature, low battery etc.)
declares its own events (e.g., motion detected, security key used etc.)
uses scripted rules that listen to data changes and produce various consequences by possibly calling other things or cloud modules.
may send/push real-time data points, alarms and events to various (cloud) targets including Cloud Data Push targets
may be visualized, scripted, affected by instances in SMIP
may expose its data and functionality trough SMIP IoT Data APIs
may be managed and upgraded from SMIP
For more details about things please see chapter 6. IoT Content: cloud and edge in SMIP Architecture and Functionality Overview .
Things exposed in Data API¶
Data API clients may obtain a list of all available thing types by calling READ all thing types info API.
Thing type info API returns:
type namespace like:
com.company.smarthome.thingstype id like:
temperature_sensor-1_0list of readable attributes: only available trough polling APIs
list of readable/writable/pushable real-time variables
list of pushable alarms
list of pushable events
Thing’s attributes¶
Thing’s attributes are mostly constant values which usually describe a thing. The table below contains attributes and attribute types that may be exposed in IoT APIs.
Prefix |
Searchable |
Description |
Examples |
|---|---|---|---|
|
true |
Basic thing attributes |
|
|
false |
Extra thing attributes |
|
|
true |
Thing initialization parameters |
These depend on each thing’s type. Parameters are something like: |
|
true |
Thing metadata attributes. They may be used by IoT Agents or by SMIP cloud to group things or to affect thing representation and behavior. |
These depend on each thing’s type. Attributes are something like: |
API clients may read things’ attributes and real-time data by calling IoT Data APIs, which directly return the requested values (polling-based APIs). For Push-based APIs see next chapter.
Things as data push sources¶
When third-party partners need to access things, they may use polling-based REST IoT Data APIs. However, things are also the primary data push source in SMIP.
When real-time push notification are needed, API clients may subscribe to things’ real-time data changes, alarms and events. One may use Push Data APIs described also in Cloud Data Push. Calls to READ all thing types info API will return the information about what is available to polling APIs and what to push ones.
Using push APIs and protocols is the preferred way of obtaining IoT Data from SMIP.
Thing Selectors¶
Searching for things and grouping things is a common requirement. Many operations may be performed on a thing group not just on a per thing basis.
A thing selector is a query expression that searches for things by using various thing properties like: thing id, thing type, thing parameters, thing metadata attributes etc.
The name selector is used on purpose here, since it mimics HTML DOM and CSS selectors.
All selectors are executed on a specific instance.
A simple selector example:
#consumer_1_1 - find the thing with local id consumer_1_1.
Basic selectors¶
Operator |
Description |
Examples |
|---|---|---|
|
Any thing |
|
|
|
|
|
|
|
|
Thing by local id |
|
|
TODO - Thing by class |
TODO - future development |
|
Grouping (UNION - multiple selector results in one selector) |
|
Relational selectors¶
Operator |
Description |
Examples |
|---|---|---|
|
Descendant thing |
|
|
Direct child thing |
|
|
General sibling thing |
|
Attribute selectors¶
Operator |
Description |
Examples |
|---|---|---|
[a:]must be one of:
|
Thing with (hardcoded) attribute |
|
|
Thing with parameter |
|
|
Thing with metadata attribute |
|
Attribute types¶
Type |
Description |
Examples |
|---|---|---|
STRING |
A single quoted string (sequence of characters). |
|
NUMERIC |
A number with or without a decimal point. |
|
BOOLEAN |
true or false |
|
Attribute operators¶
Operator |
Description |
Examples |
|---|---|---|
Parameter exists |
|
|
|
NUMERIC, STRING or BOOLEAN parameter equals |
|
|
Parameter has a STRING value in a whitespace separated list |
|
|
Parameter has a hyphen-separated list of STRING values beginning (from the left) with value |
|
|
Parameter has a STRING value that starts with the given value |
|
|
Parameter has a STRING value that ends with the given value |
|
|
Parameter has a STRING value that contains at least one instance of the given value |
|
|
Parameter has a NUMERIC value that is greater or equal to the given NUMERIC value |
|
|
Parameter has a NUMERIC value that is greater the given NUMERIC value |
|
|
Parameter has a NUMERIC value that is lower that or equal to the given NUMERIC value |
|
|
Parameter has a NUMERIC value that is lower that the given NUMERIC value |
|
|
Negation of the first parameter expression that follows |
|
Selector Combinations¶
All specific selectors described in previous chapters may be combined into one selector as follows:
Simple Combined Selector¶
Selector: BASIC_SELECTOR[ATTRIBUTE_SELECTOR_1]...[ATTRIBUTE_SELECTOR_N]
Meaning: find things such as each thing obeys BASIC_SELECTOR AND [ATTRIBUTE_SELECTOR_1] AND … AND [ATTRIBUTE_SELECTOR_N].
Example: ?consumer[p:index=1][m:icon>0][m:thing_display=1]
Hierarchical combined Selector¶
Selector: SEL_1[ATT_SEL_11]...[ATT_SEL_1N] > SEL_2[ATT_SEL_21]...[ATT_SEL_2N]
Meaning: find things such as each thing obeys ALL given constraints (AND operation).
Example: #my_controller > ?consumer[p:index=1][m:icon>0][m:thing_display=1]
Grouping selectors¶
Selector: SELECTOR_1, ..., SELECTOR_N
Meaning: find things such as each thing obeys SELECTOR_1 OR … OR SELECTOR_N : the result is a UNION of N selectors.
Examples:
#xems_bridge,#consumer_1_1,#consumer_2_1#xems_bridge>?consumer[p:index>0],#consumer_1_1~?consumer