This object is in archive! 

HTTP request on local network

Alain shared this question 11 years ago
Answered

Hello,


Does the HTTP requests (from the rule creator) are sent from Zipato servers or from the Zipabox ?

In fact, I like to send HTTP commands to my Raspberry pi located on my private lan (192.168.x.x).


Is it possible ? (without passing by internet).


Thanks

Replies (16)

photo
4

Currently the http request are only sent from the cloud. However, this is the feature which will be published very soon....

photo
1

Good news!

Thanks for your response.

photo
1

Cant you just NAT the R.Pi so it can be reached over internet?

photo
1

Yes. This is the solution I use. But it suppose to subscribe at dyndns or similar (I cant have fixed IP).

And soon will no longer free of charge, I'm sure. (it's now not possible to subscribe free dnyDNS without credit card number, free no-ip.org suppose to renew subscription every month...).

photo
1

are you sure ??

I have http request in my rules and they are received by my rip to log stuff in mysql base and it works. I'm not using it anymore but a few weeks ago it was still working !

photo
1

Yesterday it did not work.

But I have to say may be I made a mistake on URL configuration....

I have made a network sniffing and did not view any traffic addressed from Zbox to R.Pi. After Sebastian comment I stop debugging.

photo
1

Sebastian, can you clarify please because on my zipato request are sent from my box and not the cloud.

photo
1

@Alain, @xmeslin

I think there's been a little misunderstanding.

Yes you can use local IPs in "HTTP request" puzzle, just make sure IP is reachable form the network on which is Zipato connected.

We don't support incoming HTTP requests yet (from local network), but it will be implemented soon.

photo
1

ok maybe sebastian was thinking about http access from iphone to the zipabox to get information. Anyway tks for clarification

photo
1

Ok folks.

My fault, I was just wrong on my HTTP request.

It works now through my private LAN.

Now I'm curious to know what is the new feature Sebastian has announced.

Tanks for your help.

photo
1

Can you give an example for local HTTP request?

My zipabox is on 192.168.0.11

photo
1

if you want to use local API:


  1. function log_zipa_local()
  2. {
  3. global $username,$password,$url,$ip_zipa;
  4. $ch = curl_init('http://'.$ip_zipa.':8080/zipato-web/json/Initialize');
  5. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  6. $output = curl_exec($ch);
  7. $json= json_decode ($output,true);
  8. $sid = 'jsessionid';
  9. $none = 'nonce';
  10. $id = $json['jsessionid'];
  11. $nonce = $json['nonce'];
  12. $temp = sha1 ($password);
  13. $temp2 = $nonce.$temp;
  14. $pass = sha1($temp2);
  15. $data = array("username" => "$username", "password" => "$pass", "method" => "SHA1" );
  16. $data_url = "?method=SHA1&username=$username&password=$pass";
  17. $ch = curl_init('http://'.$ip_zipa.':8080/zipato-web/json/Login'.$data_url);
  18. curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
  19. curl_setopt($ch, CURLOPT_COOKIE, 'JSESSIONID='.$id);
  20. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  21. $output = curl_exec($ch);
  22. $rr = json_decode ($output,true);
  23. return array ($id,$rr['success'],$rr['error']);
  24. }


and then use $id for other request like :


  1. function set_radiator_local ($id,$uid,$value)
  2. {
  3. global $ip_zipa;
  4. $data_url = $value;
  5. $update_json = json_encode ($data_url);
  6. $update_json = str_replace("\"", "", $update_json);
  7. $ch = curl_init('http://'.$ip_zipa.':8080/zipato-web/rest/lights/values/'.$uid);
  8. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Content-Length: ' . strlen($data_url)));
  9. curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
  10. curl_setopt($ch, CURLOPT_COOKIE, 'JSESSIONID='.$id);
  11. curl_setopt($ch, CURLOPT_POSTFIELDS, $update_json);
  12. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  13. $output = curl_exec($ch);
  14. $json = json_decode ($output,true);
  15. return $json;
  16. }


$uid is the one you can have in the API wbpage for the device


Enjoy

photo
1

Hi,


I have a virtual sensor, activate is


https://my.zipato.com/zipato-web/remoting/attribute/set?serial=0100&ep=3df786&apiKey=d2b2ff72-3636-43a7-b5f8&state=true


How can i use this link in local like ;https://192.168.0.11/zipato-web/remoting/attribute/set?serial=0100&ep=3df786&apiKey=d2b2ff72-3636-43a7-b5f8&state=true


My goal;

I want to send a signal to my main zipabox from other zipaboxes which are in the same network. There is no internet in this network.

photo
2

ah ok I never used it like this. I always use the cookie. I guess you have to try.

BTW, remove your API key form the post :)

photo
1

Ok thanks,


I wrote API key and others randomly, they are not correct ;)

photo
1

Hi! Any update on the release of incoming HTTP requests from local network feature?


I really hope this will also work with regular HTTP requests, not just HTTPS. Lots of microcontrollers do not have enough memory to run SSL/TLS...

Leave a Comment
 
Attach a file