First Plug In - problems with REST API

Posted on
Sat Sep 14, 2013 1:45 pm
eco offline
Posts: 9
Joined: Sep 10, 2013

First Plug In - problems with REST API

Hi

I'm developing a quick and easy plug in to control my various XBMC boxes. I've got the plug in working well on the sending side- it can send commands to XBMC, work with triggers etc, but I can't seem to control it at all using the REST API.

I have a state defined to show if the XBMC machine is powered up and XBMC is responding:

<State id="xbmcIsUp">
<ValueType>
<List>
<Option value="Up">Up</Option>
<Option value="Down">Down</Option>
</List>
</ValueType>
<TriggerLabel>XBMC Power Status is</TriggerLabel>
<TriggerLabelPrefix>XBMC Power Status is</TriggerLabelPrefix>
<ControlPageLabel>XBMC Power Status</ControlPageLabel>
<ControlPageLabelPrefix>XBMC Power Status is</ControlPageLabelPrefix>
</State>

Controlling this states works fine in plugins.py or for schedules.

I'm trying to control this state with the rest API with this command in a web browser:
http://192.168.178.200:8176/devices/Liv ... method=put

But this does not seem to have any effect. Shouldn't this change the state and trigger any actions which are watching this state?

Can anyone point me in the direction of some code to use the REST API to change the custom device's state?

Thanks!

Posted on
Sat Sep 14, 2013 6:55 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: First Plug In - problems with REST API

The RESTful API doesn't allow for changing of arbitrary plugin defined device states (only the native states defined by Indigo dimmers, relays, and thermostats).

You can create Action Groups in Indigo that perform plugin actions, and then execute those Action Groups via the RESTful API. That will work but won't allow for arguments or arbitrary data passing to the plugin. For that take a look at this forum thread that came up the other day.

Image

Posted on
Sun Sep 15, 2013 1:37 am
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: First Plug In - problems with REST API

I have updated the topic Matt referred to with a description of my solution to this problem.

Note: In the case I was working on, the external program initiating the call into Indigo was not running under the same user as the Indigo server. Resolving that issue was the more difficult part. The actual call, using IndigoPluginHose was easy (following Matt's example).

Posted on
Mon Sep 16, 2013 4:40 am
eco offline
Posts: 9
Joined: Sep 10, 2013

Re: First Plug In - problems with REST API

Thanks - I decided to just rely on polling the XBMC player to determine its state - very much appreciate the help.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 4 guests