The Energy Detective Support Forum
September 02, 2010, 01:10:49 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Please read the new Forum Guidelines
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: TED_PHP  (Read 177 times)
PhragMunkee
Member
*
Posts: 25


« on: July 22, 2010, 11:55:33 PM »

I built a quick little PHP class that should hopefully make using the API data with PHP a little easier.  All you have to do is configure your settings and then call the class.  It's pretty minimal at the moment, but I plan on using it for a bunch of personal ideas.  I figured if it's good enough for me to use, it may be good for someone else.

http://github.com/wgbartley/TED_PHP

Enjoy!
« Last Edit: July 23, 2010, 12:16:38 AM by PhragMunkee » Logged
jpf321
Member
*
Posts: 48


« Reply #1 on: July 23, 2010, 09:49:31 AM »

Hey thanks for that .. looks good .. won't be able to play with it until next week. I see that your raw decode of voltage is 20x. That's what I found too.

Logged
PhragMunkee
Member
*
Posts: 25


« Reply #2 on: July 23, 2010, 10:11:54 AM »

I see that your raw decode of voltage is 20x. That's what I found too.
I saw that in one of the other forum postings.  There are some inconsistencies with all the raw data stuff that threw me for a loop, but I'm fairly confident that I got them all worked out.  I'll probably play around with some sample scripts to integrate the TED_PHP stuff and will either upload them as sample scripts as part of the TED_PHP release or, depending on complexity, as another project.

Here are a few ideas I had:
 - Twitter bot
 - Cacti integration (I saw a post that was started but no released code)
 - iPhone/Android (Webkit) web interface (well, actually, this would rely on the XML and store all user settings in a local database on their device)
Logged
jpf321
Member
*
Posts: 48


« Reply #3 on: July 23, 2010, 10:27:00 AM »

I'd be most interested in a MySQL extension, or at least an insert row function. But thanks for your efforts thus far!
Logged
PhragMunkee
Member
*
Posts: 25


« Reply #4 on: July 23, 2010, 10:39:52 AM »

I'd be most interested in a MySQL extension, or at least an insert row function. But thanks for your efforts thus far!
That would be pretty easy, actually.  What sort of uses did you have in mind for the MySQL?  A straight-up insert for all the different histories would be easy, but could fill up a database pretty quick.  Would probably also have to go easy on the gateway and only run updates every minute at most.  I noticed as I was testing that several calls in a row would really slow it down.  I haven't done any real benchmark testing, but I would think updating the second and minute data every 5 minutes, hourly data once an hour, daily data a few minutes after midnight, and monthly data just after midnight on the first of each month.

I've only had it installed for 3 days now, but I think I'm addicted.  I'm a bit of a data and integration junkie if you couldn't tell.
Logged
jpf321
Member
*
Posts: 48


« Reply #5 on: July 23, 2010, 11:31:14 AM »

yep .. inserts of the different hists .. i think I would run secs every 30mins. with "INSERT...IGNORE" and a COUNT of just over the 30mins worth of seconds. similarly the mins. I probably would not put in other hists. since everything is able to be derived from secs and/or mins.. in fact i'd probably just fall back on mins if I found that seconds was too much data.

as I mentioned in another thread .. would be cool to replicate the functionality of www.energylens.com .. since they seem to have some pretty cool tools. but the best it will take is 5-min data .. easy to do with a good SQL query.

i'm on my way out for the weekend .. be back up on Sunday night.

jpf
Logged
PhragMunkee
Member
*
Posts: 25


« Reply #6 on: July 23, 2010, 09:36:51 PM »

I've added the sample scripts to INSERT second and minute history data into a MySQL database.

http://github.com/wgbartley/TED_PHP/tree/master/samples/mysql-insert/

Enjoy!
Logged
jpf321
Member
*
Posts: 48


« Reply #7 on: July 25, 2010, 10:50:02 PM »

Hey this rocks .. and you certainly put some extra thought into it!

Too bad I'm a few steps closer to throwing in the towel on TED. I suffered several multi-hour outages with PLC today.
Logged
PhragMunkee
Member
*
Posts: 25


« Reply #8 on: July 26, 2010, 02:59:13 PM »

I got a script for Cacti up and running.  I am by no means a Cacti guru, and getting this working on my own setup really pushed my patience!  It's up and running for me, but your milage may vary.

http://github.com/wgbartley/TED_PHP/tree/master/samples/cacti/
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!