Supporting Active Aging Through A Home Automation Infrastructure for Social Internet of Things

Article history: Received: 30 May, 2018 Accepted: 05 July, 2018 Online: 29 July, 2018 The number of smart devices inside the living environments grows more and more every day, and with it the need to interface them in order to share data and activate functions. Each day, new scenarios and new applications emerge to make our lives easier in many different contexts. The AAL SOCIALIZE project aims to create a new reference platform for active ageing by applying technological solutions to care for the health of the elderly, facilitate their daily activities, simplify their access to dedicated services. The work presented herein describes the "Elderly Monitoring service" ‒ an IoT module of the SOCIALIZE platform, whose aim is to monitor elderly people's activities and physiological parameters and to combine smart device functions. This modeling process can actively contribute to anticipating, and thereby preventing, emergency situations, increasing elderly autonomy and making them feel "protected" and "safe". In this regard, the system implements a practicable, scalable solution that allows heterogeneous devices belonging to different domotic systems using diverse protocols to interact with each other, share data and services and bind together through ‘friendship’, thereby creating an infrastructure suitable for the creation of a true Social IoT (SIoT).


Introduction
This paper is an extension of the work originally presented in 2017 Global Internet of Things Summit (GIoTS) [1].
The issues involved in welfare and health costs sustainability are currently the focus of widespread discussion in many nations of the world. Of such issues, one of the most frequently addressed is population ageing. The ageing population will soon become one of the most demanding Big Societal Challenges that the world will face [2]. Over the last 150 years, life expectancy has risen by 50 years, and over the last half century alone it has increased by three years every decade.
Hand in hand with ageing, it is highly likely that the elderly will experience an increase in disability and dependence, along with a greater incidence of age-related illnesses and the need for medication [3]. The majority of the ageing population experiences progressive deterioration of their health from 50 to 80 years of age. As a result, there is an interval of 30 years during which subjects age with deteriorating health -a critical aspect to take into consideration when seeking to preserve good quality of life for the elderly. Over recent years the elderly population has been growing. This is mainly due to the progressive increase in life expectancy and the low fertility rates affecting an ever greater proportion of the overall population [4]. This progressive increase in the elderly population has led to a new phenomenon: so-called active ageing. According to the definition of the World Health Organization [5], active aging is "a process of optimization of opportunities for health, participation and safety in order to improve the quality of life of older people". Active aging is epitomized by elderly people who, rather than spend their entire day sitting at home, bored, in an armchair, voluntarily stay in the workforce for as long as they can, they exercise, they train, they take care of their children and grandchildren. They are over 65-70 years of age, they are healthy, they are satisfied and they often have acquired skills, including on the technological and logical levels. In the near future, the upcoming candidates to join the ranks of the active aging are currently in the age range of 50-60 years. The European Community is actively involved in caring for the active ageing, and to such end has launched the programme "Ageing well in the information society". Moreover, the European Commission declared 2012" The Year of Active Ageing and Solidarity between Generations". One result of the measures adopted in 2012 is the formulation of the active ageing index, which measures the ability of older people to achieve their full potential in terms of ASTESJ ISSN: 2415-6698 employment, social and cultural participation and maintaining autonomy.
In an information society, Information and Communication Technology (ICT) plays an important role for the active elderly. Utilizing the WWW, for example, they can get information, have social interactions, participate in social and political life, enjoy simplified access to administrative and commercial transactions, find online entertainment and leisure activities, and so on [6]. Moreover, ICT offers a great opportunity for older people living home alone. According to the Internet of Things (IoT) paradigm, objects are rendered 'intelligent'-they can be discovered, localized, and acquire, process and exchange data. Smart Home & Building applications are particularly important in the IoT scenario, as they are the link between the individual (citizen, consumer) and the overlying layers implementing the IoT paradigm (Smart City, Smart Grid) [7].
The IoT is however not merely a distant vision of the futureit is already here and is having an impact on more than just technological developments. It permits sophisticated devices to share information directly with each other and the cloud, making it possible to collect, record and analyze new data streams faster and more accurately. So, it is now possible to exploit a broad set of services able to improve the autonomy of the elderly [8] and constantly monitor their health status and identify any potentially hazardous conditions [9]. Connected 'smart objects' can be used to collect data on the health status of home residents, particularly those at risk. The IoT will thus make possible to create environments equipped with such intelligent devices in which an older person's state of health is constantly monitored, allowing for more effective management of his or her long-term well-being. The advent of the IoT and its new technological capabilities offers many advantages over traditional health monitoring. In particular, conventional monitoring systems are not predictive, that is, they cannot offer the same accuracy as modern biometric detection systems, which are capable of recognizing emergencies before they occur, and they do not have the ability to "automatically" launch a warning to formal and/or informal caregivers without direct action by the elderly person.
Instead, by combining wearable devices with IoT these limitations can be overcome. Commercial products offering similar such features already exist: intelligent watches whose functions range from detecting movements indicating a possible fall and contacting the authorities or relatives, to the ability to "learn" a person's normal activities and send an alert by text message, email, or other app if a significant change occurs (e.g. a user lies in bed for an entire weekend).
The last frontier of the Internet of Things is the evolution of objects that are 'merely' smart to objects that can be social. This paradigm is called Social Internet of Things (SIoT) [10,11]. The SIoT is defined as an IoT in which objects are capable of establishing social relationships with other objects, independently of human intervention, thereby creating a social network of objects.
The key principle guiding the SOCIALIZE project [12] is to create a complete technological solution which effectively fulfills the general objectives of the third call of the EU -AAL (Ambient Assisted Living) programme. The SOCIALIZE project is creating a new, specialized platform expressly dedicated to today and tomorrow's active ageing people in order to facilitate their participation in social life.
The authors' main contribution to the project presented in this work is the study and development of a SIoT ready service, called the Elderly Monitor, which is fully integrated into the SOCIALIZE platform. The function of the service is to monitor the activities of home occupants, collect and analyze personal and environmental parameters from various, technologically heterogeneous devices and enable them to cooperate and share data. The results of the monitoring can be accessed by doctors, relatives and/or caregivers as deemed appropriate with regard, for example, to the cognitive, health status and wishes of the person in question.
The paper is organized as follows: in The Social IoT (SIoT) section is introduced the feature and advantages of the SIoT apprach, in the Related work section are shown the most significant solutions for the monitoring and analysis of the user's health parameters, the main applications of the IoT in the health field and the most widely used SIoT approaches. In the section Socialize Project is presented the SOCIALIZE project with its main features and objectives. This section allows to illustrate the context in which the application presented in this work was studied and developed. In the section SmartSMILE framework is described in detail the ideas of the proposed solution. In the Implementation section are described how some domotic technologies have been integrated in the framework. In the Field trials section are shown the deployment and the experiments carried out to verify the correct functioning of the system. Finally, we have the Conclusions section that summarizes and concludes the work.

The Social IoT (SIoT)
Adoption of the SIoT paradigm presents several further advantages: (i) the resulting structure of such object networks can be shaped as required to guarantee network navigability and effectively perform the discovery of objects and services, thereby guaranteeing scalability, just as in human social networks; (ii) a level of trustworthiness can be established to leverage the degree of interaction among things that are 'friends'; (iii) models designed to study social networks can be reused to address IoT related issues (intrinsically related to extensive networks of interconnected objects). Thanks to the implementation of this paradigm, devices become part of a social network of objects. As in human social networks, the concept of "friend" plays a key role in SIoT. By exploiting device friendship, things can be made to interoperate autonomously by implementing intelligent behaviors [13]. This scenario has opened up the possibility for new object intelligence: the ability to discover new services, activate new contacts with other objects, share information with them, and use the capabilities of other objects towards the attainment of a common goal.
In order for SIoT principles to be effectively applied, the communication and integration infrastructure of IoT devices must be built in such a way as to address specific challenges. If we consider the domestic environment, most of them concern the lack of interoperability between the diverse installed home automation systems, but not only. The SIoT must be based on an infrastructure able to support the following services: • Discovery: the ability for devices to detect the functions of other devices. This service is useful to automatically identify device functions that could be combined together to create new, more advanced ones. This implies that each service of each device must be identified, addressed and described using an ontology, taxonomy or free-text description that follows predefined rules in order to be computed.
• Composition: the ability to combine the functions of different devices to create new system capabilities. To do this, the constituent devices of a system have to "speak" the same language. This can only be obtained either by using devices that adopt the same communication technology or by implementing interoperability between natively incompatible devices to share states, values and function calls. Interoperability is the ability of two or more incompatible systems to communicate in a way to create a functional dependence between them, allowing them to act like a single system that behaves as a single entity [14].
• Trustworthiness management: the ability to understand how to use the information provided by other devices. To implement this service, it is useful to apply the concepts of centrality, prestige and reliability. Centrality measures the number of contacts any given device has within the network; prestige measures how many other devices seek that device. Centrality and prestige are summarized in a value called reliability. These measures are particularly interesting in big IoT scenarios, in which the network is made up of numerous devices and a mechanism is needed to determine which are most dependable for reaching a particular goal.
On the contrary, the vast majority of existing IoT interoperability platforms are not designed to offer all these features in an integrated way. Devices and applications do not communicate directly between each other, but use cloud connectivity, computing and storage features as intermediaries.
In fact, in January 2016, with the Horizon 2020 research programme, the European Commission funded seven projects to address the interoperability of the Internet of Things: Inter-IoT [15], BIG IoT [16], AGILE [17], symbIoTe [18], VICINITY [19], bIoTope [20]. In general, the most widely followed technical approach to address these issues is the implementation of a hierarchical IoT stack connecting smart objects and IoT gateways with the cloud. In these projects, interoperability is implemented by collecting device data in the cloud (typically in a database) where they can be queried in order to process information.

Related work
The current scientific literature addresses the issue of elderly health monitoring with solutions that are able to collect and then display data, typically through a web interface, to formal and / or informal caregivers who can check them to oversee an elderly person's health status. In addition to allowing viewing of the collected data, most of the proposed solutions include a preliminary automatic analysis of the occupant's health. Such analyses take different approaches. Some check whether a prefixed threshold for some specific health parameter (e.g. heart rate) has been exceeded and then send a notification to designated recipients. Others use more advanced intelligent systems that are able to understand trends in a set of specific user parameters and thereby make decisions and automatically launch alarms and warnings when vital sign values are considered suspicious. Some examples of this kind of systems are those that analyze data in real time. In [21], the author proposes a pervasive patient health monitoring (PPHM) system based on wireless wearable devices integrated through a cloud computing infrastructure. The work presents also a solution based on ECG to monitor patient suffering of congestive heart failure; in [22], the author proposes a system to monitor cardiac activities using wireless wearable sensors and an Android device, taking into consideration cost and ease of use; GiraffPlus [23] project belongs to the Programme for Research and Technological Development in the Seventh Framework (2007-2013), which proposes a monitoring system solution based on environmental wireless sensors and a robot recognising user's activities and physiological parameters; in [24], the author proposes a work to monitor in mobility patients using 6LoWPAN (IPv6 over Low-Power Wireless Personal Area Networks) devices in a hospital; in [25], the author presents an NFC and RFID based telemonitoring mobile solution to monitor blood pressure and heart rate; in [26], the author shows a mobility medication control system exploiting RFID technology.
With the growth of information coming from numerous sensors, the management of health data is crucial. Literature presents two interesting and innovative approaches to health data management: in [27], the author offers an engine for querying data from heterogeneous sources; in [28], the author presents a cloud computing system based on data mining procedures to correlate health and lifestyle.
All the presented works are examples of IoT technology applied to the health field. Unfortunately, virtually all have been designed for, and are strictly tied to, specific proprietary hardware or devices and technological communication standards, creating quite strong constraints on the choice of devices to be used for monitoring. To overcome such limitation and enable devices to be chosen based on their functionalities, cost and performance, regardless of purely technical and compatibility aspects, a system is needed that allows different devices using different communication standards to work together at the same time.
Current literature studies apply the social concept to IoT in two different ways: devices interacting directly with humans, following the example of Social Networks (SIoT between devices and humans) [29] and devices that interact amongst themselves in a Social IoT way (SIoT between devices). This twofold interpretation of SIoT has been described in [30], which also provides some examples of interactions between devices. In [31], the author extends and formalizes the differences between these two scenarios by defining the integration of devices within Social Networks as the Web of Things (WOT) and direct interactions between devices as the SIoT proper. They also detail the state of the art of the underlying technologies and apply these concepts to Wireless Sensor Networks. In [32], the author presents a solution and a prototype able to establish communications between two or more heterogeneous devices by exploiting their proximity (the communication takes place only when devices are near each other). Once again, most of the SIoT approaches proposed in the literature are designed for specific proprietary hardware or devices.
With regard to the current state of the art, herein we present a new home automation interoperability architecture based on the "friend" concept applied to services and devices. The greatest advantage offered by the system is that it is designed to integrate new devices, home automation systems or sensor networks, even if they communicate through different, incompatible native protocols. Exploiting the SIoT paradigm, devices and services communicate and share values and states with each other directly, without the need for intermediary components such as a database.
One direct consequence of Social paradigm approach is the advantage of being able, as needed or convenient, to freely replace any device or appliance of a specific brand with another brand's device without interfering with the functioning of the entire system. It moreover allows for the possibility of supporting the network application layers implementing the SIoT functions for different purposes, as well.

Socialize Project
The SOCIALIZE (Service Oriented Assisted Living Infrastructure) project aims to meet the needs of today's (and future) active ageing. The projects aims to create a complete technological Web solution which integrates into a single platform a multiplicity of services designed specifically for the senior population and their caregivers (secondary end users). These services aim to strengthen social relations among the elderly, and with their relatives, who often live far away, and to create a sense of security and autonomy at home. The distance separating relatives from and older person living alone at home represents a potential health and security risk. In fact, the elderly are more subject to chronic diseases and unexpected critical health events. For these reasons, it is crucial to be able to monitor their health status and activities in order to identify any possible worsening of their conditions and avoid dangerous situations.
Although the SOCIALIZE Project is currently aimed at active ageing people with a certain degree of knowledge about the use of technological equipment, the ultimate goal is to make the platform accessible to all elderly people, including and especially, the large proportion of the older population that nowadays has great difficulty accessing and using ICT. For this reason, the user interfaces have been given rather simplified designs to make them easy to use, thereby permitting the inclusion of the largest number of elderly as possible. The services supplied by the project (Figure 1) can be divided in three categories: • Socialization services: which aim to improve older people's social interactions. These include: (a) communications: enables exchanging messages and making audio / video call between the members of the SOCIALIZE community; (b) socialization: a dedicated social network between SOCIALIZE members; (c) forum: an advanced application for discussion of topics of general and personal interest; it can also highlight the most interesting discussions; (e) photo book: for storing and organizing photos and videos; (f) distance care: can follow the member's movements and monitor daily activities, and even warn of any threats; (g) monitor: analyzes user activities, as well as personal and environmental parameters; the results of this monitoring can be supervised by doctors, relatives and / or caregivers as is deemed appropriate with regard, for example, to the cognitive, health status and wishes of the elderly; • Cross services: vertical applications common to all socialization services. The cross services currently implemented are: (a) configuration tool: provides for configuration of the system and services; (b) user & billing: manages SOCIALIZE platform users and their access credentials; (c) remote support: which provides help on using the SOCIALIZE platform or, more generally, computers or the device used; (d) agenda: collects all the events and date/timerelated activities for a given user; (e) service catalogue: manages the available services, enabling them to communicate through the use of an enterprise bus system; • Cloud services: it allows to the different services provided by the platform to communicate by sharing data and functionalities and it hosts the database containing data coming from the different Socialize service components. It consists of: (a) easy access Human Machine Interface (HMI), a web application with public and private content that acts as the entry point to the Socialize platform; (b) database, containing all the information related to users and services.

Concepts and use cases
The elderly monitor service is part of the SOCIALIZE platform. Its aim is, on one hand, to monitor elderly people's activities and physiological parameters to display processed data to caregivers, doctors, and relatives, to notify them of suspicious values, and on the other, to combine device functions to improve the individuals' life at home, increasing their autonomy and making them feel "protected" and "safe". To these ends, the SmartSMILE (Socialize MIddLeware Elderly) framework was created. SmartSMILE is a monitoring and interoperability SIoT ready software infrastructure for the socialization between devices. It is based on SOA Web Services and XML technologies to create intelligent domestic environments whose components collaborate to provide for the integration and interoperability of devices and household utilities belonging to different, incompatible native technologies. In fact, SmartSMILE creates an abstraction layer that overcomes the limitations of device compatibility, thereby enabling both the monitoring and composition services to work irrespective of the technologies of individual devices. Figure 2 shows a monitoring use case. When a device changes its state, the new value is collected in a repository. When needed, all stored values are retrieved to be displayed to caregivers, doctors and family members. A device state change can in general occur for three main reasons: • Direct interaction: the user physically acts on the device to change its status (e.g. pressing a button); • Indirect interaction: the user acts on the device without touching it (e.g. through a smartphone); • Involuntary interaction: the user does not interact with the device, but its state changes as the result of some event (e.g. a PIR sensor detects a presence in the environment). Figure 3 shows a use case related to activation of the interoperability function. When a device changes its state, SmartSMILE verifies the condition to activate interoperability between devices. To do this, SmartSMILE ( Figure 3) activates a friendship manager that searches for a friend relation that involves the device. If one is found, the other device is identified and the corresponding function is automatically activated. A device function is a command that any given smart device can execute. For example, the functions for a lamp can be switch on, switch off and getStatus. The friendship manager is a special component of SmartSMILE that defines which devices can interact with each other, and how, to create a composition of functions. As friends, two or more devices are trusted and are thus enabled to access each other's private data and functions, thereby providing interoperability.

Architectural description
The SmartSMILE architecture ( Figure 4) is made up of a set of sub-modules, called gateways. Each gateway interfaces with specific domotic systems expressly installed inside the home. The gateway serves the function of managing its own set of devices, integrating and interfacing them with the platform. To uniformize devices belonging to different gateways, SmartSMILE uses a highlevel ad hoc language, called SmartSmileML, to describe devices in a technology-independent fashion. Such description includes their main characteristics, and the functions that they can execute, along with their input and output parameters and defined data types. Moreover SmartSmileML describes the possible events (e.g. device state change) specific to the supported domotic technologies for processing. To describe devices, functions and events, SmartSmileML uses an XML based language. Its functioning does not require prior definition of taxonomies or classifications for devices and events. By avoiding the use of predefined devices, the system is able to manage any kind of device, exploiting all the available functions that are automatically identified during its creation. In order for the system to work, each gateway has to implement some basic features; these are: • Creation of the high-level description of devices belonging to its network: This operation enables having a unique view of, and access to all the devices belonging to SmartSMILE. In this way, SmartSMILE can use a unified way to interact with them. For this to work, the gateway must be able to map the device descriptions with the corresponding real devices.
• Capture of events that occur in the automated home network and translation into the SmartSmileML language. This allows for monitoring events in the domotic bus and enables SmartSMILE to react accordingly. The obtained information are translated into the SmartSmileML and are sent to the cloud server for collection and querying as needed.
• Translation of a SmartSmileML function description into the corresponding domotic command. This enables SmartSMILE to invoke commands in devices. To do this the system must know the corresponding gateway managing each device.

SmartSmileML language
SmartSmileML consists of two main formalisms: SmartSMILE Device and SmartSMILE Message.

SmartSMILE Device
SmartSMILE Device: defines devices and their functions. In particular, it describes the characteristics of each device and the processes by which it interacts with other SmartSMILE Devices. The XML description includes the following tags: • device: the root element that is the parent of all other elements. The main attributes contained in this tag are: (a) description: a free text field; (b) id: the identifier of the device within the SmartSMILE framework; such identifier must be clearly unique; (c) serialNumber: a device identifier in the domotic technology; (d) tech: the domotic technology employed by the device; this allows for immediate assignment of the device to the proper gateway; (e) type: the kind of device; this can be a free text field or contain pre-defined values; • service: child of the device tag. There is a service tag for each device function,. The main attributes are: (a) name: the name used in the relevant domotic technology to call that function; (b) output: the SmartSMILE data type; this attribute is defined, only if the function returns a value; • input: child of the service tag. There is an input tag for each input parameter that the function requires,. The main attributes are: (a) name: a label for the input; (b) type: the SmartSMILE data type; • allowed: child of the input tag. There is a tag for each possible value that that input value can take. If no allowed tags are defined, it means that any value is allowed for the declared SmartSMILE data type (e.g. if the type is int, and no allowed tags are defined, the input can be any integer value. The main attribute is value: the allowed value; • linkedService: child of service tag. If defined, it describes friendship relations with other devices. The main attributes are: (a) id: the id used in SmartSMILE to identify the friend device; (b) service: the name of the function of the friend device to invoke to create compositions; • linkedInput: child of linkedService. There is a linkedInput tag for each input of the friendly device function to invoke,. The main attributes are: (a) from: the name of the input to the described function whose value is needed in order to be shared with the friend device function named in the linkedService tag; (b) to: the name of the input of the friendly device function whose value has to be assigned using the shared one; (c) value: if from attribute is not defined, this defines a fixed value for the to input name.

SmartSMILE Message
SmartSMILE Message formally describes events, commands and responses. The XML description establishes the following tags:

SmartSMILE SIoT features
Using SmartSmileML, it is possible to achieve interoperability among services and devices by taking advantage of a single means of communication and data sharing. Thus, it is possible to achieve a social network of intelligent objects, whereby devices are tied to each other by social relationships in order to collaborate and provide a common SIoT application. When a message passes through a domotic bus, it is captured by its gateway. The gateway identifies the correspondence between the device that sent the message and the associated description in SmartSMILE Device. Using the information in the device description, the captured event is translated into the SmartSmileML language, inserted into SmartSMILE Message and forwarded to the Friendship manager to check for the existence of relations, and finds the device and its function that can achieve the necessary interoperability. To verify and activate the friendship, the Friendship manager checks the linkedService and linkedInput tags to verify the relation between the involved devices, and if it exists, it shares input and output values between them.
By way of example, let us assume we have two devices belonging to different domotic systems whose functions have to be combined as shown in Figure 5. The first device is a "wall switch" employing the KNX [33] technology. It has a function named SET_STATUS (the content of the tag service name), whose input name status is an OnOff data type. The values of OnOff can be on or off. The second device is a "lamp", which instead uses UPnP [34] technology. It has two functions: getState and setPower. Both use a value of type OnOff as output and input respectively. The device description of the function SET_STATUS of the wall switch has a special tag, named linkedService. This tag permits the Friendship manager to establish a friend relation between the two devices and to create a composition of functions. When the Friendship manager receives the event that the wall switch is set to on (Figure 6), it 'knows' that it has to invoke the function setPower of the device with id = 3 (the lamp). The content of the linkedInput tag specifies that the wall switch shares the status value with the lamp. In the end the Friendship Manager invokes the lamp's setPower function, which will have the value on within the input named power (Figure 7).
The device descriptions are for the most part created automatically by the gateway. The complexity involved in this depends on the standard to be managed. For example, in UPnP the creation is completely automated because the devices present and describe themselves each time they enter the network. For KNX, the descriptions are made by parsing a configuration file created by the configuration software named ETS [35]. In some cases, automating the process is not possible and it is necessary to write them manually.

Implementation
SmartSMILE exploits W3C-recommended standard Web technologies. It exposes services using Web Services, SOA and XML technologies. The advantage of using W3C standard solutions is that they ensure that the developed applications are fully compatible with other standards-based software and are not tied to any particular software system, programming language or computer architecture. Figure 4 illustrates the deployment of the SmartSMILE component used in the SOCIALIZE Project. SmartSMILE is connected on one side to the Cloud server, where the values coming from devices are stored and recovered for any further analysis, and on the other side, to the wired or wireless domotic buses. Through the intervention of SmartSmileML, communications between the Cloud server and SmartSMILE are performed using high-level messages as shown in Figure 6. In this way, the cloud does not need to 'know' how the different domotic technologies work in order to understand messages -it just needs to be able to "speak" SmartSmileML. In addition to collecting values, the Cloud provides a web server environment and a web application to show each user's data to the caregivers. To match the received values from SmartSMILE with the respective user, the Cloud is previously configured associating devices to consumers.   Table 1 shows the implemented classes for each developed SmartSMILE gateway. A brief description of each class is provided in the following subsections.

KNX gateway
To integrate KNX into SmartSMILE, the gateway exploits the API provided by the Calimero 2 [38] libraries to connect to, capture and write KNX messages to and from the domotic bus. At startup time the gateway connects to the bus and initializes the required structures for translation of the data types and values used in SmartSmileML to KNX Datapoint identifiers and vice-versa. Then, the gateway loads the ETS (KNX Engineering Tool <device description="wall switch" id="1" serialNumber="123" tech="KNX" type="switch"> <service name="SET_STATUS"> <input name="status" type="OnOff"> <allowed value="on" /> <allowed value="off" /> </input> <linkedService id="3" service="setPower"> <linkedInput from="status" to="power" /> </linkedService> </service> </device> <device description="energetic saving lamp" id="3" serialNumber="456" tech="UPNP" type="lamp"> <service output="OnOff" name="getState" /> <service name="setPower"> <input name="power" type="OnOff"> <allowed value="on" /> <allowed value="off" /> </input> </service> </device> <message message=" SET_STATUS " messageType="UPDATE" senderId="1"> <input name="status" type="OnOff" value="on" /> </message> <message message="setPower" messageType="COMMAND" receiverId="3"> <input name="power" type="OnOff" value="on"/> </message> Software) configuration file that contains information about different KNX devices connected to the KNX bus, such as their description, their application programs, and their functionalities. It then implements a listener on the KNX bus to manage events. Captured message are translated into SmartSMILE Message and can be of two types: a reply to a read request for a device state, or detection of an event that implies a device change of state that can trigger a composition of functions. To invoke functions, SmartSMILE Message are translated into KNX packages and written to the bus. To implement the gateway, 9 Java classes have been developed ( Figure 10): • KNX: this is the main class that acts as a communications bridge between KNX and SmartSMILE. It checks all the parameters of configuration files and establishes connections with the KNX bus via the KNX/IP gateway device. This makes it possible to read and write to the KNX bus. Moreover, it creates abstract instances of the KNX devices in SmartSMILE and maps them to the actual ones, so they can be used by the platform. The class also implements the reading and writing operations on the bus, and their conversion from KNX to SmartSmileML format and vice versa, including the values of the different data types.
• KNXListener: this class implements the functions and interactions with the KNX bus. It creates and manages the data flow to and from the KNX bus by providing: (a) synchronous reading of data (when the value of a datapoint is explicitly requested through a group address); (b) asynchronous reading (the system furnishes the value of a datapoint through the group address without any explicit request, such as a thermostat that periodically reports the temperature, or notification of a user activating a device); (c) writing for activation of functions. Using the configuration data of KNX devices in SmartSMILE, it is possible to associate the correct coding/decoding type of data (DTP) to each group address.
• KNXServiceMapping: defines the mapping between the KNX group address and the associated KNX data type.
• SSServiceData: once both the individual address of the device and the corresponding KNX group address are known, this Java Class obtains the appropriate SmartSMILE function.
• KNXServiceData: takes as input the SmartSMILE function and finds both the individual address and the KNX group address.
• SSParamterMapping: represents the data structure that allows mapping a SmartSMILE Message to the available input and output parameters.
• KNXDriverException: defines the exceptions generated during interactions with KNX.
• SSTypeValueXlator: implements the functionalities to convert a KNX value into a SmartSMILE value and vice versa, according to the respective data types. By way of example: a) the KNX value "on" can be converted to a SmartSMILE "true" Boolean value; b) the SmartSMILE percentage scale has a range of 0 to 100, while in KNX it ranges from 0 to 255; it is thus necessary to convert the values between the two scales.
• SSTypeValue: contains information about SmartSMILE data types and their value ranges. When a function is invoked using the SmartSMILE Message formalism, the KNX class searches for the corresponding KNX service retrieved via the KNXServiceMapping class (using the getKNXService method). The value initially expressed in SmartSMILE format, is taken from the KNXServiceData class using the GetValue method. It is converted to the KNX value using the SSTypeValueXlator class with the get getKNXParameterValue method. The data are then written to the KNX bus using the KNXListener class. In the end, a reply indicating the execution of the command is sent back, once again using the KNXServiceMapping class (method getSSService) in order to generate confirmation of execution. (Figure 11).

UPnP gateway
To integrate UPnP technology, the gateway exploits the API provided by the Cyberlink and Cidero libraries [39]. At startup time, the gateway initializes the ManagerPoint, which is a UPnP listener that enables adding, removing and executing functions on devices. The gateway initializes the data structures for the translation from SmartSmileML to the corresponding UPnP values and types, and vice-versa. When a new device enters the UPnP network, it announces itself and provides a description of itself together with a list of functions that it can offer. This information is represented using XML structures that the ManagerPoint parses to create the SmartSMILE Devices. • UPnPManagerPoint: this class implements the functions of and interactions with UPnP. It creates and manages the data flow to and from the UpnP system by providing the synchronous and asynchronous functions for reading and writing to the bus.
• UPnP2SmartSmile: implements all the data structures and methods to convert descriptions, commands and values of UPnP into SmartSmileML, and vice-versa.

MyHome gateway
To integrate MyHome, the btcommlib [40] library was used, though modified to add the authentication functionalities offered by the AndroidBetaOwnAuthentication library. This library makes it possible to manage communications through an OpenWebNet (OWN) server by formatting messages according to the OWN syntax. It moreover serves to open sessions, creating special threads, and send and receive reply messages as well as syntactic and communication errors. At startup, the gateway opens communications with the OpenWebNet server that interfaces with the MyHome technology. The server works using two sessions: monitor and command. During the monitoring session the gateway starts a thread that remains in execution to asynchronously intercept the events that it reads from the bus. Messages are parsed by an LL(1) [41] grammar. During the command session, instead, the gateway establishes a connection with the server when it has to invoke a function. Unfortunately, auto discovery and auto configuration of SmartSMILE Devices is not available because the technology does not offer any device discover process. Hence, it is necessary to create the SmartSMILE Devices manually. • BTicino: this is the main class that manages devices and creates all the structures needed to interact with MyHome systems. It creates the two threads needed to interface with the monitoring and command sessions.
• BTicinoDeviceData: contains data and information related to a BTicino device for interactions.
• BTicinoMsgsVerifier: checks messages from the monitoring session.
• BTicinoServiceData: contains data and information related to BTicino messages.
• BTicinoDimensionValuesMapper: translates quantities from SmartSmileML to OWN and vice-versa.
• SSServiceData: contains data and information useful for executing a SmartSmile Message.

SmartSmileML gateway
In the Socialize project, ZigBee and Bluetooth technologies are only used to read physical quantities or detect state changes in a controlled system. • Smart node (HSN-SN): this is a device made up of a sensor, an XBee S2 radio module configured as a ZigBee router and a node. The core of the node is an Arduino FIO board with one or more sensors connected to its I/O ports (input/output lines, either digital or analog). Each sensor node receives broadcast messages from the coordinator (bridge) and sends events only to the coordinator in a so-called star network topology. Events generated from sensor nodes are changes in the state of a sensor, power up or reset, low battery and heartbeat (a timed event indicating the node is alive).
• Gateway/Bridge (HSN-GW): a device made up of by an Adruino Yun board and a Wireless SD shield hosting an XBee S2 radio module configured as a ZigBee coordinator for the wireless sensor network. Events from the smart nodes need to be forwarded to the Web service. This task is delegated to the Linux processor hosted on the Arduino Yun board and connected to the LAN/WAN via a Wi-Fi adapter. Event messages are then converted to HTTP requests (RESTful API) and sent to the service back-end.
A simple character-oriented communications protocol has been implemented on the smart node for bi-directional communication, network management and control of the input/output lines between smart nodes and the gateway/bridge. Events notification messages are forwarded directly, while the incoming commands require some tweaks on the server side. Although the communication protocol is able to manage bidirectional messages (from sensor node to gateway and vice versa), only one way is used ( Figure 15).  Both the ZigBee Gateway and the Android app for Bluetooth are specifically designed to communicate through the SmartSmileML language. This provides SmartSMILE with a native SmartSmileML gateway, which has the task of setting up a connection as a TCP or UDP socket or a REST service to which devices can send messages. Incoming messages are directly forwarded to the SmartSMILE core for analysis by the Friendship manager and then forwarded on to the cloud server. Since this gateway does not require any special implementations to convert data, values and functions, it was sufficient to include all the features described in a single class called SmartSmileMLGateway.
In order to make devices able to 'speak' SmartSMILEML, device developers can refer to a document describing how SmartSmileML works and how to use it.
When a device becomes active, it sends a message in which it describes itself using a SmartSMILE Device description, as shown in Figure 5. In this case, the attribute tech is SmartSMILE. The id has been left blank because SmartSMILE will automatically fill it in. The assigned id will be used by the device for its communications. When the device is deactivated, it sends a special SmartSMILE Message of the type REMOVE containing its id ( Figure 17). Leveraging the IoT capabilities of SmartSMILE, we ran a pretest of the proposed system using remote devices during the development stage. A SmartSMILE server was deployed in … with various devices employing KNX, UPnP and MyHome technologies, including a thermostat, motion detectors, gas and smoke detectors, electrical load control of instantaneous consumption, power actuators, a cooking gas electromagnetic valve and smart TV. All the appliances and devices are part of a demonstration installation that simulates an actual home. ZigBee environmental sensors, including temperature and humidity, were fitted at the SUPSI University in Switzerland in Manno. A Bluetooth Smartwatch able to capture users' heart rates, number of steps and sleep duration was set up at Spring Techno in Bremen Germany ( Figure 18).

Field trials
The test and validation processes of the SOCIALIZE platform were performed by the end-user partners in the project.
In Switzerland it has been tested in a retirement home, while the Italian test involved two regions (Tuscany and Sicily), making sure in each case to involve different types of target users in the test: • Care-dependent elderly people in residential facilities; • Partially autonomous elderly people assisted at their own residence/homes; • Autonomous elders who are not beneficiaries of social care or healthcare assistance and participate in associational activities.
Regarding the elderly monitoring service, the test was conducted inside a residential facility in Tuscany. The aim was to collect data from sensors and ensure that they were understandable, and that they were able to constantly follow and track the evolution of those parameters deemed significant for the health and safety of the older persons involved.
A technologically enriched environment was recreated in this residence by assembling and recreating within the pilot site the sameIoT device configuration already used in the earlier design stage.
The testing period was two weeks. SmartSMILE was installed on a computer located inside the residence and connected to the Internet through an ADSL connection.
The devices installed were (Table 2): a wireless ambient temperature and humidity sensor in the cafeteria (ZigBee technology), a temperature and humidity sensor as well as a SmartTV and Media Server (UPnP technology) in the dining room, two PIR wired presence sensors, one in a bedroom and one in the kitchen, which was also equipped with gas electrovalve actuator, push button, gas, water, smoke sensors (KNX technology) and electrical load control (MyHome tecnology), and finally two SmartWatches worn respectively by two guests (Bluetooth technology). Almost all IoT devices used are powered by a mains power source, only the ZigBee temperature and humidity monitoring devices could have a battery life problem. The data collected by these heterogeneous home automation devices was converted, standardized and normalized by SmartSMILE. The data were then sent to a database managed in Cloud Computing mode residing at the Digimat company, in Matera, Italy.
The results of the experimentation made it possible to verify the correct functioning of the entire system. In particular, through the use of dedicated Web interfaces it was verified that data were stored correctly. These interfaces have enabled simple, intuitive aggregation of the data over fixed periods of time and their display in clear, easily understandable graphics.
In fact, the information is displayed as simply as possible, with icons corresponding to the requested service (for example Physical Activity or Heart Rate monitoring). The end user needs only click the corresponding icon to show a graphical representation of the acquired data with the possibility to adjust the timeframe.
The proper functioning of the collaboration and interoperability between the devices has also been verified, as these features are necessary for the implementation of a SIoT based on the SmartSMILE infrastructure.
The tested monitoring activities included: • Temperature control inside the home environment. This has led to the discovery that people who tend to keep the room temperature either too hot or too cold are subject to falling ill more frequently; • Supervision of elderly people who do not get enough physical activity with respect to doctors' recommendations; • The feeling of safety older people experiences with regard to the hazards of fire, flooding and gas leaks that may occur within the environment.
The strength of the SIoT-ready infrastructure is highlighted by the following composite functions: • Following the voluntary provocation of conditions of flooding, gas leaks and smoke in the kitchen using dedicated KNX devices (Figure 19), when a hazardous event was recognized, the corresponding alarm signals from the UPnP media server were promptly displayed on the television, together with the simultaneous activation of an acoustic alarm.
• When one or more appliances requiring high power consumption were turned on at the same time (specifically the microwave oven, the traditional oven, the boiler and the washing machine), the electrical load monitoring system of detected an overload. Power actuators were deactivated according to a preset priority until the situation returned to normal. When the load reduced because one of the still functioning household appliances finished, the load control detected this change and reactivated the appliances that were previously stopped. The functionalities were implemented using MyHome electrical load control of instantaneous • Switching on the cooking gas requires pressing a button. After a pre-set period of time, an acoustic and luminous alert was activated, and an appropriate message displayed on the TV to remind the user that to continue cooking the button had to be pressed again. This prevented the user forgetting food on the cooker. The combined timer and smart TV functionalities were composed using the KNX electromagnetic cooking gas valve ( Figure 21). The most significant anomalies identified were long periods of no information coming from both SmartWatches. For the first incident, the reason was that the person took off the watch for 5 nights consecutively, while the second was due to the fact that twice (3 hours and 5.5 hours, respectively) the other person did not notice that the device was no longer working because the battery needed recharging.

Conclusions
The paper presented SmartSmile, a framework that solves the main issues so that SIoT paradigms can find actual application. This software infrastructure was developed as an activity of the Socialize project, to address the problem of monitoring older people within the living environment.
Thanks to the potential of SmartSmileML language, the framework implements an abstraction layer that hides the underlying, often proprietary technologies, of the integrated devices, leveling them out. In addition, SmartSmileML defines a strategy to define the "friendship" relation between devices permitting the sharing of information amongst them even if they are not natively interoperable. On the one hand, SmartSmile permits to users to choose the most suitable sensors/actuators for the specific case without concern for their compatibility with the devices or systems already installed and, on the other hand, it provides developers with a unique representation of the acquired data without the need to know the technical details of each single technology.
Summarizing, the most significant features that have allowed the creation of a SIoT environment supporting the services of device discovery, combination of device functions and reliability, are: • Interoperability: the ability of the devices to interoperate with each other even if they belong to natively incompatible home automation systems, thereby permitting full interconnection and interaction amongst them.
• Service-to-service communications: the service provided via a device can share its input and output with the services of other "friends" to achieve a common objective.
• Scalability: in order to attain a certain goal, devices can collaborate with each other; moreover, when changes occur (new devices become available or some are missing), tasks can be re-distributed.
As a future work, SmartSMILE will allow to expose its own devices externally. Exploiting the results of the work described in [43], every device within the system will be reachable using an IPv6 address, and socialization will be achieved between devices belonging to different SmartSMILE instances. In addition, the stored data could be made available to special machine learning algorithms that could launch alarms automatically, learning the user's habits.
SmartSMILE is released under the GPL licence [44]. Its code is shared on GitHub [45].