Persistence strategy respecting a threshold

as usual, Rich is head on nail! :wink:
one thing you to keep in mind, if you want to persist only with a threshold is how to avoid not persisting anything at all. Letā€™s just assume, that your temperature is inertial and just stays under the threshold, but over the day, this cold then add up to a significant change, so you have to add that behaviour to your rule also. Since you donā€™t want to use persistence, you canā€™t use the cool ā€œaverageSinceā€ with an item, so you must find other persistences to check, if an item changed since more than one interval.

I would go with a ā€œcompactingā€ function within the persistence - or just delete old values, if you wonā€™t need them. I for myself also persist all my sensors (>150, if I count them correctly) within MySQL in my case. As my MySQL grew also big, I just added a stored procedure as described here: ā€œGarbage Collectionā€ on MySQL persistence: deleting old Item states. If i had some more time (and ran out of space with my DB), Iā€™d like to come up either with a migration to InfluxDB or some stored procedure which would compact my data in junks of some hourlong intervals or something - I donā€™t knowā€¦ But for the time being, I have around 500 items in my MySQL-Database running for approx. a year now and the size is 216,12 MB right now.

1 Like