PlugWeb: System architecture overview
The first goal of this project is create a component which is able to communicate with the plugwise devices in a linux environment. After this goal has been achieved it is time to use the component to create various scripts and interface. The features/wishlist of the project is listed below:
- Historic usage information stored in the plugwise devices needs to be saved in a database to create nice graphs.
- The user must be able to switch devices on/off using the web interface.u
System architecture overview
The PlugWeb system consist of several components. Below is an overview of the components and their relations.
Component: Driver This is the most essential component of the system. The driver component handles all the communication with the Plugwise usb stick.
Component: Daemon The daemon components is process running in the background for switching on/off devices on-demand and also for polling the devices periodically and saving the results in the database.
Component: Database A sqlite database is used for storing historical device information.
Component: Models The models form an abstraction layer between the software objects and the physical storage of these objects. The component provides a way to define models for retrieving and storing domain specific information in a structured manner.
Component: Service layer The service layer handles the database operations and the communication with the daemon. The website will make use of the service layer for retrieving information about the Plugwise network.
Component: Website The website consist of three pages which all need authorisation.
- Dashboard: The dashboard consist of a list of (all|favourite) devices showing the current power consumption which can easily be switched on/off.
- Statistics: The statistics page consist of a chart, a table containing the data in the chart and a set of options to customise the chart and table data.
- Management: The management page is used to edit device information and manage the area's and types.
Optional Component: Mobile Application Possibly in the future the project could be extended with an mobile (Android, iPhone) application to monitor and control your devices always and everywhere. Such mobile application should also use the service layer. The service layer minimises code duplication and enables easy future extensions.
Below is the proposed database structure for the plugweb project. The main entity is a device, containing a mac address, name and descriptions. Devices can be grouped into types (lamp, tv, etc) and area's (living room, bed room, etc). The daemon collects historical power usage information which is saved in the history table. The daemon also checks the states of devices regularly. State changes are saved in the log table. Users can create planning rules for switching devices on/off automatically. The planning is executed by the daemon, which stores information about executed actions in the action table. In this post I provided the system architecture and database structure of the PlugWeb system. Next time I will blog about the concept and implementation of the plugwise driver.
Blog posts in this series
This blog post is an item in a series of blog posts about the development of the PlugWeb system. The following blog posts of this series have been published in the past:
- An introduction to the PlugWeb project
- Software architecture of PlugWeb system (this post)
Next time I will blog about the following aspects of the PlugWeb system.
- Creating the driver
- Designing the sqlite database
- Implementing the daemon using PhpTaskDAemon
- Creating the service layer with zend framework
- Creating a PlugWeb Android application