Martin's corner on the web

Updating my SMS doorbell

I have made some updates to my SMS doorbell project. Previously, I had troubles setting up the email notifications in emoncms, the problem is that I don’t have shell access to the server where I host it so I could not install PEAR email. So I modified emoncms to use the in-built emailing rather than third party stuff and got it working.  The file to fix is /Models/mail_model.php and here is how I changed it:

<?php

// no direct access
defined('EMONCMS_EXEC') or die('Restricted access');

function send_mail($to, $subject, $body)
{
include "Includes/mail_settings.php";

$headers = 'From: $mail_from' . "\r\n" .
'Reply-To: nospam@zzzzz.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $body, $headers);

}
?>

I have the cron run every minute, so I get email within that minute.

Another change is in the code, I implemented the ACKs as per Nathan’s blog post, because I didn’t want lost packets. I also implemented some de-bouncing, as the doorbell’s LED is blinking along with the chime being played and I did get tens of notifications.

Finally with the email notifications working, I set up a rule in my gmail account to forward the messages to email2sms gateway that my mobile operator has. Now I am receiving a SMS whenever someone rings my doorbell.

The updated code is on Github.

 

3 thoughts on “Updating my SMS doorbell

  1. Pingback: Hooking my wireless doorbell to the Internet | Martin's corner on the web

  2. Nick

    In case you wanted to try again with emoncms, particularly the modular version, I just released an updated events module which may give more instantaneous alerts …