New graphing solution need Restful help

Posted on
Tue Aug 16, 2016 8:24 pm
exos offline
Posts: 57
Joined: Feb 02, 2016

New graphing solution need Restful help

I am trying to pull attribute data using Restful API. I am accessing the details of a light via the following address:

http://127.0.0.1:8176/devices/Living%20 ... ights.html

and being provided the data below. Is it possible access the attributes below so I can use curl to send that data to initialstate.com? How would the address look?

Something like this?

http://127.0.0.1:8176/devices/Living%20 ... ights/isOn


name : Living Room Lights
address : 0
addressStr : unknown
brightness : 15
classID : 2
devProtocol : 999
displayInUI : True
displayLongState : 15%
displayRawState : 15
folderID : 276490867
hasStateToDisplay : True
id : 210036752
isOn : True
lastChanged : 524694581
lastChangedDateStr : 2016-08-16
lastChangedRFC3339 : 2016-08-17T01:29:41Z
lastChangedRFC822 : Wed, 17 Aug 2016 01:29:41 GMT
lastChangedTimeStr : 08:29:41 PM
type : Dimmable Power Switch
typeFlags : 1555
typeSupportsDim : True
typeSupportsEnergyMeter : False
typeSupportsHVAC : False
typeSupportsIO : False
typeSupportsOnOff : True
typeSupportsSensorValue : False
typeSupportsSpeedControl : False
typeSupportsSprinkler : False
versByte : 0
Edit Attributes

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

Re: New graphing solution need Restful help

The API doesn't return single elements. You need to get one of the machine-readable versions of that page and then parse it out yourself. For instance:

Code: Select all
http://127.0.0.1:8176/devices/Office%20Lamp.json


returns something like this:

Code: Select all
{
    "lastChangedTimeStr": "06:09:29 PM",
    "lastChangedRFC822": "Mon, 25 Jul 2016 23:09:29 GMT",
    "typeSupportsHVAC": false,
    "hasStateToDisplay": true,
    "typeSupportsEnergyMeter": false,
    "typeSupportsIO": false,
    "addressStr": "unknown",
    "id": 848752729,
    "typeFlags": 1555,
    "typeSupportsOnOff": true,
    "isOn": false,
    "lastChanged": 522785369,
    "typeSupportsSensorValue": false,
    "type": "Lamp Module (AD130)",
    "classID": 2,
    "versByte": 0,
    "typeSupportsSpeedControl": false,
    "displayInUI": true,
    "displayLongState": "0%",
    "restParent": "devices",
    "address": 0,
    "displayRawState": 0,
    "name": "Office Lamp",
    "brightness": 0,
    "typeSupportsDim": true,
    "lastChangedDateStr": "2016-07-25",
    "lastChangedRFC3339": "2016-07-25T23:09:29Z",
    "devProtocol": 999,
    "folderID": 1397304878,
    "typeSupportsSprinkler": false
}


And you can pretty much use JSON in any programming language you like.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Aug 17, 2016 7:33 pm
exos offline
Posts: 57
Joined: Feb 02, 2016

Re: New graphing solution need Restful help

Thanks Jay!

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests