more G-Labs products

Author Topic: Graphs on HomeGenie - Historical data?  (Read 2221 times)

January 22, 2015, 08:51:32 AM
Read 2221 times

xefil

  • **
  • Information
  • Jr. Member
  • Posts: 31

Good morning to all,

Under the Analyze Page I can see my graphs.
I would like to know if I can change the timerange and the zoom, i.e. look on the past data or see a week overview. On my new graphs I see: From: Thu, Jan 15 2015 1:17 AM    To: Thu, Jan 22 2015 8:47 AM    (7d 7h 33m ) also I have at least 7 days data, but only the last hours are shown.
Is it possible?

Then, some background questions.
Where are these data stored?

Would bo possible to manually export/import data to, i.e., import old values?

Thanks a lot!

Simon

January 24, 2015, 11:01:52 PM
Reply #1

hybridview

  • **
  • Information
  • Jr. Member
  • Posts: 37
The stats are stored in a simple sqllite db file called homegenie_stats.db. I use a free program to open the database and pull data for spreadsheets, etc.Link is below.
http://sqlitebrowser.org/
 The DB is wiped out by HG once it hits 10MB, so archive it before then. The DB wipe was probably added to HG to protect RasPI devices with low memory.

WARNING: Make a copy of the DB and open the copy. If you open the db that is in use, HG will have a problem and stop writing to it until you restart it.

I suppose it wouldn't be hard to add export functionality to HG that outputs a CSV file. Might be worth requesting.

January 25, 2015, 03:07:15 AM
Reply #2

xefil

  • **
  • Information
  • Jr. Member
  • Posts: 31
Hello hybridview,

Thanks for your answer. I'll look there soon to play a little with the DB.

Bye, Simon

January 30, 2015, 08:31:31 PM
Reply #3

psyctto

  • *
  • Information
  • Newbie
  • Posts: 9
hybridview/xefil,
I posted in the help section about using MySQL in a c# sharp script... but haven't heard anything back.  I'd much rather be using my database, but for the short-term I just wrote a simple script to log data to a csv file that I display and do some things with via perl scripts after that.
It logs power and outside temp every 20 seconds to a file, make sure you use the try/catch at this rate otherwise you'll have issues with the file being in use.  I do the same with a multisensor inside the coop, that one logs every 15 minutes, the file system is much happier at this rate.  The multisensor I did have to also add a line to automatically grab the node info from the multisensor, since it seemed to stop communicating after about an hour once I moved it to the coop...  Manually querying the node info would make it work again, not sure if it's distance or temperature out there.  It is on AC power, and responds to node id query, so it'd not sleeping.  Who knows, I've had these issues with industrial hardware before too though.
I did move my cat water fountain switch outside to monitor/control the power going to my chicken coop (for the heated waterers over the winter).  that's why the names...

"
//Get outside temperature from weather module
var weatherModule = Modules.WithName("Weather Underground").Get();
var outsideTemp = weatherModule.Parameter("Conditions.TemperatureF").Value;

//Read and save Coop Power (catWaterFountain) values
var catWaterFountain = Modules.WithName("Cat Water Fountain").Get();
var wattage = catWaterFountain.Parameter("Meter.Watts").DecimalValue;
var level = catWaterFountain.Parameter("Status.Level").DecimalValue*100;
//Program.Notify("Cat Water Fountain", outsideTemp+"F "+level+"% "+wattage+"W");

try
{     
   using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"/var/house/chickenCoopPower", true))
   {
      file.WriteLine(DateTime.Now.ToString("yyyyMMdd HH:mm:ss")+","+outsideTemp+","+level+","+wattage);
   }   
}
catch
{
     Program.Notify("chickenCoopPower", "File in use. Will try again in 20s.");
}
"

April 07, 2015, 12:57:38 PM
Reply #4

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
I am trying to use the graph / charts on the analyze page.  It seems to show some data but I don't understand it all the lines it is showing.  What are min max and average mean when there is only one data point logged at any given time?  Is it min/max/average for the past day, or past hour? 

Is there an esay way to adjust the chart min and max range (example: I'd like 0 at bottom and 100 at top for duty cycle of my sump pump).

How do I get a small chart on my dashboard as a widget?

April 17, 2015, 05:45:51 PM
Reply #5

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
Thought I would reply to myself for the benefit of other newbies... now that I understand how the graphs work.

HG Analyze Graphs always show the current day midnight to midnight (say midnight to 11:59pm)across the X axis.  The date selectors will not change the X axis range.  The date selectors change how previous days data is viewed. 

Today's data is shown with red line.  Previous days data are shown with the vertical bars which show the min/max/average of the time period selected.

Seems so obvious now :-)

I do like how it works (perfect for data that repeats on daily cycle), but I would a few options if possible on future versions:

-allow the X-axis to use the date selectors (via some option?).  For some data, seeing multiple days makes more sense. I am monitoring my sump pump which is directly related to rainfall (which is not daily, thankfully :-)

-allow multiple lines (series) on one chart, or stack a couple charts on one page.  Again for my data, it would be nice to see how the rain affects my sump pump cycles over several days)

-show the Y axis values (currently you have to hover over data points in the graph to find what scale you are looking at)

Thanks!

BTW - these forums have been very quiet lately... anybody out there?