REST api to access SQL?

Posted on
Tue Feb 09, 2016 3:10 am
moyse offline
Posts: 39
Joined: Apr 14, 2014

REST api to access SQL?

Specifically, I want to plot the historical temperature values etc.

Is there any way to do this? I started to write a django app, but thought perhaps I should ask first!

Posted on
Fri Feb 19, 2016 7:15 am
DaveL17 offline
User avatar
Posts: 5909
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: REST api to access SQL?

Somehow, I missed your question.

I'm not sure about using REST to do what you suggest, but here's my workaround. I have a script that runs in Indigo every 15 minutes which saves select data to a CSV file and then fires Gnuplot scripts to create PNG charts. I run another script (daily) which prunes the CSV file to length to ensure that it doesn't grow too large (with the exception of weather data, my range is three days' worth.) I've been very happy with this approach.

Recent versions of my scripts are on the forums and can be found in my developer thread here: http://forums.indigodomo.com/viewforum.php?f=148

Here's a couple examples of the output:
temperaturesOutdoor.png
temperaturesOutdoor.png (15.24 KiB) Viewed 1347 times

10DayForecast.png
10DayForecast.png (14.64 KiB) Viewed 1347 times

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Fri Feb 19, 2016 7:57 am
kw123 offline
User avatar
Posts: 7695
Joined: May 12, 2013
Location: Dallas, TX

Re: REST api to access SQL?

As Dave mentioned there are many ways to do this
There are the gnu plot, mat plot indigoplotd etc solutions
But getting a this through the restful api is a nice challenge
I might consider this once I am done with my pibeacon plugin.


Sent from my iPhone using Tapatalk

Posted on
Mon May 02, 2016 1:31 pm
moyse offline
Posts: 39
Joined: Apr 14, 2014

Re: REST api to access SQL?

Hi all,

Yes, I've used indigoplotd Karl - thanks very much! For a few reasons it's not exactly what I want though. Ditto for Dave (thanks too!) I want something I can use with a responsive frontend (I'm teaching myself React.js).

I've now got more wrapper more-or-less working as I want and so I've uploaded it to pypi: https://pypi.python.org/pypi?:action=display&name=django-indigorestwrapper&version=0.6 and github https://github.com/EdwardMoyse/django-indigorestwrapper just in case it could be of use to anyone else.

You can do things like:
- get a list of devices (with more info than the equivalent from Indigo)
- get complete information about a device, using the device id (i.e. instead of using the name as in indigo)
- get the history of the device.

Another benefit (for me) is you have a lot more flexibility in the authentication schemes you can use (I'm using token based myself, but you can use anything which is provided by or for django-rest-framework: http://www.django-rest-framework.org/ap ... ntication/)

There's a lot more in the documentation, but the sort of things it lets you do are e.g. show the temperature of a sensor (this is a react frontend I'm working on, so it's all dynamic)

Temperature.png
Temperature.png (213.34 KiB) Viewed 1264 times


Anyway, I hope it might be of use to someone else - and if it would help to add functionality, let me know. I think most of the hard work is done now.

Posted on
Mon May 02, 2016 1:52 pm
DaveL17 offline
User avatar
Posts: 5909
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: REST api to access SQL?

That's pretty cool! Nice work.


Sent from my iPhone using Tapatalk

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest