Main Menu

Programming moteino

Started by Kilo95, August 29, 2015, 04:42:52 PM

luisr320

How about using Twitter? I created a Twitter account for my home automation system, which I follow, and when required, my house sends me all kinds of notifications with a simple Tweet.

Kilo95

I have my Verizon email. I believe the default to alert on the sump pump is 20cm. My water level runs from 14-21cm. I just need to know where to alter it so I'm not alerted when I don't need to be

TomWS

Quote from: luisr320 on September 28, 2015, 09:24:13 AM
How about using Twitter? I created a Twitter account for my home automation system, which I follow, and when required, my house sends me all kinds of notifications with a simple Tweet.
Do you use the TwitterAPI?  If so, which version?

In my experience there ain't no such thing as a simple Tweet with that API!  Once you have all the code, it's sort of, kind of easy, but lots of code behind each tweet.

Tom

Kilo95


Felix

Quote from: Kilo95 on September 28, 2015, 09:52:52 AM
I have my Verizon email. I believe the default to alert on the sump pump is 20cm. My water level runs from 14-21cm. I just need to know where to alter it so I'm not alerted when I don't need to be

It's on this line in metrics.js:

sumpSMS : { label:'SumpPump : SMS (below 20cm)', icon:'comment', descr:'Send SMS if water < 20cm below surface', serverExecute:function(node) { if (node.metrics['CM'] && node.metrics['CM'].value < 20 && (Date.now() - new Date(node.metrics['CM'].updated).getTime() < 2000)) { sendSMS('SUMP PUMP ALERT', 'Water is only 20cm below surface and rising - [' + node._id + '] ' + node.label + ' @ ' + (new Date().toLocaleTimeString() + (new Date().getHours() > 12 ? 'PM':'AM'))); }; } },


I do hope you can do this change yourself.

Kilo95

Yep. Thanks. I set the app specific password up.

luisr320

It's not really complicated to setup a way to sent Tweets via the Moteino, directly, if it is connected to a Ethernet shield, or from a command line. I send them trough a VB script in a Windows machine. If there is any interest on this I can show you guys how it's done. But since the intention is to use a RPI, it must be done with Linux. Can Linux handle a VB Script or is it only for a Windows machine? I think I can setup a simple Tweet gateway connecting a Moteino to an ENC28J60.
It doesn't matter that you do have a tweeter account. You simply create one for yourself and another for your system. Them you install the official Tweeter APP on your phone, and set it up so that you follow all the tweets your system posts.
I'm trying to narrow down the easiest way to do it and will post here soon.


TomWS

Ok, your setup is different than mine.  I use TwitterAPI and the underlying code uses curl from PHP.  Works on any webhost that supports PHP, but you need a developer account.  But this is getting off topic so sorry for the distraction.

Tom

luisr320

#68
There is a Python library, tweepy, that will allow anyone to send a simple Tweet with a command like tweet.py "message".
I have never used a RPI, so I have no idea if this is possible, but can you have an event run a command like that? That would send a Tweet to you. By event I mean, a Digital Input on the Moteino sending its status to the RPI status and the RPI would run that command line.
If this is possible, I can post how to make it run.

Kilo95

Does the email alert require a different port to be open? I've checked all my settings and still nothing comes through. I know they had 22, 80, and 443 blocked so I was starting to wonder if that's why the email isn't coming through

Kilo95

I changed the line in metrics.js to <50cm (water level is 20-21cm) to see if it'll trigger it. Checked in gateway.sys.log like someone suggested and it's not trying to send a SMS or email. I made sure the security in Gmail is set for low level apps. What am I doing wrong? Everything is showing up fine on the Moteino Gateway GUI online

Kilo95

I got it. It'll send SMS but not email but that's ok. I did a fresh install with the v6 image. thanks for all of the help and being patient with a newbie

Felix

Great, but that's strange.
When you say email doesn't work, can you give more details?
The SMS mechanism uses email as a means to send the SMS. You're basically relaying that SMS via email. So it does send email, otherwise you could not get the SMS on your phone.

Kilo95

 I set up an email address and my mobile number email address to receive email and text alert. The text alert comes through but not the other email