[ANSWERED]: Indigo RESTful API device details

Posted on
Mon Jun 29, 2015 9:28 am
nanobots offline
Posts: 43
Joined: Apr 28, 2015

[ANSWERED]: Indigo RESTful API device details

When using the restful API, there seems to be a lack of detail around the status for many of the devices. For example, the NOAA weather plugin given the temperature in the status field, but doesn't seem to provide any of the other information (surrounding current conditions, etc.). Same with other devices created through third-party plugins (Hue lights don't show color information, Sonos devices don't provide information regarding what is currently playing, etc.)

Is there a way to get this information out of the API? Is there a better method for remotely retrieving this information? Is there a way to extend the APIs to include additional info?

Thanks!

Posted on
Mon Jun 29, 2015 9:52 am
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: Indigo RESTful API device details

The RESTful API has not been updated since we added plugins and the python API. Major improvements for it are on the request/todo list.

Image

Posted on
Fri Nov 06, 2015 11:57 am
jtodd offline
Posts: 76
Joined: Apr 15, 2014

Re: [ANSWERED]: Indigo RESTful API device details

I was about to post this in the devices forum, and did some more digging and found this thread - I'll just put this here for possible suggestions on the topic.


Hi -
I'm writing a quick script to poll values from my devices. I'm finding that the API is missing some device state information, and I'm hoping that there is just something obvious that I've not found reading through the manuals or boards.

For instance (this is merely an example, but I find it applies to many devices): I have an Aeon Z-Wave clamp-on wattmeter attached to my house mains. There are four "devices" that I can create and define associated with this physical unit: Meter Total, Clamp 1, Clamp 2, and Clamp 3. Then, each of those devices shows up separately in the list generated by http://127.0.0.1:8176/devices/ - so far, so good. However, it seems that each physical device in the /devices/ directory has exactly one value that appears in the API file list - here is the file devices/WattmeterMains-MainsTotal.txt :

Code: Select all
name : WattmeterMains-MainsTotal
address : 0
addressStr : unknown
classID : 0
devProtocol : 999
displayInUI : True
displayLongState : 1069.200 W
displayRawState : 1069.2
folderID : 596410929
hasStateToDisplay : True
id : 589123073
lastChanged : 500116922
lastChangedDateStr : 2015-11-06
lastChangedRFC3339 : 2015-11-06T17:22:02Z
lastChangedRFC822 : Fri, 06 Nov 2015 17:22:02 GMT
lastChangedTimeStr : 09:22:02 AM
type : Home Energy Monitor (DSB09104)
typeFlags : 16
typeSupportsDim : False
typeSupportsEnergyMeter : False
typeSupportsHVAC : False
typeSupportsIO : False
typeSupportsOnOff : False
typeSupportsSensorValue : False
typeSupportsSpeedControl : False
typeSupportsSprinkler : False
versByte : 0


I'm quite interested in the value contained in displayRawState - that's the number of current watts being generated. Again, so far so good. But when I click on the device name in the Z-Wave list in the Home Window, I can see there are several other data points associated with WattMeterMains-MainsTotal - values such as "Battery Level", "Total Usage", "Last Reset", "Reset Date", and "Last Update" appear in the list. I'm also interested in these values that are associated with the device, and it doesn't seem that there is anywhere that automatically allows me access to those values via the /devices/ API calls.

There are, of course, workarounds to this. I have found that variables can be set to those values, so I could create a Trigger or Schedule item to go through and change all of them any time a state change occurs on the device, or on a regular schedule. But that means that for every single device I have, I'll need to create a Trigger or Schedule, and then I'll have to write routines to scrape those values from the /variables/ API interface. Less than ideal from a labor perspective, extremely error-prone, and somewhat at odds with the existing automatic variable access for the arbitrary "major" values that are associated with the device. Why are some accessible, but not all? In my example, I've actually found that accumEnergyTotal is more interesting than current Watts, since reading my energy levels every two minutes usually misses spikes when a pump or heater is turned on, so I want to access accumEnergyTotal from the API so I can act on that value. But I can't get to that data without jumping through some hoops that I think are unusual and un-necessary.

I'd suggest this change for consistency and ease of access to data: automatic creation of API-accessible methods of those sub-values so they can be parsed. Here's what I might imagine the /devices/ list would look like after such a change:

Code: Select all
.
.
.
WattmeterMains-Clamp1
WattmeterMains-Clamp1_accumEnergyTimeDelta
WattmeterMains-Clamp1_accumEnergyTotal
WattmeterMains-Clamp2
WattmeterMains-Clamp2_accumEnergyTimeDelta
WattmeterMains-Clamp2_accumEnergyTotal
WattmeterMains-Clamp3
WattmeterMains-Clamp3_accumEnergyTimeDelta
WattmeterMains-Clamp3_accumEnergyTotal
WattmeterMains-MainsTotal
WattmeterMains-MainsTotal_accumEnergyTimeDelta
WattmeterMains-MainsTotal_accumEnergyTotal
WattmeterMains-MainsTotal_batteryLevel
.
.
.

I'm not sure if you'd want to be consistent with WattmeterMain-Mains_curEnergyLevel as an exposed value or not, since that is what is tied by default to the un-suffixed device name in the example above (and is currently the way the system works.) This method would not interfere with anyone using the existing API calls, and would expose all the data in a logical way that is consistent with the current method. The values in the API files would be the same as any other device value.

I love the fact that there is an API for access to Indigo data, but getting access to ALL the data is really a first-level requirement for any API to be useful in a complete context.

Am I simply missing how to do this in a way that already exists?

JT

Posted on
Fri Nov 06, 2015 3:45 pm
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: [ANSWERED]: Indigo RESTful API device details

The RESTful API predates the IOM, which exposes all device states. We have plans to update the RESTful API to provide all device information, but no ETA on that.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Nov 06, 2015 4:02 pm
jtodd offline
Posts: 76
Joined: Apr 15, 2014

Re: [ANSWERED]: Indigo RESTful API device details

Thanks for the update. I look forward to a fix!

I'll post the script I created in a different forum which imports from the REST API to InfluxDB. That's why I ran across this issue.

JT

Posted on
Thu Mar 03, 2016 4:35 pm
jtodd offline
Posts: 76
Joined: Apr 15, 2014

Re: [ANSWERED]: Indigo RESTful API device details

I'm also now finding that the RESTful API is crashing (frequently) when I'm asking it lots of questions. Any word on a revamp? (details available if you'd like.)

JT

Posted on
Thu Mar 03, 2016 6:29 pm
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: [ANSWERED]: Indigo RESTful API device details

What is the rate of your requests?

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Mar 03, 2016 7:06 pm
jtodd offline
Posts: 76
Joined: Apr 15, 2014

Re: [ANSWERED]: Indigo RESTful API device details

Once a minute (See other thread on this - viewtopic.php?f=138&t=14998&p=111784#p111784 )

JT

Posted on
Tue Mar 22, 2016 3:40 pm
jtodd offline
Posts: 76
Joined: Apr 15, 2014

Re: [ANSWERED]: Indigo RESTful API device details

Still getting regular (every two or three days) crashes on the API which cause all API reads to fail. :-(

Running the most current: 6.1.7

Should I start a new thread on this?

JT

Posted on
Wed Mar 23, 2016 9:24 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: [ANSWERED]: Indigo RESTful API device details

Please do - we'll follow up there.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Mar 23, 2016 12:54 pm
jtodd offline
Posts: 76
Joined: Apr 15, 2014

Re: [ANSWERED]: Indigo RESTful API device details

Message posted: viewtopic.php?f=131&t=15807

JT

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests

cron