Jump to content









Photo

New Listener is not working.


  • Please log in to reply
2 replies to this topic

#1 rvrkrishna24

rvrkrishna24

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 16 July 2014 - 08:52 PM

Team,

 

I have created a new Listener , under my defaultDevice..My goal is if in the data , i see humidity greater or equal to 59, send an emaiil else send an sms.

 

Event Type I gave as "Event Data Received" later changed to "Data Received Team" but still am not able to see the message in my email..Listener code is as follows.

 

if context.data.hum >=58

then

import com.carriots.sdk.utils.Email;
import com.carriots.sdk.utils.BasicHttp;
 
// Send an email to support@carriots.com
def email = new Email ();
email.to="ramakrishna.rv@gmail.com";
email.subject="Humidity Check";
email.message="Humitdity is  "+context.data.hum;
email.send();
else
import com.carriots.sdk.utils.Sms
 
def sms = new Sms();
sms.to="00917829277059";  
sms.message="TestMessageFromCarriots";
sms.send();
 
Pls let me know where am doing wrong...

 



#2 sdeancos

sdeancos

    Master of Puppets

  • Members
  • PipPipPip
  • 105 posts
  • LocationMadrid, Spain.

Posted 17 July 2014 - 06:29 AM

Hi

 

Maybe you can try do cast:

 

 

if context.data.hum.toBigDecimal() >= 58.0

//or

context.data.hum.toInteger() >= 58

 

 

 

I hope this help you,

 

 

best regards.



#3 rvrkrishna24

rvrkrishna24

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 17 July 2014 - 09:24 AM

Thanks , yes this is correct..There was a cast exception i was seeing...

 

Regards,

RK






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users