# Improvements of the xAAL Home Automation System
## 2 The xAAL Architecture
### Overview of the xAAL Architecture  
The xAAL system is made of functional entities communicating to each other via a messages bus over IP. Each entity may have multiple instances or zero, may be shared between several boxes, and may be physically located on any box. Figure 1 shows the general functional architecture of the xAAL system in a typical home automation facility. * Native Equipment. Some home automation devices (sensors, actuators) can communicate natively using the xAAL protocol. * Gateways. In general, devices for home automation only support their own proprietary communication protocol. Therefore, elementary _gateways_ have the responsibility to translate messages between the manufacturer protocols and the xAAL protocol. Within an installation, each manufacturer protocol may be served by a dedicated gateway. According to the technologies and the manufacturer protocols, each gateway will handle the following issues: pairing between the gateway and physical devices, addresses of devices, configuration, and the persistence of the configuration. Gateways can be queried about the list of devices they manage. * Database of Metadata. Each automation device within a facility is likely to be associated with a piece of user-defined information: for instance some location information (e.g., declare that the equipment typed as a lamp and having address X is located in the \"kitchen\" or in the \"bedroom of [PERSON]\"), possibly a friendly name to be displayed to the end user (e.g., device having address X is called \"lamp#1\"), or any useful piece of information for users regarding devices on its facility (e.g., pronunciation of the nickname of the device for a voice interface, or whatever). All this information is grouped in a _database of metadata_. This database contains somehow the configuration of home automation devices, from the end-user point of view. The database of metadata is present on the xAAL bus. Other xAAL devices can query it via this bus to obtain information associated with the identifier of a device, or conversely a list of devices associated with a given piece of information. There should be at least one database of metadata on the bus. There could be several. Such pieces of information are structured as key-value pairs. Keys and values are UTF8 strings. The xAAL specification does not define a normative list of predefined or well-known key entries. As a consequence, the meaning of a key makes sense only for the entity that writes it in the  
Figure 1: Functional architecture of xAAL. database and for the entities that read it. This is the responsibility of those entities to agree on common semantics to interpret information. * Cache. Unidirectional sensors are quite common: one cannot query them, they send their information sporadically (e.g., a thermometer which sends the temperature only if it changes.) So, there should be at least one cache on the xAAL bus that stores this information so that other entities can query it whenever necessary. Note that even if such caching feature is implemented by the gateway software itself, the cache is seen as a dedicated xAAL device. Such a cache should store at least the values of attributes carried by notifications sent by the devices. It can also stay informed by monitoring request/reply messages between devices about values of attributes. As with any caching mechanism, it is necessary to associate a timestamp to cached information. When another entity on the xAAL bus asks the cache for information, it also gets the age of the cached information, and decides itself if it is good enough or not. This is not the responsibility of the cache to manage the relevance of data according to their age. This is the responsibility of the client that makes the request. Moreover, the clock used by caches to set such timestamps may not be accurate or synchronized well. This is the responsibility of clients to deal with that. Again, inconsistencies may arise if two caches return information that has the same timestamp but divergent values.