[ANSWERED]Connecting through RESTful URLs.

Posted on
Sun Jul 26, 2015 5:43 am
wickey offline
Posts: 22
Joined: Feb 15, 2015

[ANSWERED]Connecting through RESTful URLs.

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)

Posted on
Mon Jul 27, 2015 11:25 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Connecting through RESTful URLs.

Not at the moment, but it's on our feature request list. No ETA.

MODERATOR NOTE moved to the right forum.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Jul 28, 2015 6:50 am
wickey offline
Posts: 22
Joined: Feb 15, 2015

Re: [ANSWERED]Connecting through RESTful URLs.

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>

Posted on
Tue Jul 28, 2015 9:32 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: [ANSWERED]Connecting through RESTful URLs.

You need to add the authentication information to your request.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sun Aug 30, 2015 6:41 am
wickey offline
Posts: 22
Joined: Feb 15, 2015

Re: [ANSWERED]Connecting through RESTful URLs.

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.

Posted on
Tue Sep 01, 2015 12:48 pm
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: [ANSWERED]Connecting through RESTful URLs.

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)

Image

Posted on
Wed Sep 02, 2015 12:32 am
wickey offline
Posts: 22
Joined: Feb 15, 2015

Re: [ANSWERED]Connecting through RESTful URLs.

Great... Thank you very much for the support.

I did it.... :D

Posted on
Thu Oct 29, 2015 6:11 am
wickey offline
Posts: 22
Joined: Feb 15, 2015

Re: [ANSWERED]Connecting through RESTful URLs.

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...

Posted on
Thu Oct 29, 2015 9:40 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: [ANSWERED]Connecting through RESTful URLs.


Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests