Page 1 of 1

[ANSWERED]Connecting through RESTful URLs.

PostPosted: Sun Jul 26, 2015 5:43 am
by wickey
Hi,

A per the documentation, we can get all the devices, actions, variables etc.. through these urls. Also device, action level informations.
In my indigo plugin I have separated my devices in to folders like Kitchen, Main bedroom etc.. Can I list the folder structure and the devices under that particular folder through this RESTful URLs.

(without listing all the devices, list devices folder wise)

Re: Connecting through RESTful URLs.

PostPosted: Mon Jul 27, 2015 11:25 am
by jay (support)
Not at the moment, but it's on our feature request list. No ETA.

MODERATOR NOTE moved to the right forum.

Re: [ANSWERED]Connecting through RESTful URLs.

PostPosted: Tue Jul 28, 2015 6:50 am
by wickey
Thank you for the reply.

I am trying to load the devices through Restfull urls. My indigo is configured with authentication. I am not able to load the devices data through python script with authentication. getting "Access denied" even though the credentials are correct. if i removed the authentication it woks. I have tried this with urllib2 and httplib2 as well. but no luck. [From web browser I can load data]

My python code as follows,

import requests
r = requests.get(url, auth=(username, password))
print r.text

output:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Indigo Home Control Server</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" media="screen" type="text/css" href="/css/global4.css" />
<link rel="stylesheet" media="screen" type="text/css" href="/css/indigo4.css" />
<link rel="stylesheet" media="screen" type="text/css" href="/css/fonts.css" />
</head>
<body>
<center>
access denied
</center>
</body>
</html>

Re: [ANSWERED]Connecting through RESTful URLs.

PostPosted: Tue Jul 28, 2015 9:32 am
by jay (support)
You need to add the authentication information to your request.

Re: [ANSWERED]Connecting through RESTful URLs.

PostPosted: Sun Aug 30, 2015 6:41 am
by wickey
Thank you so much.

I read the documentation about indigo.devices.subscribeToChanges().
Following the documentation I have added this inside the deviceStartComm.
But i did not get any notifications. Can you please explain how I can get notification with this method. Can you please provide me a sample code.

Re: [ANSWERED]Connecting through RESTful URLs.

PostPosted: Tue Sep 01, 2015 12:48 pm
by matt (support)
Take a look at my post on this forum thread. Note you can compare the old and new device instances passed in to determine what has changed. Also, it is important that you call the parent deviceUpdated() method so that it can do its processing:

Code: Select all
   def deviceUpdated(self, origDev, newDev):
      indigo.server.log(u"deviceUpdated orig: \n" + str(origDev))
      indigo.server.log(u"deviceUpdated new: \n" + str(newDev))
      indigo.PluginBase.deviceUpdated(self, origDev, newDev)

Re: [ANSWERED]Connecting through RESTful URLs.

PostPosted: Wed Sep 02, 2015 12:32 am
by wickey
Great... Thank you very much for the support.

I did it.... :D

Re: [ANSWERED]Connecting through RESTful URLs.

PostPosted: Thu Oct 29, 2015 6:11 am
by wickey
Can I get variable changes as in the same way?

Can you please update me , method name to override and , how to call subscribe to changes...

Re: [ANSWERED]Connecting through RESTful URLs.

PostPosted: Thu Oct 29, 2015 9:40 am
by jay (support)