• Ei tuloksia

4.4 Application Development

4.4.3 Implementation

We use Home Assistant as the smart home platform to build up the system. Smart strategy is well supported by components and automation in Home Assistant. Here we explain the main concepts in Home Assistant that have been applied

Components

Components refer to external services and third-party tools that can be installed to sup-port the connection or integration of smart devices, web services and computing utilities.

Home Assistant supports 1400 components grouping into 24 categories.

Automation

Automation is the component that allow automating actions to be implemented. An au-tomation configuration consists of three different parts: a trigger, a condition and an ac-tion. For example, an automation to "turn the lights in the living room on when user arrive home after sunset" scenario is implemented as an automation inside Home Assistant, for example:

( t r i g g e r ) Wh e n O c c u p a n t a r r i v e s h o m e ( c o n d i t i o n ) and it is a f t e r s u n s e t :

( a c t i o n ) T u r n the l i g h t s in the l i v i n g r o o m ON

• Triggersdefine events that will trigger the automation configuration. An automation can have multiple triggers defined, in this case, the automation is executed when any of the trigger is fired.Table 7summarized different types of triggers.

• Conditionsare optional tests that can limit an automation rule to only work in some specific use cases.

• Third line is the action, which will be performed when the trigger rule is fired and all conditions are met. Action can be of any event types: a service call, a value update command, a notification, etc.

Table 7:Supported trigger types in Home Assistant platform.

Trigger Type Description

Event Triggers when an event is being processed.

Home Assistant Triggers during starts up or shuts down state of Home Assistant.

Time The time trigger is configured to run once at a specific point in time each day, with multiple ways to filter time range.

Numeric State Trigger when numeric value of an entity’s state crosses a given threshold.

State Triggers when the state of a given entity or component changes.

Sun Triggers when the sun is setting or rising, i.e. using the sun elevator value.

Template Work by evaluating a custom rule defined by Home Assistant template on every state change for all of the recognized entities, fire if the state change causes template to render ’true’

Geolocation Geolocation triggers can trigger when an entity is appearing in or disappear-ing from a zone.

The actual implementation is presented inFigure 11with four main modules. This struc-ture reflects how the proposed overall integration described above is implemented in a solid platform which considers multiple user context scenarios. To simplify the imple-mentation and focus in handling user context data, we utilize built-in components that Home Assistant has to provide for common sensors and actuators, for instance, switch, thermostat, and smart lights. The main goal is to observe the changes and reactions ac-cording to specific scenarios. No motion detection and activity recognition processes are applied except for contextual data gathered from sensors and actuators included in the mentioned infrastructure.

Source codes for automation are provided as Appendixes for reference. Corresponding to four of the defined scenarios, we implement rule sets (which is called automation in Home Assistant) in the system and observe the system performance and efficiency in terms of energy saving. A front-end application is also included with two authentication modes:

user and admin for the purpose of configuring the system and view as a user, built to be mobile friendly. We include a couple of views on two separated authentication mode to present an overview on the look and feel.

Besides user-context focused functions, we also include functionalities for general pur-pose. These features are essential to provide a user with an overview of a smart home system. Main features are categorized into three groups based on the functionality. The

Figure 11:Infrastructure of the user-context integrated system.

first group (presented as the first tab in the UI -Figure 13) consists of general information, e.g., weather forecast, lightning status, devices state, or room temperature. The second group includes information on devices inside the home, where the user can see and con-trol these devices remotely (Figure 14). Information related to the user profile is shown inFigure 15belongs to the third functionality group.

Figure 12:Admin user interface view on desktop with full control.

Figure 13:User interface for general information - admin.

Figure 14:User interface for home status - admin.

Different views for normal user mode are shown inFigure 16. Under user’s mode, the functions are limited (Figure 16a) to: overview, map, logbook, history and mailbox. Other settings and developing tools are hidden to user, thus, secure system’s integrity. Compar-ing to menu shown inFigure 12, we can see this difference. While admin have full control

Figure 15:User interface for profile information - admin.

and access to system configuration, normal user only has access to limited resources.

(a)Restricted menu - user mode. (b)Info view on mobile - user mode.

(c)Home view on mobile - user mode. (d)Profile view on mobile - user mode.

In this chapter, we present outcomes of the whole research process and evaluate these find-ings to verify that our problems identified insection 1.2have been explored and solved.

In the second section of this chapter, we evaluate the system efficiency in terms of energy usage to validate the system has been improved using user context effectively.

5.1 Outcomes

It is important to look into the outcomes of this study to evaluate its contribution values.

The direct outcome is an overall architecture to integrate user context into a smart home system, where the central manager receive actual context data and be able to react based on different preference. Implementation of such model bring to the world a proof of concept of how to fit technologies into theoretical research model. We discuss these two outcomes in the next two sections.