Jump to content









Photo

Help with tutorial


  • Please log in to reply
5 replies to this topic

#1 morot_iot

morot_iot

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 04 September 2013 - 07:23 AM

Hi,

 

I am a beginner with this. Could you please help me to get the electrovalve tutorial working.

 

Is the idea to be able to connect to a valve with a public ip address through www.carriots.com?

I completed this tutorial and have contact with the raspberrypi but don't know how to access the valve from the internet (:

 

The SMS and e-mail examples worked well!

 

The alarm list shows

 

html title 500 Internal Server Err

 

Thank you!

 

morot_iot



#2 jpastor

jpastor

    Development leader

  • Administrators
  • 151 posts

Posted 04 September 2013 - 11:54 AM

Hello morot_iot



We will be happy to help you finish the tutorial :) .


Reviewing your user logs, we have seen the following error (we have replaced the IP address by X):

'code': 'error', 'details': "HTTPConnectionPool(host='XX.XXX.XXX.XX8080', port=80): Max retries exceeded with url: /electrovalve.php?status=off
 

It seems that your listener is using an invalid IP address. The correct request should be something like:

host='XX.XXX.XXX.XX:8080'



Please check your listener and make sure you have separate "IP address" and "port" by ":". It should be something like:

 

basicHttp.url = "http://"+IP+":8080/electrovalve.php";

 

 

Hope it helps.

Enjoy Carriots!



#3 morot_iot

morot_iot

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 04 September 2013 - 12:59 PM

Hello jpastor,

 

thank you for you kind answer.

 

Now the listener code is

 

If expression

==========

context.data.valve=="on"

 

Then expression

=============

import com.carriots.sdk.utils.BasicHttp;
import com.carriots.sdk.Device;
def basicHttp=new BasicHttp();
def device=Device.find("defaultDevice@morot_iot");
def IP=device.device_properties.last_IP;
basicHttp.url="http://"+IP+":8080/electrovalve.php";
basicHttp.params=["status":"on"];
basicHttp.send();

 

Else expression

=============

import com.carriots.sdk.utils.BasicHttp;
import com.carriots.sdk.Device;
def basicHttp=new BasicHttp();
def device=Device.find("defaultDevice@morot_iot");
def IP=device.device_properties.last_IP;
basicHttp.url="http://"+IP+":8080/electrovalve.php"
basicHttp.params=["status":"off"];
basicHttp.send();

 

The raspberrypi is restarted but there is still the error message when I run send.php.

 

send.

 

I restarted the raspberry pi but the error message is still there.

 

 



#4 jpastor

jpastor

    Development leader

  • Administrators
  • 151 posts

Posted 04 September 2013 - 02:41 PM

Hi morot_iot

Can you tell us more about the error?

We need some keys to help you ;)



#5 morot_iot

morot_iot

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 05 September 2013 - 06:02 AM

Hello,

 

now it syas Listener electrovalve_redir@morot_iot:Blocked URL.



#6 jpastor

jpastor

    Development leader

  • Administrators
  • 151 posts

Posted 05 September 2013 - 11:09 AM

Hello morot_iot

Apparently Carriots can not connect to the specified IP address.

When launching the Listener, Carriots tries to connect to the specified IP address and if it's not available, it will receive a timeout. If this process is repeated 3 times, the IP address is blocked for 5 minutes (security reasons).

In your case it seems that the listener has running three times and failed to connect with the IP address.

Remember that you may need to do Network Address Translation (NAT) on your router to connect with the electrovalve. Try to PING the IP address to check if it responds. If the device does not repond, the listener can not connect.

You can also paste the listener code portion you want (if or else) in Carriots console and check the response. To do this in your control panel, at the top select "DEBUG & LOG" -> "CONSOLE", paste the code and press "SEND".

 

If the IP address does not respond, you should receive something like the following:

 

Attached File  terminal.jpg   27.98K   18 downloads

 

 

Hope it helps.

 

 

Enjoy Carriots!






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users