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

[Feature Request]: Only add entries to db if current or power non-zero or if total changes #345

Open
puterboy opened this issue Feb 4, 2024 · 4 comments
Labels
enhancement New feature or request solved workaround documented or fix applied
Milestone

Comments

@puterboy
Copy link

puterboy commented Feb 4, 2024

The energy_data.db continues to grow with new entries even if current=0, power=0 and total is unchanged.
The only thing of note being recorded is the voltage which is not very relevant to Octoprint in general.

To avoid database bloat when printer is not even on but Octoprint is running, I would suggest that such unchanged entries not be added to the database.

Not a big deal... just a suggestion to avoid unnecessary data storage...

@puterboy puterboy added the enhancement New feature or request label Feb 4, 2024
@jneilliii
Copy link
Owner

Don't poll status all the time and only poll during print progress and that will result in a less bloated db. I was curious and looked at my instance and I'm polling every minute, it was installed a very long time ago and still is only 720mb so feel this to be a fairly low priority. I am open to any PR that implements this change though.

@puterboy
Copy link
Author

puterboy commented Feb 7, 2024

Mine polls more frequently when printing but continues to poll exactly every 5 minutes even after printing and even when the TPLink switch (and printer) are off.
My file is 2MB after one month.

BTW, I think it's good to continue polling after printing since there is electricity usage if you just leave the printer and switch on -- and that is good to track. Just saying that one needn't record entries with no power change.

I can look at the code when I get a chance and will see what I can come up with...

@puterboy
Copy link
Author

puterboy commented Feb 8, 2024

I just made this and the other fixes to db on related issues and will share a PR soon.

One NICE benefit of only recording changes to the total is that the display for multi-date ranges is now MUCH faster since there are no points spanning down towns. This is really helpful since it used to take forever to load hundreds of thousands of points...

@puterboy
Copy link
Author

puterboy commented Feb 8, 2024

I liberalized the selection algorithm from my origional conception so it only records data when, EITHER:

  • Power > 0 (so this captures all time power is being consumed
  • Total changes (so this catches all increments in energy used)
  • Power returns to 0 for the first time - this shows when the power actually turned off (and is nice for graphs I suppose)

This would let one monitor even low power consumptions such as when printer is on but not heating and it may not be consuming enough power to increment the total energy...

Equivalently, I leave off all times when power is stuck at zero and total usage has not incremented.

@jneilliii jneilliii added the solved workaround documented or fix applied label Mar 3, 2024
@jneilliii jneilliii added this to the 1.0.4 milestone Mar 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request solved workaround documented or fix applied
Projects
None yet
Development

No branches or pull requests

2 participants