agrif / OctoPrint-InfluxDB

Writes temperatures and events to an Influx database.
GNU Affero General Public License v3.0
24 stars 15 forks source link

Improvement: Only send datapoint when data changed #18

Open plampix opened 4 years ago

plampix commented 4 years ago

Hi,

Thanks for this great plugin, it helped me debug an issue with my thermistor (sometimes reported a too low temp, caused a smoke alarm to go off).

I'd like to keep reporting every 5s, but when my printer is not in use (and still turned on), I get lots of datapoints that all have the same value, and don't actually matter. What about caching the previously sent data, compare it, and only send it if it's changed?

I don't know a lot of python (yet), but this is rather easy. I'll look into it myself, this issue is just to discuss my request.

agrif commented 4 years ago

This would probably be easy to do, but I'm not sure it should be done. I guess it's a trade-off between knowing when data collection is happening versus storage space.

I think it should probably be an optional checkbox in the settings -- but it might be more appropriate for some measurements than others, and letting that be configurable would be a sort of nightmare. I'll have to think about this. A global "do not write duplicate points" checkbox might be enough.

In the meantime, by all means feel free to open a PR. We can workshop from there!