Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

statistics.history array is broken #228

Closed
bkenobi opened this issue Sep 26, 2015 · 14 comments
Closed

statistics.history array is broken #228

bkenobi opened this issue Sep 26, 2015 · 14 comments

Comments

@bkenobi
Copy link

bkenobi commented Sep 26, 2015

As reported in this thread:
http://www.homegenie.it/forum/index.php?topic=1101.0

The history array only holds the first element and all others seem to be invalid. HistoryLimit is not set other than by default.

@bkenobi
Copy link
Author

bkenobi commented Oct 4, 2015

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.

e34249b#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.

@bkenobi
Copy link
Author

bkenobi commented Oct 6, 2015

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.

@dansantee
Copy link
Contributor

I'm having a similar problem which may be related - LastOn and LastOff values do not seem to work correctly. For example, if I turn a device on, then off, then on again (in code or interface), the values for LastOn and LastOff do not update correctly, and instead give old values.

genemars added a commit that referenced this issue Oct 10, 2015
- Enhanced parameter statistics now holding up to 1 day of history (HistoryLimit is now expressed in minutes)
- Fixed duplicated event raising causing also issues with History/Statistics (#228)
- Added new API command /api/HomeAutomation.HomeGenie/Config/Modules.StatisticsGet/<domain>/<address>/<parameter>
- Added new API command /api/HomeAutomation.HomeGenie/Config/Modules.ParameterGet/<domain>/<address>/<parameter> (should close issue #206)
- Optimized SSE
@genemars
Copy link
Member

please try r497 hope it is fixed now!

@genemars
Copy link
Member

oh-oh... it still needs a little fix... gonna do now

@genemars
Copy link
Member

it's fixed now. for testing you can try calling the new API command

/api/HomeAutomation.HomeGenie/Config/Modules.StatisticsGet/<domain>/<address>/<parameter>

eg. http://10.10.5.7/api/HomeAutomation.HomeGenie/Config/Modules.StatisticsGet/HomeAutomation.PhilipsHue/1/Status.Level

{
  "HistoryLimit": 1440,
  "History": [
    {
      "Value": 0.8,
      "Timestamp": "2015-10-10T16:04:21.187622Z",
      "UnixTimestamp": 1444493061187.6221
    },
    {
      "Value": 0.0,
      "Timestamp": "2015-10-10T15:39:09.578046Z",
      "UnixTimestamp": 1444491549578.0461
    },
    {
      "Value": 0.8,
      "Timestamp": "2015-10-10T15:38:38.088862Z",
      "UnixTimestamp": 1444491518088.8621
    },
    {
      "Value": 0.0,
      "Timestamp": "2015-10-10T15:37:41.017358Z",
      "UnixTimestamp": 1444491461017.3582
    },
    {
      "Value": 0.0,
      "Timestamp": "2015-10-10T15:37:41.01737Z",
      "UnixTimestamp": 1444491461017.37
    }
  ],
  "Current": {
    "Value": 0.8,
    "Timestamp": "2015-10-10T16:04:21.187622Z",
    "UnixTimestamp": 1444493061187.6221
  },
  "Last": {
    "Value": 0.0,
    "Timestamp": "2015-10-10T15:39:09.578046Z",
    "UnixTimestamp": 1444491549578.0461
  },
  "LastOn": {
    "Value": 0.8,
    "Timestamp": "2015-10-10T16:04:21.187622Z",
    "UnixTimestamp": 1444493061187.6221
  },
  "LastOff": {
    "Value": 0.0,
    "Timestamp": "2015-10-10T15:39:09.578046Z",
    "UnixTimestamp": 1444491549578.0461
  }
}

@bkenobi
Copy link
Author

bkenobi commented Oct 10, 2015

I'm away from my system but will update tomorrow or Monday. If a web update were released, I could try this afternoon.

@genemars
Copy link
Member

a web update will be available as soon as the latest release can be considered stable (almost :)).

@noliono
Copy link
Contributor

noliono commented Oct 10, 2015

It work fine on my side on 1.1 r497.
Thanks Gene.

@bkenobi
Copy link
Author

bkenobi commented Oct 11, 2015

My house lost power and the IP must have changed. My IP change notification APP doesn't email anymore, so I'll have to update when I get home and find the new IP.

@bkenobi
Copy link
Author

bkenobi commented Oct 12, 2015

Looks like the fix worked for the Advanced Smart Lights APP.

@genemars
Copy link
Member

good, close the issue if your testing is complete and positive.

@bkenobi
Copy link
Author

bkenobi commented Oct 12, 2015

I have an issue with severe lag on my setup that is likely unrelated. I will do some testing to verify that it is unrelated to the HG update. I believe it is related to a power failure that may have caused a module or other electronic to go bad. I will close the issue when I confirm it is not related to HG.

@bkenobi
Copy link
Author

bkenobi commented Oct 13, 2015

I confirmed that the code works.

My issue with large delays seems to be unrelated. Issue closed.

@bkenobi bkenobi closed this as completed Oct 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants