This is an old revision of the document!
Home Automation Hub (Overview)
Navigate to the top level page for more information about all the components of this system.
The Home Automation Hub (HAH) Project transforms the Livebox into one of the most capable and affordable Home Automation systems that you might imagine.
The following features were proven to make this project a winner:
- Browser based user interface
- Pre-programmed automation scheduling via Google Calendar
- Instant control via Twitter
- Data logging to pachube
- Power use monitoring/graphing from a Current Cost unit
- Easy to control remote RF mains sockets (Bye Bye Standby & HomeEasy)
- Seamlessly integrated with JeeNodes
- Open control protocol (xAP)
- Input sensing (upto 4 switch inputs) as well as output driving (upto 4 relays)
- Free, Open Sourced, HAH firmware
- User scripting language for customisation of operation
- Cheap to run. Only uses 6 Watts of power
- Solid operation - not prone to hangups
- Gets its IP address via DHCP or STATIC
- Remote firmware 'auto-updates'
- Configuration not lost on 'hard' reset
- Makes a great solar PV controller
HAH components can be bought from the shop or drop by the forums if you have any questions about the HAH project.
Note that your Livebox needs to be like the one pictured above. The newer Livebox 'mini' version won't do the job.
You might want to read about the experience of a HAH user. Karl has a writeup here.
Now with a xAPFlash interface!
Try the HAH firmware
The HAH firmware is a complete, free, replacement for the Livebox firmware. It is open-sourced, so if you want to, you can see exactly how it works.
To give it a try, start by downloading the file http://hah.dbzoo.com/upgrade/hah-firmware.dwb.
To install this .dwb firmware onto your Livebox, you'll need to follow some detailed instructions. There are four main stages in the process.
1. Downgrade the Livebox 2. Gain command line access 3. Replace the Redboot loader 4. Flash the HAH firmware onto the Livebox
This firmware replacement is fully functional; Pachube, Currentcost, xAP data feeding, Wake on LAN and SMS will be OK, however without the additional hardware some functionality will not work. This is also a great way to get yourself a new kernel with many more modules installed plus the full command set of BusyBox (v1.12.1)
Useful information about the HAH firmware:
- uses DHCP by default to obtain an IP address. You will have to examine your DHCP server to find out what IP was assigned; with the additional hardware the IP address is shown on the LCD at boot up OR install the xFx_Viewer and examine the Livebox LCD xAP event.
- Default root password is admin
- SSH enabled (dropbear 0.51), TELNETD available, initially disabled.
- Console login disabled as this is where the additional hardware attaches.
- Webserver listens on port 80.
- pure ftpd v1.0.21
- No ADSL or WiFi support. Once you reflash with the HAH firmware, the Livebox is no longer an ADSL/WiFi router.
- The two ethernet ports are bridged, the MAC address of the unit is that of the bridge, not the one on the label on the box.
![](/_media/livebox/hah-vlcd.png)
Then perhaps go for a Livebox gcc or python! see Native MIPS toolchain. All the source code for this project is available for download; building your own HAH firmware binary.
Architecture
The 20,000ft view of how the HAH controller fits into a network and the devices that it is able to control with the custom hardware.
Focusing on the software that controls the HAH additional Hardware
- Using the open protocol xAP gives us the flexibility that our project requires
- For the webserver component we use klone. It's a webserver where you build all the web pages using normal HTML but the embedded scripting language is C. Then it compiles all the pages into a BINARY executable which you ship. One binary and that IS your application. No CGI. No interfacing issues, and best of all no possibility that the scripting language can't do it!
A block diagram of how the daemons interact with one another on the livebox.
- xap-HUB - allows multiple xAP devices to be controled from a server. In this case the Livebox.
- xap-adapter - convert the AVR menu interface into an xAP protocol and interfaces with the RS232 port.
- xap-currentcost - USB/Serial interface to the CURRENTCOST electricity monitor
- xap-sms - USB/Serial interface via a DLR-3 cable to a Nokia 7110 mobile phone.
- xap-pachube - Feed xAP BSC data to the PACHUBE data aggregation service
- xap-googlecal - Trigger xAP event from Google calendar
- xap-twitter - Remote control with Twitter.
- xap-plugboard - Lua based scripting engine
- iserver - xAP/TCP gateway for running a wi-fi based touch screen for remote control.
All components use the file /etc/xap-livebox.ini as the universal registry for their settings. This is in “windows ini” file format using minini the INI file parser.
Background on xAP
The best way to start understanding xAP is to read the Basic Status and Control message schema.
A tool to help you view the endpoint control hierarchy - xAP Message Viewer
Here you can see all the endpoints on the Livebox Controller that can be directly addressed using the xAP protocol. There are many top level systems being hosted by the Livebox: Controller, CurrentCost, Pachube, SMS
For more information about programming the Livebox with xAP and Python see hah_xap_python
xAPBSC.cmd
Using the xAPBSC.cmd class we can define actions. Turn on RF relay 1.
xAP-header { v=12 hop=1 uid=FF123400 class=xAPBSC.cmd source=acme.my.controller target=dbzoo.livebox.controller:rf.1 } output.state.1 { id=* state=on }
Display the string “Hello World” on the LCD display
xAP-header { v=12 hop=1 uid=FF123400 class=xAPBSC.cmd source=acme.my.controller target=dbzoo.livebox.controller:lcd } output.state.1 { id=* text=Hello World }
xAPBSC.info / .event
Messages in xAPBSC.info and .event are sent to indicate the current state of an Input or Output.
This sample message is telling us that Channel 1 of the CurrentCost device is using 576 watts of power.
A .event will be triggered as soon as a data value changes.
xAP-header { v=12 hop=1 uid=FF00DC01 class=xAPBSC.event source=dbzoo.livebox.CurrentCost:ch1.0 } input.state { level=576 }
.info messages are sent every couple of minutes to show the current state of the system. If we waited until events were sent, programs such as the xAP Viewer would not be able to automatically figure out what is out there.
xAP-header { v=12 hop=1 uid=FF00DB0E class=xAPBSC.info source=dbzoo.livebox.Controller:rf.4 } output.state { state=off }
xAPBSC.query
To get an immediate .INFO response from an end point we can direct a .query message to an endpoint or set of endpoints. For each target that matches, an .info response will be generated.
xap-header { v=12 hop=1 uid=FF00DB00 class=xAPBSC.query source= ACME.Controller.Central target= dbzoo.livebox.controller:relay } request { }
WebServer
The webserver is written in C using
- embedded web server from KloneLogic
- minini the INI file parser
The web server listens on PORT 80 from here you can control most of the Home Automation controller features.
To access any other page but info you will need to authenticate. Login in as admin you can enter anything as the password and it will be accepted. Not until the admin user password has been setup will it be validated.
Settings
There are several settings in the /etc/xap-livebox.ini file that directly affect the webserver or the Livebox itself.
Network / Services
The network section defines what additional services will be enabled and the ports used, whether DHCP or STATIC IP configuration is setup, if the two Ethernet ports should be bridged together into a Switch configuration or addressed individually, the domain name of the Livebox and the NTP time server to stay in sync with.
[network] lan_proto=dhcp hostname=hahbox config_bridge=1 ether_0=00:07:3A:11:22:00 ether_1=00:07:3A:11:22:01 domain= ntp_host=uk.pool.ntp.org
The power LED indicator, although it appears on the SETUP page, has its own section. This reduces the amount of ON time that this LED has, useful if you keep the Livebox in a room where this brightness would be annoying.
[hardware] power=0
These network entries allow in-built services such as SSH, TELNET and FTP to be enabled/disabled.
[network] telnet_enable=0 telnet_port=23 ssh_enable=1 ssh_port=22
Access Security
Access to various pages in the HAH controller can be controlled in the [security] section. For example:
[security] user=demo passwd=secret demo=automation,graph,control
Will create a login user called “demo” with a password of “secret” that only has access to the automation, graph, and control pages.
Up to 10 additional user accounts can be created. Simply separate each with a comma.
[security] user=demo,foo passwd=secret,bar demo=automation,graph,control foo=automation,control
The page names are derived from the names of the pages as defined in the URL. For example the page setup.kl1 will be “setup”.
There are two other entries that appear in the security section that are update-able via the webserver
info_protect=0 admin_passwd=21232f297a57a5a743894a0e4a801fc3
Info protect controls whether the INFO page is displayed without needing to authenticate as a valid user. The admin_password is an MD5 hash of the special user “admin” who cannot be deleted from the system; it's a hardcoded username much like “root” in a Linux system.
If you forget the “admin” user password simply delete the admin_passwd entry and whatever you enter in the login prompt will be accepted as valid.
Wake on LAN
Wake on LAN is a great way to save power by keeping your PC on 'standby' until it is given a little 'wake up' message. This page allows you to specify the MAC address of a number of PCs. Pressing the 'Wake Up' button sends the command.
More details of regarding WOL can be found here.
~~DISCUSSION:off~~