Did Something happen to statesSince

I am debugging some emerging issues with Hubigraphs. When I used to do a call to statesSince, it would return a set of state events upto ~1024. Now, I get ~32. I have checked the device data and it appears to be there, the function is just not returning the amount of data I expect.

Did something change?

Could it be due to the significant decrease in number of events being saved for each device's attribute in a recent update?

image

No; even set much higher I see the same return...

You should ensure you know how many states you have now for a variable.

The hub is doing a couple of trimming

  • by default 100 per event attribute
  • I think I heard it is killing anything older than 7 days also

I think you can play with the first one, but not the 2nd one. @gopher.ny can confirm.

Yes, the number of points in device state history has been trimmed. The call is unchanged, but the number of underlying data points retained is smaller.
I'll add a state history size, similar to event history size, to the next beta. Default is going to stand where it is for performance reasons, but user will be able to override it for a given device.

2 Likes

Thanks Vic. I'm confused, Mike & Bruce have long said the hub has way more power/storage than it actually uses, yet the events were trimmed for performance. I love having longer event histories, too bad there wasn't a switch or selector where we could choose small, medium or large.
Any easy way to export the device history/logs to local PC?

Thank you

2 Likes

Hey-so.

I see the new options for "Event History Size" and "State History Size"--but I don't know where I can go to see those events/states.

And, I'm not sure what the impacts are on changing them (other than bigger is probably "discouraged".)

As such, I went through and pruned most of mine to 20/10, my door sensors to 50/20, and only my key things to 100/50.

I'm curious what this might impact good (and especially bad). And, a loose idea what they even are.

Thanks!

Starting with 2.2.3.138 - currently in beta - there's a per device setting, just as rob9 pointed out. Default setting is 30, which is pretty small, and is enough if an app is looking at the last few values. If longer history is needed, such as with graphs, max value is 2000.
I've been looking at some databases, and there were instances with almost a million device state entries. Any time device state changes, H2 has to modify indexes. As long as it fits the entire thing in memory cache, it's pretty fast about it. As table grows, there is no threshold where it gets slow all of a sudden, it's a gradual change. Per-device history size setting is there so that a user can keep important history if he/she wishes so.

3 Likes

Compared to 2.2.3.118's default of 30, I don't think you will notice an impact at all. Compared to the previous default of 2000, it would speed things up considerably.

2 Likes

Thanks for putting this in; I have to put in my agreement that the change has been great overall for the hub. Graphs that might take minutes to load, now do so in seconds....

Putting some feedback on Beta thread

DAM! so it appears prior the size was pretty much unlimited? I can understand how that would slow things down.

1 Like

So. Although this state information is available for apps, I'm not seeing how I can find it through the native interface.

I would think I should be able to click on something under the "Device" page to bring up a device's past history (without having to write an app--as I'd think most people would have a general desire to check back on a device). Having the list of all device states/events under "System Events" would also be useful.

Am I missing something?