How to send an email with the status of an alarma system using Ethernet connection?

Status
Not open for further replies.

takachan

New Member
I have to send an email when a relay is activated in an alarm system.
I plan to use a netbook running a C # program, considering the low price and relativamentesconsumption and availability of these netbooks.
My question is can a netbook of this type can operate continuously, 24 hours a day, without interruption?
Any suggestions.
 
What OS is on the netbook?

I can tel you how I send a text message to my cell phone as well as emails to my email accounts using a Windows based operating system. I wrote simple script and call the script from within a VB program. I guess if you want to use C# you could do it from within a C# program.

As long as the netbook is powered I don't see why it couldn't run 24/7.

Ron
 
Thanks Ron
The netbook runs Windows 7 starter edition.
I have not tried it myself if the netbook can work under these conditions 24 / 7 and if there are problems with overloading the battery or temperature problems.
I chose a netbook because its consumption is reduced and the internal battery would avoid the use of a UPS.
 
OK, let me give you a few ideas. Keep in mind I am not a programmer type. If I had to earn a living programming I would starve to death and the house would be gone.

I wanted something simple to send mail and text notifications of an alarm status. I found no easy way to do it from within VB or most common languages so I took a round about method that works fine. I wrote a script to send mail (as well as text) as a simple script using VBS Visual Basic Scripting which will run on any Windows OS. The script looks like this:

Code:
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Example CDO Message"
objMessage.From = "me@my.com"
objMessage.To = "0123456789@vtext.com;me@myemail.com"
objMessage.TextBody = "This is some sample message text."
'objMessage.AddAttachment "C:\Users\Ron\Pictures\Biscuit\B3.jpg"
objMessage.Send

This is called a CDO message using CDO Object. A Google of Send Mail CDO will bring up a dozen hits with the above code. There is no limit as to what you can build on it. So if you want to try something copy and paste the above code into Notepad and edit it accordingly.

objMessage.From = "me@my.com" You can put any email in there, really matters not.

objMessage.To = "0123456789@vtext.com;me@myemail.com" The first part would be the ten digit phone number (obviously I am in the US) and the @vtext.com is the code used for my cellular carrier (Verizon). Then we have a separator ; followed by a valid email address.

objMessage.TextBody = "This is some sample message text." This will be the text body of the email. Something like Smoke Detector Alarm or whatever you choose.

'objMessage.AddAttachment "C:\Users\Ron\Pictures\Biscuit\B3.jpg" This is remarked out in the sample but it would be used to send a file attachment. Could be a picture as shown or text document or whatever you want as an email attachment. I was experimenting sending pictures of one of the dogs.

objMessage.Send This just sends the email.

I suggest just for the heck of it you give that a try. Copy and paste the code sample after editing it into Notepad. Then save the file but you need to save the file with a .vbs file extension or in Notepad it will save as a useless text document. So you could name it SendMail.VBS and just save to your desktop for convenience. Now once saved double click the icon on the desktop and see if you get mail. It should work. Well on any computer with an Internet connection anyway.

Now if you think about it you could create a bunch of these files such as FIRE.VBS, SMOKE.VBS, FLOOD.VBS, PWRFAIL.VBS and whatever. Then place them in a folder wherever you want.

Next with that done you need some sort of hardware device out there. Likely for a netbook, maybe a USB DIO (Digital In Out) device. There are literally hundreds of devices out there.Depends on how many digital inputs you want for alarms.

Now you write your real software to communicate with your DIO device. I used VB because for me Visual Basic (NOT VB Scripting) as I used earlier is simple and when you are not a programmer simple is a very good thing.

I set all my DIO ports as Inputs and all low. The software just keeps looking at the ports. If a port goes high it creates an alarm status for that port. Then depending on which port goes high my code in VB looks like this:

Code:
Private Sub Text1_Change()
If Text1.Text = "Alarm" Then
    Shell "Wscript.exe C:\Users\Ron\Desktop\sendmail.vbs", vbNormalFocus
End If
End Sub

I have text boxes with "NORMAL" as text and a Green background color. For an alarm condition the text changes to "ALARM" and the background color changes to red. So if my text box text = Alarm Then I run a shell command to automatically execute the .VBS file and send mail and text to my cell. If you wrote more .vbs files the software would open the correct file for any given alarm condition.

There are likely a dozen ways to do this. I am just mentioning what I did. Try the first script and see if it runs on your system.

<EDIT> If you wanted to start a process from within a C# program your code would look like this example:

The C# example taken from here.

</EDIT>

Ron
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…