indigo utilities discussion

User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: indigo utilities discussion

Post by kw123 »

I would like to point out that the 2 systems indigo internal db and what ever you do externally can become quickly out of sync.
If a device gets deleted added renamed would require a trigger to update that dB.
I am speaking from experience. This is a lot of work to make this kind of thing work.


Why don’t you do directly to the source ie indigo ?


Sent from my iPhone using Tapatalk
siclark
Posts: 2356
Joined: Tue Jun 13, 2017 5:08 am
Location: UK

Re: indigo utilities discussion

Post by siclark »

Yes, agree would need some updating and refreshing but manageable on adhoc basis if I saw issues on the results.

I am trying to setup a dashboard for my house in Qlikview which has free personal license for single use, and is a data visualisation tool I have used for many years, and can read data from postgresql.
With a table of all device ids I can create a loop to load in each table, and with the names against them, create a more useful name for that device. I have done this manually copying out from the log the list of all devices, but a pain to update this way.

Taking it to the next step, I can then create a different sql statement per device type, ie per PIR, thermostat, light switch etc, where each type has the same columns. As I loop through the device ids, if the name ends "PIR", or "Stat" etc (I am consistent with my naming of devices) then it will load that device into the right table.

I can then create interactive charts there .
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: indigo utilities discussion

Post by kw123 »

again the question why don't you go directly against indigo? the db is just an intermediate storage. can quick .. only read sql databases? or can you feed things directly?
siclark
Posts: 2356
Joined: Tue Jun 13, 2017 5:08 am
Location: UK

Re: indigo utilities discussion

Post by siclark »

It does have a REST connector as well so guess it could query indigo directly for that information.?
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: indigo utilities discussion

Post by kw123 »

U can get states etc thru rest but don’t know if you can get a device list.


Sent from my iPhone using Tapatalk
User avatar
Colorado4Wheeler
Posts: 2794
Joined: Mon Jul 20, 2009 10:48 am
Location: Colorado

Re: indigo utilities discussion

Post by Colorado4Wheeler »

You can get a device list via REST (assuming you are referring to Indigo's RESTful API):

Code: Select all

http://127.0.0.1:8176/devices/
http://127.0.0.1:8176/devices.json/
http://127.0.0.1:8176/devices.xml/
http://127.0.0.1:8176/devices.txt/
My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: indigo utilities discussion

Post by jay (support) »

Colorado4Wheeler wrote:You can get a device list via REST (assuming you are referring to Indigo's RESTful API):

Code: Select all

http://127.0.0.1:8176/devices/
http://127.0.0.1:8176/devices.json/
http://127.0.0.1:8176/devices.xml/
http://127.0.0.1:8176/devices.txt/

Note that those lists don't include the ID, so you'll need to iterate through the lists, get the restURL element and use that to get the device details that includes the ID.
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
siclark
Posts: 2356
Joined: Tue Jun 13, 2017 5:08 am
Location: UK

Re: indigo utilities discussion

Post by siclark »

Thanks all. Yes realised that the device list from REST wouldn't do it without some hugely painful looping.
Think the easiest is to try and loop through the device list and get the id to name that way into a table.

Sorry Karl, seem to have hijacked your thread, this would have been better in my earlier script question thread.


Sent from my iPhone using Tapatalk
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: indigo utilities discussion

Post by kw123 »

to read the device states you don't need the devId, the devName is ok ..
just pay attention if the name changes .. I know thats not perfect, but it saves - in your case - a lot of programming I believe.

Code: Select all

curl -u uid:pwd --digest http://192.168.1.xx:8176/devices/UniFi_sw_2_1_study.json
will give you all the states.. Actually I don't know how to use the devId to get the states through REST !? .. may be somewhere in the docu..


Karl
http://wiki.indigodomo.com/doku.php?id= ... stful_urls for the rest api
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: indigo utilities discussion

Post by jay (support) »

kw123 wrote:to read the device states you don't need the devId, the devName is ok ..
just pay attention if the name changes .. I know thats not perfect, but it saves - in your case - a lot of programming I believe.

Code: Select all

curl -u uid:pwd --digest http://192.168.1.xx:8176/devices/UniFi_sw_2_1_study.json
will give you all the states.. Actually I don't know how to use the devId to get the states through REST !? .. may be somewhere in the docu..


Karl
http://wiki.indigodomo.com/doku.php?id= ... stful_urls for the rest api
I think he's using the Postgres DB directly and only needs the name to make his visualizations more readable.

The ID was added after the fact to the existing REST API - it's not used in any place other than returned with the device details so you can't get a device based in the ID. We're currently planning a pretty big revamp of the REST API as we reimplement the Indigo Web Server using the IOM (the current IWS implementation predates plugins, object IDs, and the IOM which is why it lacks features).
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
User avatar
Colorado4Wheeler
Posts: 2794
Joined: Mon Jul 20, 2009 10:48 am
Location: Colorado

Re: indigo utilities discussion

Post by Colorado4Wheeler »

jay (support) wrote:We're currently planning a pretty big revamp of the REST API as we reimplement the Indigo Web Server using the IOM
There's a new plugin I can scrap then :). I was rewriting the API via a plugin.
My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: indigo utilities discussion

Post by jay (support) »

Colorado4Wheeler wrote:
jay (support) wrote:We're currently planning a pretty big revamp of the REST API as we reimplement the Indigo Web Server using the IOM
There's a new plugin I can scrap then :). I was rewriting the API via a plugin.
Yeah, that would probably not be the best use of your time...
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
User avatar
Colorado4Wheeler
Posts: 2794
Joined: Mon Jul 20, 2009 10:48 am
Location: Colorado

Re: indigo utilities discussion

Post by Colorado4Wheeler »

jay (support) wrote:Yeah, that would probably not be the best use of your time...
Lol, if I had a penny for each plugin that wasn't a good use of my time.... :shock: . That project only got a little bit of love when I utilized it in the HKB plugin (sort of), but it was slated for a month or two down the road before I lit it up anyway so I've only spent maybe 1-3 hours working on what's there now. Glad to not have to write it honestly.
My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here
siclark
Posts: 2356
Joined: Tue Jun 13, 2017 5:08 am
Location: UK

Re: indigo utilities discussion

Post by siclark »

I think he's using the Postgres DB directly and only needs the name to make his visualizations more readable.

The ID was added after the fact to the existing REST API - it's not used in any place other than returned with the device details so you can't get a device based in the ID. We're currently planning a pretty big revamp of the REST API as we reimplement the Indigo Web Server using the IOM (the current IWS implementation predates plugins, object IDs, and the IOM which is why it lacks features).
Exactly. Any idea on a timeline for the new REST API? Think I might stick with the manual table for now and wait for the API but will investigate automating it if I run out of other indigo tasks to do.


Sent from my iPhone using Tapatalk
User avatar
matt (support)
Site Admin
Posts: 21542
Joined: Mon Jan 27, 2003 1:17 pm
Location: Texas
Contact:

Re: indigo utilities discussion

Post by matt (support) »

siclark wrote:Exactly. Any idea on a timeline for the new REST API? Think I might stick with the manual table for now and wait for the API but will investigate automating it if I run out of other indigo tasks to do.
We don't like to give time estimates / ETAs, but it is a high priority item.
Image
Post Reply

Return to “Indigo Utilities”