Home Automation – Finding the right tooling

Finding the right base-tools

Since this is my very first home-automation project, I needed to have some tooling to verify if codes were sent by the transmitter. Using google, I found both the wiringPi and 433Utils libraries through homautomation.org. Using RFSniffer tool from 433utils its possible to put the receiver in a listening mode. By using the codesend tool from 433Utils I could now send a code to it from the transmitter.

sending and receiving codes
sending (right) and receiving (left) codes using codesend and RFSniffer

This is the best and most easy way to verify that both devices are working. One strange thing I noticed is that the codesend tool apparently sends the code twice, nevertheless, it works! Next step is to connect the RF-Controllable power-socket to the specific code send from the RaspberryPi.

This can be realized by simply clicking the registration button on the power-socket and then sending the right code to the socket. Using the wiringPi ‘send’ binary, this is done using the right combination as follows:

send M 14 1 on

once this code is sent, the power-socket will switch on and off a couple of times to confirm that the code is registered. Next step, building the web-interface!

Building a Web Interface

Since web-design has not been my core-competency, primary focus is on functionality. Therefore using a combination of simple PHP and HTML, having a page with just two buttons was my main requirement for now. Later on, we can make it fancy but lets first focus on functionality.

Combining the send binary created using the base-tools, it is possible to have two simple buttons, one for switching on, one for switching off. The code is displayed below.

   if (isset($_POST['b1on'])) {
       $cmd="send M 14 1 on";
   if (isset($_POST['b1off'])) {
       $cmd="send M 14 1 off";
       <meta charset="utf-8">
       <meta name="viewport" content="width=device-width, initial-scale=1">
       <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
       <div class="container-fluid">
               <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
                   <button class="btn btn-success" type="submit" name="b1on">Switch On!</button>
                   <button class="btn btn-danger" type="submit" name="b1off">Switch Off!</button>

Final result

The final result, a web-page with light-switches.


And a power-socket which is remote controllable from my phone through a web browser!

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.