SMS event not working

Started by bruster999, November 18, 2015, 01:32:07 PM

bruster999

Hi all,

I am trying to incorporate the washer/dryer node I found on instructables into the PiGateway:
http://www.instructables.com/id/Uber-Home-Automation-w-Arduino-Pi/

Great little node (using Moteino of course) and it works perfectly but I can't seem to get the SMS from the gateway to notify me. I used a copy of the MailboxSMS event and modified it for my node but it never sends the message. I have a mailbox node using the mailboxSMS event and that works perfectly and so does the dashboard so that tells me the email/SMS settings are working and the metrics are set up correctly.

Basically when the dryer is doing nothing it will send DRYR:0. When it's running it will send DRYR:1 and when it completes its cycle it will send DRYR:2. What I want is that when the gateway receives DRYR:2 it will trigger an SMS to tell me to pick up the laundry.

What am I missing here? Any help would be appreciated.

metrics.js
Metrics
=======
DRYR_OFF : { name:'DRYER', regexp:/DRYR\:0/i, value:'OFF'},
DRYR_RUNNING : { name:'DRYER', regexp:/DRYR\:1/i, value:'RUNNING'},
DRYR_COMPLETE : { name:'DRYER', regexp:/DRYR\:2/i, value:'COMPLETE'},

Event
=====
dryerSMS : { label:'Dryer Done : SMS', icon:'comment', descr:'Send SMS when dryer cycle complete', serverExecute:function(node) { if (node.metrics['DRYER'] && node.metrics['DRYER'].value == 2 && (Date.now() - new Date(node.metrics['DRYER'].updated).getTime() < 2000)) { sendSMS('DRYER COMPLETE', 'DRYER COMPLETE [' + node._id + ':' + node.label + '] @ ' + (new Date().toLocaleTimeString() + (new Date().getHours() > 12 ? 'PM':'AM'))); }; } },

Thanks in advance.
Bruster999

Felix

Note the difference between my version:

motion : { name:'M', regexp:/MOTION/i, value:'MOTION',

serverExecute:function(node) { if (node.metrics['M'] && node.metrics['M'].value == 'MOTION' && (Date.now() - new Date(node.metrics['M'].updated).getTime() < 2000)) { sendSMS('MOTION DETECTED', 'MOTION WAS DETECTED ON NODE: [' + node._id + ':' + node.label + '] @ ' + (new Date().toLocaleTimeString() + (new Date().getHours() > 12 ? 'PM':'AM'))); }; }

and your version:

serverExecute:function(node) { if (node.metrics['DRYER'] && node.metrics['DRYER'].value == 2 && (Date.now() - new Date(node.metrics['DRYER'].updated).getTime() < 2000)) { sendSMS('DRYER COMPLETE', 'DRYER COMPLETE [' + node._id + ':' + node.label + '] @ ' + (new Date().toLocaleTimeString() + (new Date().getHours() > 12 ? 'PM':'AM'))); }; }

I don't see any value of 2 anywhere. You only have OFF, RUNNING and COMPLETE.

bruster999

That was it! I was looking at the wrong field. Good eye Felix!
Thanks.
Bruster999