# HG changeset patch # User drewp # Date 1523792460 25200 # Node ID e4f49cd9dda3340efbd4c227de44c599b0c1c4c7 # Parent 6d2eba4d0dfd0897f5a937ba2b193ef8dc6e3085 add :pointsAtLeastEvery control Ignore-this: 9d0236b56b2a7592211ca68b87b4a5d1 darcs-hash:76e4d358cb6b039351c9b6f8e3bb825aaaefcc57 diff -r 6d2eba4d0dfd -r e4f49cd9dda3 lib/export_to_influxdb.py --- a/lib/export_to_influxdb.py Sun Apr 15 04:18:11 2018 -0700 +++ b/lib/export_to_influxdb.py Sun Apr 15 04:41:00 2018 -0700 @@ -31,9 +31,12 @@ tags[k] = graph.value(t, ROOM['value']).toPython() value = self.influxValue(stmt[2]) + pale = 3600 + if graph.value(meas, ROOM['pointsAtLeastEvery'], default=None): + pale = graph.value(meas, ROOM['pointsAtLeastEvery']).toPython() if not self.shouldSendNewPoint(now, stmt[0], measurementName, - tags, value): + tags, value, pointsAtLeastEvery=pale): continue points.append({ @@ -57,11 +60,11 @@ raise NotImplementedError('value=%r' % value) return value - def shouldSendNewPoint(self, now, subj, measurementName, tags, value): + def shouldSendNewPoint(self, now, subj, measurementName, tags, value, pointsAtLeastEvery): key = (subj, measurementName, tuple(sorted(tags.items()))) if key in self.lastSent: lastTime, lastValue = self.lastSent[key] - if lastValue == value and lastTime > now - 3600: + if lastValue == value and lastTime > now - pointsAtLeastEvery: log.debug('skip influx point %r', key) return False diff -r 6d2eba4d0dfd -r e4f49cd9dda3 service/piNode/config/kitchen.n3 --- a/service/piNode/config/kitchen.n3 Sun Apr 15 04:18:11 2018 -0700 +++ b/service/piNode/config/kitchen.n3 Sun Apr 15 04:41:00 2018 -0700 @@ -28,6 +28,7 @@ :influxMeasurement [ :measurement "temperatureF"; :predicate :temperatureF; + :pointsAtLeastEvery 10; :tag [:key "host"; :value "kitchen"], [:key "location"; :value "kitchenCounter"]], [ :measurement "humidity"; :predicate :humidity;