more G-Labs products

Author Topic: Statistics.History[X] is broken  (Read 1783 times)

September 26, 2015, 07:52:32 PM
Read 1783 times

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
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
« Last Edit: September 26, 2015, 09:24:01 PM by bkenobi »

September 29, 2015, 12:50:22 AM
Reply #1

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
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.

September 29, 2015, 06:20:25 AM
Reply #2

nolio

  • *****
  • Information
  • Global Moderator
  • Posts: 544
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 ?

September 29, 2015, 07:23:02 AM
Reply #3

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
Advanced Smart Lights is extended from Gene's Smart Lights code.

October 04, 2015, 11:29:49 PM
Reply #4

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
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.

October 06, 2015, 04:36:44 PM
Reply #5

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
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.