HomeGenie Forum

Development => Bug reporting => Topic started by: bkenobi on September 26, 2015, 07:52:32 PM

Title: Statistics.History[X] is broken
Post by: bkenobi on September 26, 2015, 07:52:32 PM
It appears that the latest release (r496) has an issue with the history[X] array.  I am not setting HistoryLimit value so it is still the default value 10.  I can print the first element (history[0].Value), but all others are not present.  I posted about this in the Advanced Smart Lights thread, but thought it might be better to have it's own bug thread.  I will post an issue on GitHub for this.

https://github.com/genielabs/HomeGenie/issues/228
Title: Re: Statistics.History[X] is broken
Post by: bkenobi on September 29, 2015, 12:50:22 AM
I did a bit more testing this weekend and found that the issue goes beyond the History[X] parameter.  It appears that any time I try to calculate a time span I have an issue.  I have not checked that the original Smart Lights code is functioning as designed to this point.  My code is based on Gene's work, so if his works I will have to see what I'm doing differently.  I believe I am using the same approach, so I expect the original code to have problems as well.
Title: Re: Statistics.History[X] is broken
Post by: nolio on September 29, 2015, 06:20:25 AM
My code is based on Gene's work, so if his works I will have to see what I'm doing differently.  I believe I am using the same approach, so I expect the original code to have problems as well.
Which code did you speak about ?
Title: Re: Statistics.History[X] is broken
Post by: bkenobi on September 29, 2015, 07:23:02 AM
Advanced Smart Lights is extended from Gene's Smart Lights code.
Title: Re: Statistics.History[X] is broken
Post by: bkenobi on October 04, 2015, 11:29:49 PM
It looks like there was a recent change to how the historyValues array is defined.  I don't know that this is the issue for sure, but it certainly is suspicious to me.

https://github.com/genielabs/HomeGenie/commit/e34249b24333d6517af148d488c08d347da5084c#diff-d92ebc3e06276c231a9e2cfbb19fb07cL47

I see that the initialization is performed a few lines down, but for some reason historyValues array only contains one value for me.
Title: Re: Statistics.History[X] is broken
Post by: bkenobi on October 06, 2015, 04:36:44 PM
I built a test program to see if timers work at all using DateTime.Now and TimeSpan functions with a simple 1 minute offset.  That still functions.  The Advanced Smart Lights code doesn't do anything more complicated other than storing the timestamp in a module parameter and utilizing the HistoryValue array.  Since I've looked at the parameter value and can confirm that it's set to a value that seems appropriate and I have seen that the values within HistoryValue above element 0 do not exist, I believe I have narrowed this down.  However, I have no way to fix it.  I guess I'll just migrate back to r493 or earlier so that I can get my system working.  It looks like there are a number of people using my APP as well, so I'll recommend in that thread that they migrate back/don't update until a resolution is found.