Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

EmailSend fails


Nigel Oct 25, 2010 08:39 PM

Hi, I am having trouble with the EmailSend command, have looked in vain for a case study or other guides but nothing iludes too what I am doing wrong.

Setup is:
CR800 via rs232 to NL100
NL100 via eithernet to Netgear 614 router
Router to wireless modem

The modem and router are a supplied pairing whereby the router forces the modem into an always live if powered.
Noting it is using a static ip address.
I am monitoring temps and power use, and wanting to send email messages of warning states before my programe autoshuts down the power to the router and modem.

I can connect to the CR800 through the setup remotely already, the basics seem correct.

I used the emailsend example from help file
I have set all ip addressing where ever a location is provided(Devconfig)DNS1 and DNS2, noting I also had to get in from the table itself to enter the GW192.168.1.1 address for the router, the Devconfig has no option as the CR1000 model has.(bug)

Anyway looking for case study or examples as for what I am doing wrong.

* Last updated by: Nigel on 10/25/2010 @ 2:40 PM *


Nigel Oct 25, 2010 08:45 PM

Heres the programme


Const ServerAddr="xxx.xx.xx.xx"
Const ToAddr="xxxXxxx@XXXXX.xx.xx"
Const FromAddr="XXXXXXX@xxxx.xx.xx"
Const Subject="xxxx xxxx"

Const Attach=""
Const UserName="XXXXXX@xxxxx.xx.xx"
Const Password="xxxxxx"

Const CRLF = CHR(13)+CHR(10)

Public EmailTest As Float

Public Result As String * 50
Public AlarmTemp As Boolean
Public AlarmVolts As Boolean
Public Message As String * 250
Public EmailSuccess As Boolean


Public BattV As Float
Public VCount As Float
Public LoggerTemp As Float
Public Thermocouple As Float
Public RouterTemp As String * 20
Public Site_Aflow
Public Site_Bflow
' Data Tables

'Conditions once per day
DataTable (Conditions,True,-1)
DataInterval (0,3600,Min,10)
Minimum (1,BattV,FP2,False,False)
Maximum (1,BattV,FP2,False,False)
Average (1,LoggerTemp,FP2,False)
Maximum (1,LoggerTemp,FP2,False,False)
Average (1,Thermocouple,FP2,False)
Maximum (1,Thermocouple,FP2,False,False)
EndTable


' Main Program
BeginProg
Scan (5,Sec,3,0)

' Measure Battery Voltage & Logger Temperature
Battery (BattV)
PanelTemp (LoggerTemp,_50Hz)

'Thermocouple measures Netgear 614 router temperature
'Router thermal overheat warning, overheat triggers email
TCSe (Thermocouple,1,mV2_5C,1,TypeT,LoggerTemp,1,0,_50Hz,1.0,0)
Thermocouple=(Thermocouple-8.3972)/0.6345
'case ranges for temp
Select Case Thermocouple
Case -5 To 0
RouterTemp = "Frozen!"
Case 0.1 To 15
RouterTemp= "Cold"
Case 15.1 To 25
RouterTemp = " Warm"
Case 25.1 To 35
RouterTemp = "Toasty"
Case 35.1 To 45
RouterTemp = "Hot!"
Case Is > 45
RouterTemp = "Send Help, Melted!"
Case Else
RouterTemp = "Crap i'm broken!"
EndSelect
'Router Temp warning email
If AlarmTemp = False Then
If Thermocouple> 45 Then AlarmTemp = True
If AlarmTemp = true Then
Message = "Warning!" + CRLF + CRLF
Message = Message + "This is a automatic email message from the datalogger station " + Status.StationName + ". "+ CRLF
Message = Message + "An alarm condition has been identified. "+ CRLF+ CRLF
Message = Message + "The router temperature is " + Thermocouple + " degrees C." + CRLF
Message = Message + RouterTemp+ CRLF
Message = Message + "Datalogger time is " + Status.Timestamp
EmailSuccess=EMailSend (ServerAddr,ToAddr,FromAddr,Subject,Message,Attach,UserName,Password,Result)
'Switch relay on to turn off router, 10 second dely to send email
If Thermocouple>45 Then
Delay (1,10,Sec)
SW12(1)
EndIf
EndIf
EndIf
If Thermocouple < 45 Then AlarmTemp=false

