HomeGenie Forum

Development => Feature request => Topic started by: kevin1 on February 29, 2016, 01:46:49 PM

Title: Statistics feature requests
Post by: kevin1 on February 29, 2016, 01:46:49 PM
Statistics feature requests:

-remember which options I prefer so I don't have to re-select them every time: compare all, temp, days, from 7 days ago, to today

-allow two parameters to be viewed on one chart (one would use left Y axis the other right Y axis), or small chart below a bigger chart

-implement 'delete value' - there seems to be partial implementation but it doesn't actually delete value from stats.  This would be nice to get my coding mistakes out of the statistics database (I have a temp=150 throwing off the chart range)

Title: Re: Statistics feature requests
Post by: bkenobi on February 29, 2016, 05:08:01 PM
Definitely would be nice to delete a value!  If a sensor throws a ridiculously wrong value, the range is broken.  I have one sensor that is currently sending -50F all the time so my temperature values are useless because of it.  I could purge the whole database, but I don't really want that either.  The only thing I can think of doing to fix it currently is installing a database editor and manually removing that single value.
Title: Re: Statistics feature requests
Post by: dani on February 29, 2016, 10:13:27 PM
When you sélect Days range it's possible to delete a selected value. I have add that in statistics a few months  ago.
Title: Re: Statistics feature requests
Post by: bkenobi on February 29, 2016, 11:48:17 PM
I know you can select a single value, but didn't realize you could then delete it.  Awesome!
Title: Re: Statistics feature requests
Post by: kevin1 on March 01, 2016, 02:48:53 AM
When you sélect Days range it's possible to delete a selected value. I have add that in statistics a few months  ago.

Dani - I see the delete value popup by the date, but when i click it nothing happens.
Title: Re: Statistics feature requests
Post by: bkenobi on March 01, 2016, 04:41:40 PM
I just tried to use the delete value command.  I believe it did work before such that when you select the button, it would pop up a new window to confirm deletion.  It did not do that this time and the value did not get removed.  I refreshed the data and it was still there.
Title: Re: Statistics feature requests
Post by: dani on March 02, 2016, 08:39:28 AM
Hi bkenobi,
Can you get a log of the delete API sent by HG UI. And then perform it in the browser, you get the SQL Delete Command in Response. To look if it's correct ?

Yes I don't refresh the stats screen after each delete.
Title: Re: Statistics feature requests
Post by: bkenobi on March 02, 2016, 07:14:43 PM
I can do that this evening.  Do you happen to know the correct syntax for the api command?  I assume I'd need to get the element ID by selecting the item I want to delete in the statistics view.
Title: Re: Statistics feature requests
Post by: bkenobi on March 03, 2016, 04:32:48 AM
This is what the log shows when I select delete on the item in the web UI.
Code: [Select]
2016-03-02 19:28:51.7027 Info WebServiceGateway 192.168.0.5 HTTP GET 200 /api/HomeAutomation.HomeGenie/Statistics/Parameter.StatDelete/1454221391413.78/0 [OPEN]
2016-03-02 19:28:52.3009 Info WebServiceGateway 192.168.0.5 HTTP GET 200 /api/HomeAutomation.HomeGenie/Statistics/Parameter.StatDelete/1454221391413.78/0 [CLOSED AFTER 0.598 seconds]

Using the API command from the above debug:
Code: [Select]
[[Response,DELETE FROM ValuesHist WHERE (TimeStart BETWEEN '6578-03-30 22:39:01' AND '6578-03-30 22:39:01.999999')]]
Title: Re: Statistics feature requests
Post by: dani on March 03, 2016, 10:31:39 AM
Hi bkenobi,

Why your date is 30 Mars in 6578 ?
That works on RPI. Your HG run under Linux or Windows ?
If I call my RPI with you API command :
Code: [Select]
192.168.1.xxx/api/HomeAutomation.HomeGenie/Statistics/Parameter.StatDelete/1454221391413.78/0I get that response :
Code: [Select]
[[Response,DELETE FROM ValuesHist WHERE (TimeStart BETWEEN '2016-01-31 05:23:11' AND '2016-01-31 05:23:11.999999')]]I suppose the date of you delete try is on 31 January 2016
In HG UI the statistics date are passed as a double value
Title: Re: Statistics feature requests
Post by: bkenobi on March 03, 2016, 04:21:37 PM
I'm on RPi and the data for the OS *should* be correct since all the debug logs show the right time.  I didn't notice that the request was for a date in 4000+ years.  Obviously that would be an issue.  I simply copy/pasted what HG output so I can't explain why it responded that way.
Title: Re: Statistics feature requests
Post by: bkenobi on March 03, 2016, 04:40:36 PM
I also noticed that the date is completely wrong too.  The correct time/date for the point I want deleted is 1/31/16 6:33:23 AM.  I don't know what format the string in the StatDelete call is in, otherwise I'd try to verify what time it's actually asking for.  Your response is actually off by an hour from what I need as well.  I'm not sure what's going on, but this doesn't seem like it's working per design.