=Paper=
{{Paper
|id=None
|storemode=property
|title=HORUS: an Agent System for Home Automation
|pdfUrl=https://ceur-ws.org/Vol-892/paper6.pdf
|volume=Vol-892
|dblpUrl=https://dblp.org/rec/conf/woa/GiordanaMMM12
}}
==HORUS: an Agent System for Home Automation ==
HORUS: an Agent System for Home Automation
Attilio Giordana Dino Mendola, Andrea Moio, and Davide Monfrecola
Computer Science Department Penta Dynamic Solutions
Universita‘ del Piemonte Orientale Via Teresa Michel 11, 15121 Alessandria, Italy
Via Teresea Michel 11, 15121 - Alessandria Email: dino.mendola@pec.it
Email: attilio@mfn.unipmn.it
Abstract—This paper presents a system for home automation, Another important feature of Horus is the user interface,
called HORUS, which is based on an agent architecture. The which is based on a protocol based on XML/HTTP and
benefits deriving from this type of solution are essentially provides an ubiquitous access from Internet and from any kind
three. Firstly, the agent paradigm provides a good abstraction
mechanism for implementing a modular system, easy to con- of fixed of portable device. Moreover, Horus is assisted by a
figure according to the requirements of a specific application. WEB based configuration module, which supports a technician
The second reason is the possibility of scaling up to complex in order to design and configure a custom installation.
applications exploiting parallel and distributed computing on low Finally, an indirect benefit deriving from the modularity
power micro-pc. The third reason is load balancing and fault inherent to the agent based architecture, is the possibility of
tolerance. When required, the agents migrate from one host to
another providing fault tolerance and load balancing capabilities. experimenting innovative methods, like adaptive algorithms
Some agents are provided with learning capabilities and can learn based on a machine learning approach, without compromising
the model on the environment where they operate. Finally, the the critical functionalities of the system. In fact, some of this
agents communicate in xml over https and are integrated in a features are now included in the official release (Horus-3.0),
web environment which offers an ubiquitous access from any kind which is a commercial product, and counts several installations
of portable device, while providing a secure access. HORUS is
now a commercial product, which provides either a sophisticated in domestic end business environments.
anti-intrusion system, and energy control.
II. H ORUS A RCHITECTURE
I. I NTRODUCTION HORUS is implemented as an overlay network of agents
This paper describes a distributed system designed for distributed on a TCP/IP network of hosts providing a UNIX
automation named HORUS1 . The characteristic of HORUS, compatible platform like Linux or MacOS. More specifically,
which distinguishes it from other commercial systems de- hosts may belong to two categories:
signed for the same task is the agent based architecture, which • General purpose mini/micro-pc, offering a full UNIX
is in the line of [1], [2]. This choice is due to several different environment;
reasons. The first one is modularity. Every agent implements • Custom devices like IP-videocameras and IO-boards,
a specific function, and is a self-consistent building block. which provides http based interface and are accessible
Depending on the user needs a site dependent network of as web sites.
agents is defined in order to implement the required functions.
The agents are allocated on the general purpose hosts and
Several instances of every agent type may be active at the
communicate over http using an xml based protocol. Custom
same time. The second reason is parallel and distributed
hosts, are then included in the agent community as special
computing. The hardware suitable for home automation is
agents. The agent communication protocol is extensible in
usually based on low power cpus, which may be installed in
order to include the characteristic idioms of the custom hosts.
a wall-box, but do not provide enough power for complex
An example of agent network including IO-boards and IP-
applications. Exploiting parallel and distributed computing is
videocameras is provided in Figure 1.
a solution that allows computing intensive applications be
implemented without scaling up to more expensive hardware. A. The Platform
A third reason is fault tolerance [3]. Several home applications,
for instance anti-intrusion, are critical with respect to fault IP-videocameras are becoming quite popular because of the
tolerance. A failure in the system may endanger things and possibility of being directly accessible from Internet. In our
human beings. Agents may be redundant and migrate from one case, this solution is appealing because avoids the need of
computational node to another in order to guarantee the most dedicating a host to serve a videocamera. IP-videocameras
critical functionalities. Finally, a last reason is load balancing. typically offer one, or more, streaming service, accessible at
Migrating an agent is the typical way of balancing the load specific url. Very frequently they implement some elementary
on a network of hosts. motion detection algorithm, which uploads a videoclip on a
server, any time severe changes in the recorded image are
1 Horus is a trademark of Penta Dynamic Solutions observed.
1) Managers: They are the agents responsible for taking
Alarm decisions reacting to events received from other agents. (IO-
Internet
Event
Remote
Command
handlers or MD-agents). They are provided with a knowledge
server
IO device comm base encoded in form of production rules. More precisely a
Internet comm
webagent
rule has the following general form:
logagent
phoneagent
φ → actions, alarms (1)
mngagent
Internal LAN
where the precondition φ is logic clause on some of the
variables characterizing the agent status, actions is a list
of actions to execute, and alarms is a list of alarm event
to communicate to other agents. Either alarm or action list
ioagent
netagent
mdagent
recagent
may be empty. Moreover, the action list may include internal
actions entailing the immediate change of the manager internal
status.
Managers are typically used for controlling subsystems like
the anti-intrusion and the air conditioning. Depending on the
rule base and the events it receive a manager may instantiate
Fig. 1. Example of agent network. one or the other functionality.
In addition to the rule base, managers are provided with an
activity program, which defines the activity phases. When a
IO-boards provide the interface toward sensors and actuators manager is active it behaves according to the rule base. When
via a set of digital or analogical channels. Many IO-boards it is not active, only registers the received events but does not
can be installed in a box of the electric plant, and provide send any alarm, nor execute any action.
an ethernet interface accessible via cable UTP or Wi-Fi. 2) IO-handlers: Sensors and actuators are interfaced
In general they implement the stack TCP/IP and can be through IO-boards. Nevertheless, IO-boards communicate us-
polled or commanded via messages encoded in HTML/XML. ing device specific languages, which does not complain with
Nevertheless the specific message format is strongly dependent HORUS standard. In order to integrate them with the HORUS
upon the board type. agent community, an IO-handler acts as a wrapper, which
B. Agent Types provides a standard interface toward the different IO-board
types. Any time a change in an input channel of the IO-board
Agents are subdivided into different types characterized by is detected, an event message is sent to the agents interested
the function they implement. Agents of the same type in most in the specific event. Any time, an action message is received
cases share the same code, end differentiate the behavior only from another agent, a proper sequence of commands is sent
in dependence of the configuration parameters. All agents use to the IO-board in order to activate an output channel.
a same communication language encoded in XML over http.
3) Video-camera handlers: Two basic functions can be
Three kinds of messages are defined: Events, Actions, and
implemented using this type of agent:
Alarms. The former ones simply communicate changes in
• Continuous recording according to a specified time
sensor or agent status. Actions are commands that force the
destination agent to change its status or to activate some ac- scheduling (REC-agent).
• Motion detection (MD-agent).
tuator. Alarms correspond to urgent and potentially dangerous
events, and are processed with priority with respect to the The alternative behavior is specified by the parameters into
others. the configuration files the agent reads at the start up time.
Agent interaction is event driven and has been designed Recording activity simply consists in creating an archive of
in order to guarantee strict real time requirements, as it may videos, which can be consulted when the user want to trace
be necessary in a security application. More specifically, the same event happened in the past. Motion detection, is a more
agent interaction is always atomic. When an agent sends a critical task, which consists in discovering critical events in the
message it receives an immediate response, without waiting for scenario observed by a camera. The first step is accomplished
the accomplishing of a remote procedure. In this way, delays by the camera itself, which upload a video-clip, in a directory
and deadlocks due to chains of requests waiting for a remote monitored by an MD-agent, any time some major change is
answer are impossible. observed in the scenario. The MD-agent analyzes the video-
Nevertheless, this choice restricts the possible information clip using a sophisticated vision algorithm and, if it decides
content in an answer to the knowledge currently available from that some critical event actually happened, sends an event
the agent status. No actions are possible in order to increase message to the manager in charge of security.
the local knowledge before answering. 4) Alarm communicators: An alarm communicator
In the following we will briefly review the different agent (PHONE-agent) is an agent provided with an output device
types. such as a GSM card, or an IP-phone, which is used to send
alarm messages to a user, or to a security service. Several the archive the videos acquired from the cameras. Finally, the
kinds of messages can be used ranging from sms to vocal Filter thread, visible in the MD-agent architecture, is the one
messages, depending on the user preference. A PHONE-agent executing the video analysis checking for events corresponding
is usually provided with a table that specifies, for every alarm to items moving in the scenario. Finally, the Log thread (to
type, which user must be alerted. not be confused with the LOG-agent) provides to the other
5) Self monitoring subsystem: A key activity of the agent threads a logging service, on a file, for debugging purposes.
system is continuous self-monitoring in order to immediately
detect critical failures or tampering attempts, which could
log-Thread&
prevent it from reacting to critical events. Two kind of agents
are in charge of this activity:
WEB-Thread&
• NET-agents
• TAMPER-agents Command archive- des1na1on-
(set status) core-Thread& Filter-Thread&
Thread& Thread&
A NET-agent is very simple. It periodically checks the
Timer
reachability of an assigned set hosts. If one of them is not
Scenario changes Motion detected
reachable for more than a few seconds it sends an event mes- Trigger&Thread&
sage to a manager. In this way, hardware failures (either natural
or caused by an intruder) of the network components are
immediately detected and communicated to an administrator.
Tampering is a kind of attack aimed at compromising the Fig. 2. Every agent is organized as a set of threads communicating through
sensorial apparatus of a surveillance system. Typical targets are message queues. As an example, the figure describes an MD-agent
the infrared detectors and the videocameras. Infrared detectors
are usually provided with an anti-tamper mechanism, which
is interfaced to HORUS using some input channel of an IO-
board. Videocameras are more fragile because many attacks log-Thread&
can be done without a physical contact. TAMPER-agents
periodically check the videocameras functionality by verifying WEB-Thread& Event
that the recorded image corresponds to the expectation. Some Alarm des1na1on-
Thread&
more details are provided in Section V. Command
(set status) core-Thread&
6) Loggers: Goal of the loggers is to provide a complete Timer
event
logging of events and alarms to be used for diagnosis. The Command ac1on-Thread&
(action)
type of agent in charge of this activity is the LOG-agent. It Trigger&Thread&
Rule&
receives alarm and event messages from the other agents and Knowledge&Base&
periodically upload them on a remote server. However, logging
is also accomplished by the WEB-agent, in order to provide
the user with a complete information source. The WEB-agent Fig. 3. The manager agents are provided with a rule knowledge base.
is nothing else than a classical web server, which is integrated
in the agent community in order to provide a flexible interface
D. Agent Addressing
to the user.
Agents communicate via a standard http/tcp protocol. A
C. Agent Architecture critical point is how an agent may find the IP address of
All agents have a similar architecture organized as an the others agents. In order to support migration and fault-
acyclic forward graph of threads communicating by means of recovery, the agent addressing mechanism must be dynam-
message queues. The reason for choosing this architecture is to ically reconfigurable. Nevertheless, the classical method of
avoid possible dead-locks or delays on critical sections. Exam- using a dynamic DNS-server is fragile, because the failure of
ples of agents are reported in Figure 2 and 3, corresponding to the server would compromise the entire system functionality.
an MD-agent and to a manager, respectively. More specifically Then a different solution has been implemented.
the WEB-Thread provides the http interface to the incoming Every agent is provided with a thread (not described in
message from other agents, and is able to immediately answer Figure 2 and 3), which runs in background and maintains a
without delays. The Trigger thread, accounts for the time flow local addressing map of the active agents in the local network.
and schedules internal actions at prefixed intervals. The Core Periodically, an agent announces, in broadcast over UDP, its
thread is agent specific and implements the real work carried name and its IP address to all agents listening on the internal
by the agent. Finally, the Destination and the Action threads network. When an agent receives the address of another agent,
are in charge of forwarding event, alarm, and action messages, it updates the corresponding entry (see Figure 4) and the Time
to a list of other agents. To Live (TTL) value is set to the maximum.
The Archive thread, which is presents only in some agents The TTL of all entries is decremented according to the cpu
like MD-agents and REC-agents, is in charge of storing in clock. If it expires before receiving a new announcement from
Address
communication
from the other Address
Address Handler Broadcast
agents
to the net
Agent name Address TTL
Manager1 192.168.1.15 90
Netagent1 192.168.1.15 37
……………. …………….. ……..
MD-agent1 192.168.1.25 19
MD-agent2 192.168.1.15 72
Fig. 5. Example of Horus Configurator interface
Address table
Fig. 4. Address manager thread
the corresponding agent, this one is considered inactive. In
order to prevent the possibility for false messages poisoning
the address tables, all messages communicating IP address
are authenticated using a standard signature protocol based
on RSA.
III. W EB INTERFACE AND U BIQUITOUS ACCESS
The interface to Horus is provided by the WEB-agent, which
is a traditional web server. In the standard configuration is Fig. 6. Horus interface for a 3G phone
located in the same local network where the agent system is
installed. Nevertheless, if required, it can be located in any
place in Internet (e.g., in a cloud). IV. DYNAMIC R ECONFIGURATION
Two kinds of interface are provides by the web server.
Agent allocation to hosts may be dynamically changed in
One is designed for assisting a technician accomplishing an
order to handle fault-tolerance and load balancing. In fact,
HORUS installation. The other offers an ubiquitous access to
it is very simple to migrate the activity of an agent from
HORUS from any kind of portable or fixed device provided
a host to another. When dynamic reconfiguration is required
with a web browser.
A. Horus Configurator
An example of HORUS configuration interface is provided
in Figure 5. The configuration module has been designed
in order to assist a technician during the steps necessary to
customize the agent system for a specific installation. No
specific knowledge in programming is assumed, but only a
technical background concerning the installed components:
sensors, actuators and videocameras.
B. Horus Access
The user interaction with the Agent system is provided by
a set of dynamic pages, which automatically adapt to the
browser and to the specific circumstances. The web pages are
constructed considering the size of the display of the device
the user is connecting from and possibly the urgency. In case
of emergency, the first item on the display is a synthetic
description of what happened. Example of the pages generated
for an i-phone end for a tablet are provided in Figure 6
and 7. In order to guarantee secure connections from every
Internet access point, the connection is over https and requires
a certificate pre-installed on the access device. Fig. 7. Examples of Horus interface for a netbook
the code of all agent types is always installed on the hosts, analyzes the video-clips, generated by the camera when the
which are potentially involved in the reconfiguration process. motion detection is triggered, in order to distinguish moving
Agents have a soft status, which can be reconstructed in a items corresponding to intrusions from false alarms. The filter
short time by interacting with the other agents. Then, migrating thread is provided with a short term model of the world (dif-
an agent does not requires to migrate the agent memory, but ferent from the long term one used by the anti tamper agent),
simply requires to start a new copy of the agent in a host which is continuously updated using an adaptive algorithm.
while the old copy stops. The mechanism, which handles the In this way the agent is able to detect major changes in the
addressing table, automatically notifies the new address to the scenario, which activate a deeper analysis of the image aimed
other agents. at detecting blobs corresponding to moving objects. Blobs are
In the current HORUS release, fault-tolerance and load then classified into alarms or non-alarms. The classifier is an
balancing are handled using a very simple mechanism. Critical SVM [7] trained from a set of positive and negative examples.
agents, like managers may be duplicated on different hosts. Finally, a new agent, not yet included in HORUS, is now
However, the two copies have assigned a different behavior. under development. Its aim is to provide a behavioral model of
One copy works as master, while the second copy works as devices like appliances, which will be exploited in the Power
backup in stand by. When a backup agent does not receive the management sub-system. This kind of agent is based on a
address notification from the master copy, so that the TTL in Dynamic Bayesian network [8]
the address table expires, automatically switches to a master
VI. C ONCLUSION
behavior. When the original master begins again to notify its
address, the backup agent switches back to its original role. In this paper, we described commercial system based on
This mechanism implements fault-tolerance. Load balancing an agent architecture, which is now operational in houses
can be obtained by commanding the two agent copies to switch and shops. Commercial systems are necessarily based on
their role. Currently, this mechanism is controlled manually consolidated methods, which make them less advanced than
through a page of the configuration module. Nevertheless, the one could expect, considering the state of the art emerging
next release should provide a policy for automatically handling from the literature. Nevertheless, HORUS, due to the critical
load balancing. tasks it needs to face, incorporates a number of advanced
features, which have been a key aspect for its success. More
V. A DAPTIVE C APABILITIES specifically, the agent based architecture has been fundamental
Some agents are provided with learning capabilities in order to implement modularity, scalability and fault-tolerance. More-
to adapt automatically to the environment where HORUS is over, features inherently originating from the agent system
installed. More specifically they are the agents dedicated to literature, such adaptability, have been included in the most
anti tampering of the video-surveillance sub-system and to the recent HORUS release.
motion detection. R EFERENCES
Preventing tampering of videocameras is critical and impor-
[1] C.-L. Wu, C.-F. Liao, and L.-C. Fu, “Service-oriented smart-home archi-
tant problem, which has been investigated by many authors, tecture based on osgi and mobile-agent technology,” IEEE Transactions
as reviewed in [4]. Nevertheless, no completely satisfactory on Systems, Man, and Cybernetics, Part C, vol. 37, no. 2, pp. 193–205,
solutions, capable of dealing any environmental condition have 2007.
[2] W. Shen, Q. Hao, S. Wang, Y. Li, and H. Ghenniwa,
been found in the literature [4], [5], in spite of the claims made. “An agent-based service-oriented integration architecture for
For this reason, a new algorithm has been implemented[6]. collaborative intelligent manufacturing,” Robot. Comput.-Integr. Manuf.,
Differently from others approaches to the same problem[4], vol. 23, no. 3, pp. 315–325, Jun. 2007. [Online]. Available:
http://dx.doi.org/10.1016/j.rcim.2006.02.009
[5], which focuses on the detection of abrupt changes occur- [3] S. Kumar, “The adaptive agent architecture: Achieving fault-tolerance us-
ring owing to a tamper, the anti-tamper algorithm we propose ing persistent broker teams,” in In Proceedings of the Fourth International
is based on a model of the correct behavior of the visual Conference on Multi-Agent Systems. IEEE Computer Society, 2000, pp.
159–166.
apparatus. The model accounts for a set of items, which [4] A. Saglam, “Adaptive camera tamper detection for video surveillance,”
must be detectable under different light conditions during the June 2009.
day and the night. When these item are not detectable for a [5] E. Ribnick, S. Atev, O. Masoud, N. Papanikolopoulos, and R. Voyles,
“Real-time detection of camera tampering,” in Proceedings of the IEEE
given period of time a security warning is sent to the house International Conference on Video and Signal Based Surveillance, ser.
administrator. The model is automatically learned by observing AVSS ’06. Washington, DC, USA: IEEE Computer Society, 2006, pp.
the environment, without intervention by side of the user. The 10–. [Online]. Available: http://dx.doi.org/10.1109/AVSS.2006.94
[6] A. Moio, “An anti-tampering algorithm bbased on an ai approach,” 2012,
initial training period last about three days. Then the learning technical report TR-02-12.
process continues as a long term background activity, in order [7] J. Shawe-Taylor and N. Cristianini, Support Vector Machines and other
to account for the environmental changes due to the different kernel-based learning methods. Cambridge University Press, 2000.
[8] V. Mihajlovic and M. Petkovic, “Dynamic bayesian networks: A
condition of light in the different seasons, while the agent is state of the art,” Enschede, 2001, dMW-project. [Online]. Available:
already operational. http://doc.utwente.nl/36632/
Another agent type, which is provided of adaptive capabil-
ities is the one devoted to motion detection. As described in
Figure 2 this kind of agent is provided with a filter, which