-
Notifications
You must be signed in to change notification settings - Fork 91
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
Database plugin - feature request: Only write to DB on minimal change #285
Comments
Would be a nice feature indeed. I'd suggest one global "threshold" defined in the plugin.yaml (default: 0) and the possibility to overwrite it for each item individually. |
That's not a simple request. If the next value would be 24.1 again, all is fine, but what if not? If the next value would be 25.0, is would be written to the database, but the value 24.2 would be lost completely What to do If the next value would be 24.3?
Another problem would be, that the item value and the database value would differ. My question is: Wouldn't it be better to handle the wobbling in the plugin that receives the data? |
As far as I understood smai he'd need a precise value in shng in general but not necessarily in the "log" of the database. Meaning it should/could be integrated in the db plugin. I guess when you can configure the threshold for items individually it would be totally fine when some values are not written at all, wobbling or not. meaning 24.1 is written and the current value is checked against that value. 24.2 gets ignored and forgotten but 24.3 is written again. It's more or less some "precision" attribute that you can set for items. the other option would be to really "just" prevent wobbling meaning the plugin would need to remember 24.2 and the timestamp and write that into the db as soon as the next value is not 24.1 again. Not sure if that's the main usecase. |
To prvent wobbling, someone would have to come up with a global definition. Otherwise 10 people have 12 ideas what wobbling is for them and the database plugin has to be changed over and over. (That is, why I would prefer not to implement wobbling-prevention in the database plugin but have users in need of wobbling-prevention implement it in the plugin creating the data or in a logic. Is Wobbling:
|
Maybe wobbling is a special issue indeed that should be handled somewhere else. Example like above, based on an attribute "database_threshold: 0.2" or similiar: That makes the plugins work as usual but limits db entries. Maybe at shutdown the current value should be written regardless. |
I give you an example why "simple" threshold is not a good idea. Here is an example similar to the one you gave: Example based on an attribute "database_threshold: 0.2" or similiar: |
Comparison has to be made with the last entry in db. |
But to check that, it would imply a database read for every item change... |
or keep the value in memory (dict in the plugin). No idea if that is a good idea concerning resources |
This issue has been moved to the plugin repo: smarthomeNG/plugins#564 |
To reduce superfluous data it would be nice if logging of values to the database could be prevented if not a minimal difference to the last logged value is reached.
Use cases:
Unfortunately not every sending device allows to prevent this.
The text was updated successfully, but these errors were encountered: