Remote Controlling Devices Using Instant Messaging
Building an Intelligent Gateway In Erlang/OTP
| Author: Simon
Aurell Supervisors: Francesco Cesarini, Marcus Taylor Examiner: Annika Aasa |
![]() |
![]() |
|
| Bachelor's Thesis in Software Engineering June 2005 |
IT University of Gothenburg |
Erlang Training and Consulting Ltd. |
ABSTRACT
This paper shows how instant messaging technology can be used for remote controlling of devices, and outlines some of the issues involved, of which the most important is security. The concept of controlling and monitoring devices using instant messaging dialogue, presence and buddy list features is applied to a home automation context, and the idea and implementation of a prototype system is described. The paper describes how the excellent robustness and prototyping qualities of Erlang/OTP were exploited to quickly build a prototype system. It also shows how a gateway capable of speaking multiple device protocols can provide a single access point to different kinds of devices and services, and how the concept of agents can be used to add a layer of intelligence to the set of devices being controlled or monitored.
Keywords
Home Automation, Instant Messaging, Erlang, Agents, Networked Appliances,
Remote Controlling, Ubiquity, Presence
- Introduction
- Aim of the Paper
- Remote Controlling Issues
- Using Instant Messaging for Remote Controlling
- Using Erlang/OTP for the Prototype
- What Is Erlang/OTP?
- Why Use It for the Prototype?
- Prototype System
- System Concept
- Gateway Implementation
- Security
- Configuration and Setup
- Validating the Ideas
- Results of Interviews
- Discussion
- Future Work
- Related Work
- Conclusion
- Acknowledgements
- References
Home automation technology, although not yet as widely adopted in Europe
as in the US, is becoming more and more available, affordable and interesting
to the wider public. What once was not far from novelty products, like the
"Clapper" that switches the lights on by the clap of your hands,
is now becoming an important factor of utility, convenience and usability
in modern houses. These factors are added to the already substantial possibilities
of entertainment and security created by home automation. Accessibility aspects
of home automation also become more interesting, considering the current demographical
shift in the western world, which will create an increased demand for accessibility
in homes and possibly for related facilities such as remote health monitoring.
The next important step to leverage this technology is to expand and improve
the ways of accessing and using it. A vital part of this is to enable remote
access and location independence.
Instant messaging protocols are today used for human to human interaction.
However, the concept could be extended for use in remote controlling, where
it could be used to query, send commands to or receive alerts from a device.
This could also be applied to services, such as a banking service. In this
way, these tasks could be performed through a dialogue with a "buddy"
on an instant messaging client's buddy list. The concept could also be used
to mediate machine-to-machine communication.
1.1 Aim of the Paper
The aim of this paper is to show how an intelligent instant messaging
based solution can be used for remote controlling of devices, and what the
main issues of this concept are. The aim is also to show how it could be implemented.
Therefore, the design and implementation of a prototype, where the concept
is applied to home automation devices, is described. The idea behind this
system is to create an intelligent, protocol independent and location independent
gateway to a set of home automation devices.
The paper aims to answer the following questions:
1. What are today the main issues in the remote controlling of devices in
a home automation context?
2. What are the benefits of using Instant Messaging technology for the remote
controlling of devices and services?
3. How could an intelligent instant messaging based solution for remote controlling
be implemented?
It also describes how Erlang/OTP [6] was used for the purpose of fault tolerance
and robustness in the instant messaging server, and for quickly building a
functional prototype.
This paper is intended for technical as well as academic readers. However,
the description of the prototype system requires some technical knowledge.
It is assumed that the reader has a basic understanding of what instant messaging
is.
This section will look at the issues involved in device remote controlling
today. Roychowdhury and Moyer [3] identify four "primary reasons"
that network enabling of devices has not yet happened to any larger extent
with the current technology:
1. Interoperability
2. Scalability
3. Security
4. Limited Services
Interoperability refers to the capability of devices of different types and
from different manufacturers to communicate and cooperate. This is related
to usability, since it is essential that a user does not have to be concerned
with details of which protocols are used or similar technical details. Scalability
refers primarily to scalability in terms of geographical distance and location
independence. In the context of offering remote access as a service, scalability
in terms of capacity would also be an issue. Roychowdhury and Moyer suggest
that the issue of Limited Services is due to bandwidth limitations of the
past, which made "a lot more concentration [go] into optimisation rather
than feature provisions". Security is probably the most important issue,
since it has implications for safety: "human lives are of concern here.
By breaking into a home network, it becomes possible to control every appliance
that was connected to produce disastrous results".
Security
To secure the communication between the user and the system, we need to protect
the data transfer against "man in the middle" (interception and
modification or eavesdropping), "replay" (messages are intercepted
and later resent) and "denial of service" (attacker sends a flood
of messages too large to handle) attacks.
Secure Socket Layer encryption (SSL) can be used to encrypt the data transfer
and protect it against man in the middle attacks. Some instant messaging clients
provide SSL today. However, SSL implies an overhead which could potentially
be a performance issue.
The system would not be protected against replay attacks by SSL. The problem
could however be solved by modifying the protocol to use time stamped or otherwise
uniquely identifiable messages. This would require the client (and possibly
the server) to perform additional decoding/encoding and verifying operations
on messages.
Denial of service attacks would be a server issue. Since clients and agents
are only listening to the server, they can be protected from flooding if server
only forwards messages from trusted users.
See also a solution to security issues in a similar context outlined by Werthschulte,
Westermeir and Schneider [1].
Usability
There is also an issue of usability involved in this kind of remote controlling,
since it is not obvious how to represent:
1. Diverse types of communication
2. Communication with diverse types of devices
3. Feedback from and status of devices being controlled or monitored
Also, the fact that many mobile devices have small screens makes it more difficult to create good user interfaces.
3. USING INSTANT MESSAGING FOR REMOTE CONTROLLING
Roychowdhury and Moyer [3] identify four types of communication when remote
controlling devices:
1. Control (e.g. "turn on the coffee maker")
2. Query (e.g. "how much milk is left in the refrigerator?")
3. Event Notification (e.g. "tell me when my fire alarm goes off")
4. Multimedia Session (e.g. "view the babysitter cam")
These types of communication, as well as the representation of feedback and
status, fit very well with the concept of instant messaging dialogue and presence.
Multimedia sessions might be problematic when using some clients, although
this is not a limitation of the instant messaging concept in itself. Examples
of instant messaging clients who do support multimedia sessions include MSN
Messenger [9] and Skype [10].
Instant messaging has good scalability properties, in that it is independent
of location or geographical distance, and is easy to scale up and down on
server level to increase or decrease capacity.
Also, a substantial amount of reuse is possible if existing protocols, servers
and clients are used. Reuse can also be achieved from a usability point of
view, since many users are already familiar with the concepts and user interfaces
of instant messaging. Many computers and mobile devices also already have
instant messaging clients installed.
Instant messaging clients provide a good user interface for a generic representation
of different kinds of communication peers, and a compact representation suitable
for small screens on mobile devices.
4. USING ERLANG/OTP FOR THE PROTOTYPE
This section will explain the benefits of using Erlang/OTP when building
the prototype.
4.1 What Is Erlang/OTP?
The Erlang language and the OTP [6] were developed at Ericsson for use in
telephone switches with extremely high requirements on robustness and availability.
It uses a high level functional-declarative syntax and is designed for massive
concurrency. A fundamental concept is to model reality in processes, the obvious
example being a process representing a phone call.
Although developed for telecom applications, Erlang/OTP has proven to be
suitable for all types of distributed, fault tolerant, massively concurrent
soft real time systems.
4.2 Why Use It for the Prototype?
Instant messaging is server based, which means requirements on robustness,
availability, scalability and to some extent performance. This made Erlang/OTP
a good platform for the server part of the system.
Erlang also proved an excellent language for quickly writing the rest of
the prototype in. This is due to two things. Firstly, because of its high
level and declarative nature, which lends itself to quickly writing powerful
programs. Secondly, because of its focus on concurrency and message passing.
This is very fitting, considering the central issues in this part of the system
are state machines (i.e. device representations), server connections and the
passing of events and commands.
This section describes the concept and implementation of a prototype system
for remote controlling devices using instant messaging.
5.1 System Concept
The idea behind the system is to create an intelligent gateway to a set of
devices or services. Server based remote access to this gateway (using instant
messaging) can then be offered as a service to a large number of users. By
adding a "layer" of agents, we make it possible to incorporate decision
making and make non-smart devices appear smart. In the prototype, this concept
is applied to a home automation context.
5.1.1 Multi Protocol Gateway
The Device Connector in Figure 1 connects the automated home and its set of
devices to the outside world through the agents, acting as a gateway. The
gateway communicates with the devices using device drivers or some form of
translators. From the agents' point of view, the translation to different
device protocols is transparent. In the prototype, only support for X10 devices
is implemented, but the gateway could easily interface to any other kind of
device or service, provided it is possible to create some kind of device driver
for it.
Figure 1. System overview. The intelligent gateway connects the devices to the outside world through a number of agents, which handle the dialogue with the user in the client end.
5.1.2 Agents
The agents all have their own connection to the server. This way, messages
can be passed back and forth to the client. In general, the functionality
of the agents is to:
1. Send commands and queries to devices
2. Forwards device alerts which the client wishes to be notified of
3. Perform tasks in response to events.
4. Perform scheduled tasks
Although the agents implemented in the prototype are not provided with a
very impressive intelligence, they provide something to which one could easily
attach more advanced intelligence and decision making capabilities.
One of the uses of intelligent agents is as information filters. Consider
a scenario where the set of connected devices contains many sensors producing
a large number of events which are not always interesting. The setup does
not have to be a single home; it could be an office building, a school or
a factory. An agent will monitor all these events and only report or take
action on relevant or relevant combinations of, events.
It is worth noting that this architecture does not limit us to remote controlling
over long distances. For example, a PDA connected to the home network could
be used as a sort of universal remote control inside the home, e.g. sending
a message Turn on Channel 4 or Play Mahler's fifth to the "entertainment"
agent on the buddy list. The agent would then figure out that the first message
was meant for the TV set and the latter one should be sent to the CD player,
the MP3 player, the computer or whichever other device has Mahler's fifth
in store. Perhaps the user would first make the query Have I got Mahler's
fifth? and if the answer is no, the agent could buy it from an online music
store.
5.2 Gateway Implementation
The principal parts of the gateway are:


