The xPL protocol allows different devices to exchange information in a simple manner. The devices broadcast their messages to the others and register to a hub in order to receive the messages sent by others.
The protocol is light enough to run on simple machines such as the BeagleBone or the Raspberry Pi. Some setup insructions show how to prepare a BeagleBone or a Raspberry Pi to use with xPL. A comparison of different single-board computers gives an idea of speed and power consumption issues.
The hub and the devices can be installed on different platforms. The system shown here run with Perl, which is part of the Linux and Mac OS operating systems and can easily be installed on Windows. It is based on John Bent's xPL ToolKit for Perl.
The first step to xPL automation is to install a hub.
This has to be done on each machine that participates to the xPL network.
Many devices are controlled over an RS-232 serial port.
For this, the xPL serial port device can be instantiated as many times as needed. The xPL infrastructure supports this by the fact that these devices are differentiated by their name.
In the same way as your PC, your home wants to alert you from time to time.
The xPL scripts found here allow to control:
- EIB / KNX devices such as lights, shutters, …
- myStrom devices such as buttons, lights, …
- Ethernet controlled switches
- a Logitech Media Server controller
- Philips Hue LED light bulbs control and a time display using 2 bulbs: one for the hour and one for the minute
- a Denon audio-video controller
- a Sony Bravia Android TV or a Panasonic plasma screen
A central xPL device monitors all the messages and is configured to trigger specific actions on specific messages. This allows:
- to update the information about the state of the home (lights, music, …)
- to launch scripts at given times or on specific events
RESTful web service
It works in conjunction with the home state xPL device.
An HTML web page can also be used to control the home.
Obviously, the home control pages have to be tailored to the user's wishes. These pages, in turn, can be generated by a CGI script, based on an XML description of the buttons and their associated commands.
Moving xPL services
Movng services require to stop them on a given device and starting them on another.
Stop a service on a given device:
su ll /lib/systemd/system/xpl-* systemctl list-units --type=service --state=running | grep xpl SERVICE='xpl-central' SERVICE_DEFINITION="/lib/systemd/system/$SERVICE" reset echo -e "\n$SERVICE_DEFINITION.service\n" echo ; cat $SERVICE_DEFINITION.service ; echo systemctl stop $SERVICE systemctl disable $SERVICE SERVICE_SCRIPT="/home/control/Documents/Controls/$SERVICE.pl" reset echo -e "\n$SERVICE_SCRIPT\n" echo ; cat $SERVICE_SCRIPT ; echo reboot
Start it on the other machine:
su SERVICE='xpl-central' SERVICE_DEFINITION="/lib/systemd/system/$SERVICE" ed $SERVICE_DEFINITION.service SERVICE_SCRIPT="/home/control/Documents/Controls/$SERVICE.pl" ed $SERVICE_SCRIPT chmod 775 $SERVICE_SCRIPT chown control:users $SERVICE_SCRIPT systemctl enable $SERVICE systemctl status $SERVICE