'Battery voltage warning if power drops, count triggers email message then router to be turned off
Select Case BattV
Case 13.6 To 14
If VCount>1000 Then
VCount=VCount-1000
ElseIf VCount > 600 Then
VCount = VCount-100
Else
VCount = VCount - 10
EndIf
Case 13.2 To 13.59
VCount = VCount + 0
Case 13.0 To 13.19
VCount = VCount + 1
Case 12.8 To 12.99
VCount = VCount + 2
Case 12.6 To 12.79
VCount = VCount + 3
Case 12.4 To 12.59
VCount = VCount + 4
Case 11.0 To 12.39
VCount = VCount + 5
EndSelect
'email message trigger for low voltage, by VCount
If AlarmVolts = False Then
If VCount > 350 Then AlarmVolts = true
If AlarmVolts = true Then
Message = "Warning!" + CRLF + CRLF
Message = Message + "This is a automatic email message from the datalogger station " + Status.StationName + ". "+ CRLF
Message = Message + "An alarm condition has been identified. "+ CRLF+ CRLF
Message = Message + "The battery is " + BattV + " Volts." + CRLF
Message = Message + "The Charger or Power has dropped."+ CRLF
Message = Message + "Datalogger time is " + Status.Timestamp
EmailSuccess=EMailSend (ServerAddr,ToAddr,FromAddr,Subject,Message,Attach,UserName,Password,Result)
EndIf
EndIf
'turn off router if count continues to climb, but after warning email sent
If VCount > 400 AND VCount < 407 Then SW12 (1 )
'keep count at zero if less than zero
If VCount <= 0 Then VCount = 0
'Reset voltage alarm status
If VCount = 0 Then AlarmVolts=False
'Turn router back on if voltage and temps ok
If AlarmVolts = false AND AlarmTemp = false Then SW12 (0)

'emailtester
If EmailTest = 1 Then
Message = "Warning!" + CRLF + CRLF
Message = Message + "This is a automatic email message from the datalogger station " + Status.StationName + ". " + CRLF
Message = Message + "An alarm condition has been identified. " + CRLF+ CRLF
Message = Message + "The router temperature is " + Thermocouple + " degrees C." + CRLF
Message = Message + "The battery is " + BattV + " Volts." + CRLF
Message = Message + "The Charger or Power has dropped."+ CRLF
Message = Message + "Datalogger time is " + Status.Timestamp
EmailSuccess=EMailSend (ServerAddr,ToAddr,FromAddr,Subject,Message,Attach,UserName,Password,Result )
EmailTest = 0
EndIf

' Output Tables
CallTable Conditions
NextScan

SlowSequence
'Data grab from site A and B loggers
DataTable (Site_A,true,-1)
Sample (1,Site_Aflow,FP2)
EndTable

DataTable (Site_B,true,-1)
Sample (1,Site_Bflow,FP2)
EndTable

Scan (15,Min,3,0)
GetDataRecord (Result,ComSDC7,-1,20,0000,0,2,1,Site_A)
GetDataRecord (Result,ComSDC7,-1,30,0000,0,2,1,Site_B)
NextScan
EndProg

* Last updated by: Nigel on 10/26/2010 @ 2:25 PM *


ChipsNSalsa Oct 26, 2010 12:37 AM

Are you getting anything back in the "Result" variable?
What's the outbound port number supposed to be for email clients attaching to your email server?


Nigel Oct 26, 2010 03:43 AM

Result:Failed to connect

should be defaults for port(as per email help), havent entered any specific port for email since it is outbound and router should handle that ok. in theory.

router614(GW)ip 192.168.1.1
NL100 ip 192.168.1.2
CR800logger ip 192.168.1.3


Const ServerAddr="xxx.xx.xxx.xx"
This is same as xxxx.xxxxx.xx.xx
(tried both ways)

xxxxx gw & dns loaded into CR800 tables
(GW loaded in through status tables as Devconfig has no varible?)
gw xxx.xxx.x.x
dns1 xxx.xx.xxx.xxx
dns2 xxx.xx.xxx.xxx

* Last updated by: Nigel on 10/26/2010 @ 2:27 PM *


aps Oct 26, 2010 08:29 AM

Sorry to inform you of this, but the CR800 cannot use any of its TCP/IP functionality, including emailsend, via an NL100.

Currently the CR800 only supports TCP/IP via a PPP connection out of its serial ports. This protocol is not used with the NL100. (The NL100 acts as a simple serial terminal server.)

By early next year we will have a gadget that does allow ethernet connections for the CR800 with TCP/IP functions, but at the moment you would need a more powerful logger fitted with an NL115 or NL120.


Nigel Oct 26, 2010 09:11 PM

sigh.....

So you understand why I am using the separate TCP/ip router+modem over a standard GSM type link, is that I have 2 stand alone type probes(Trios UV probes) that can only run over TCP/ip. I might note the Cambpell and Trios equipment failed to communicate, dispite both systems having MODBUS.
It may well be that either or both systems are in complete in protocols.

So the choice was at a min Three GSM modems plus connection costs vs one TCP/ip wireless connection. Hence the eithernet based setup where each can run independant over TCP/ip and one connection.

There is also 2 CR800s and OTT river flow monitoring sites measuring stream flow, where the home base site is either going to just act as pass through or collect data from flow sites. The probes do have 4~20ma outputs, however these don't carry the spectral data and also appeared to be noisey.

So to upgrade the homebase site as a CR1000 or higher seems to be overkill and expensive for what it will be doing, that is 2*4~20ma inputs(backup of probes only) and radio pass through and /or collect remote data and monitor power conditions at the homebase site.

At the moment I can connect , upload, download with the current setup, however the point of the emails is to act as a warning system to notify me of what or why I can't connect to the system at a later time, or as to react to some change in measurements from the probes, which will need to be changed manually.

Can a NL100 be flashed with the protocols?(even if it means dropping other functions)

Can we get a prototype of this new TCP/ip gadget?

* Last updated by: Nigel on 10/26/2010 @ 3:16 PM *


Brian Oct 28, 2010 09:19 PM

Adding the ability for the NL100 to communicate to the CR800 IP stack would be a large task. There are no plans to add new features or functionality to the NL100.

As far as a prototype of the new device, we are not far enough along in its development at this time. We hope to have the new device ready for the first quarter next year.


Dana Oct 28, 2010 09:20 PM

If you were using RTMCPro, you could set an alarm for a value that triggered an email when the value exceeded a threshold.

Unfortunately, the NL100 cannot be "upgraded", and no prototypes are available of the new device.

Dana


Nigel Oct 29, 2010 03:40 AM

Yeah, the RTMC is an option, but really needs a PC that is left alone as a server. My base PC does run Logger4 as main host and file downloads 24/7, but I also use the PC for many other duties where the RMTC becomes a bit flakey.
Gave up on the inbuilt RMTC ages ago.

At any rate, have found a spare, currently not in use CR1000 I can loan and have negotiated a swapout with the NL100 with a NL115 until your new device becomes avaliable next year.

I might note though, we use several NL100's with rf411's to our loggers based around the campus as the main connection to the University network. On another occasion we attempted email, but gave up fairly quickly at that time, now I know why it didn't work.
In this case the NL100 is the only device that can carry a radio(rf411 in our networks) and eithernet, seems a shame that TCP is not fully functional considering.
Although we have set them as pakbus networks not TCP.

Might be something to consider for later devices or updates devices such as the NL100 to have complete TCP/ip function.


Dana Oct 29, 2010 05:24 PM

Thank you for your comments.

You have to consider the history of the NL100. It was originally developed to provide a way to "hang a datalogger" off a network. When it was developed there was no EmailSend, FTPClient, etc. functionality in the dataloggers. Thus, the limitations of the NL100, and one of the reasons for developing the new device.

I don't know if you have looked at RTMC in a while, but significant changes have been made to improve performance. You might find that it is more responsive than you've seen in the past, if your previous experience was with the 2.x version of RTMC.

Regards,

Dana W.


Nigel Oct 31, 2010 08:20 PM

I did use RTMC (built in version) for a while, I found it quite good for a local site setup.
Although as I mentioned I found it was a problem when running xls macros and autocad type programmes at the same time.

Yeah understand with NL100, I presume that this new device is an upgrade/replacement of the NL100?

Log in or register to post/reply in the forum.