Automate lights with a Raspberry Pi
In this project I will use a Raspberry Pi to control the lights in the house. The lamps are connected to wireless switches from Nexa, like this one: Link. The controller unit is a Raspberry Pi with a RF transmitter as seen here. The software is a modified version of an old Perl-script called tellstickd. It was originally intended for use with the Tellstick hardware but has been modified to work with pure RF hardware and the 433Utils lib (link). The reason to why this software is used is that it is the best simple software for automation I found. You can configure on and off times for different devices, it can adjust the times with random delays and it's aware of sunset and sunrise times. That way it can turn the lights on when it gets dark outside and turn them of at a set time at night. If you use the random function the off time varies from night to night which makes it a good burglar protection. The first step in the project is to fetch the codes that makes the Nexa devices turn on and off. For this an Arduino, a RF receiver and the RCSwitch library is used as described here. Some codes were collected: A10 (house A channel 1 off) = 20 A11 (house A channel 1 on) = 21 c30 1052692 c31 1052693 c21 1064981 c20 1064980 Next step is to install WiringPi and 433Utils on the Raspberry Pi and connect the RF transmitter. Instructions here. The codes received earlier and the code built above can then be used to control the Nexa devices: sudo ./codesend 1064981