Finally, I'm getting Text Messages from my Pi Gateway ;D 8),
I had to change the email server from
Gmail to
AOL in the
gateway.js, Gmail has extra security controls that I don't want to disable just for this, AOL works fine and I already have an account. The only change I needed to have it working with AOL (Other than the emai addresses) was the service:
var transporter = nodemailer.createTransport({
service: [b]'Aol'[/b],
auth: {
user: "Moteino" <[email protected]>,Originally, I just wanted to get a Text when the garage door was open, never the less, after testing for a couple of hours, I decided to create the switchSMS Alert because I wanted something simple and less
noisy :-\ for my SMS tests, instead of opening and closing my Garage every 2 minutes and the fact that my wife gave me an ultimatum >:( .
I configured 2 new events types in
metrics.js under the section SAMPLE EVENTS/ALERTS,
garageSMS and
switchSMS, the code is as follow:
garageSMS : { label:'Garage open : SMS', icon:'comment', descr:'Send SMS when Garage is opened', serverExecute:function(node) { if (node.metrics['Status'] && node.metrics['Status'].value == 'OPEN' && (Date.now() - new Date(node.metrics['Status'].updated).getTime() < 2000)) { sendSMS('GARAGE OPENED', 'GARAGE WAS OPENED, NODE:' + node._id + ' ' + node.label); }; } },
switchSMS : { label:'Switch On : SMS', icon:'comment', descr:'Send SMS when Switch is No', serverExecute:function(node) { if (node.metrics['B0'] && node.metrics['B0'].value == 'ON' && (Date.now() - new Date(node.metrics['B0'].updated).getTime() < 2000)) { sendSMS('SWITCH BO IS ON', 'SWITCH BO IS ON, NODE:' + node._id + ' ' + node.label); }; } },I've attached a couple of screen shots showing the two new Alerts
Best regards