# HG changeset patch # User drewp # Date 1474013772 25200 # Node ID 6ee834a6f9709e63561edcc4630050cda711fde4 # Parent 77f6117e002f230a3b8ca133563974e0e6903f56 influx output for arduino, update web lib path Ignore-this: 76b7fb15db86563ed3fa1ec5322b918c darcs-hash:98a4e100e4951c3260bf5d713e2fa079b24af338 diff -r 77f6117e002f -r 6ee834a6f970 service/arduinoNode/arduinoNode.py --- a/service/arduinoNode/arduinoNode.py Fri Sep 16 00:55:04 2016 -0700 +++ b/service/arduinoNode/arduinoNode.py Fri Sep 16 01:16:12 2016 -0700 @@ -160,8 +160,10 @@ if elapsed > 1.0: log.warn('poll took %.1f seconds' % elapsed) - self._influx.exportToInflux( - set.union([set(v) for v in self._statementsFromInputs.values()])) + stmts = set() + for v in self._statementsFromInputs.values(): + stmts.update(v) + self._influx.exportToInflux(stmts) def _sendOneshot(self, oneshot): body = (' '.join('%s %s %s .' % (s.n3(), p.n3(), o.n3()) diff -r 77f6117e002f -r 6ee834a6f970 service/arduinoNode/config/bang.n3 --- a/service/arduinoNode/config/bang.n3 Fri Sep 16 00:55:04 2016 -0700 +++ b/service/arduinoNode/config/bang.n3 Fri Sep 16 01:16:12 2016 -0700 @@ -28,8 +28,14 @@ board0pin:d8 :pinNumber 8 . -board0pin:d3 :connectedTo sensor:motion0 . -sensor:motion0 a :MotionSensor; +board0pin:d3 :connectedTo sensor:motionStorage . +sensor:motionStorage a :MotionSensor; + :influxMeasurement [ + :measurement "presence"; + :predicate :sees; + :tag [:key "host"; :value "bang"], + [:key "sensor"; :value "motion"], + [:key "location"; :value "storage"]]; :sees houseLoc:storage . board0pin:d4 :connectedTo :heater . @@ -46,7 +52,10 @@ :connectedTo board0ow:dev-1052790f02080086 . board0ow:dev-1052790f02080086 a :TemperatureSensor; :position :storage; - :graphiteName "system.house.temp.storage" . + :influxMeasurement [ + :measurement "temperatureF"; + :predicate :temperatureF; + :tag [:key "host"; :value "bang"], [:key "location"; :value "storage"]] . ha:boardTest a :ArduinoBoard; diff -r 77f6117e002f -r 6ee834a6f970 service/arduinoNode/config/config.n3 --- a/service/arduinoNode/config/config.n3 Fri Sep 16 00:55:04 2016 -0700 +++ b/service/arduinoNode/config/config.n3 Fri Sep 16 01:16:12 2016 -0700 @@ -68,6 +68,12 @@ board2pin:d3 :pinNumber 3; :connectedTo sensor:motionAriDesk . sensor:motionAriDesk a :MotionSensor; + :influxMeasurement [ + :measurement "presence"; + :predicate :sees; + :tag [:key "host"; :value "brace"], + [:key "sensor"; :value "motion"], + [:key "location"; :value "ariDesk"]]; :sees houseLoc:ariDesk . board2pin:d4 :pinNumber 4; :connectedTo sensor:buttonAriBed . @@ -79,7 +85,11 @@ :connectedTo board2ow:dev-2813bea50300003d . board2ow:dev-2813bea50300003d a :TemperatureSensor; :position houseLoc:ariUnderBed; - :graphiteName "system.house.temp.ariUnderBed" . + :influxMeasurement [ + :measurement "temperatureF"; + :predicate :temperatureF; + :tag [:key "host"; :value "brace"], [:key "location"; :value "ariUnderBed"]] . + board2pin:d6 :pinNumber 6; :connectedTo :starTrekLight . :starTrekLight a :LedOutput; @@ -87,4 +97,10 @@ board2pin:d7 :pinNumber 7; :connectedTo sensor:motionAriBed . sensor:motionAriBed a :MotionSensor; + :influxMeasurement [ + :measurement "presence"; + :predicate :sees; + :tag [:key "host"; :value "brace"], + [:key "sensor"; :value "motion"], + [:key "location"; :value "ariBed"]]; :sees houseLoc:ariBed . diff -r 77f6117e002f -r 6ee834a6f970 service/arduinoNode/config/slash.n3 --- a/service/arduinoNode/config/slash.n3 Fri Sep 16 00:55:04 2016 -0700 +++ b/service/arduinoNode/config/slash.n3 Fri Sep 16 01:16:12 2016 -0700 @@ -41,7 +41,10 @@ :connectedTo shopOw:dev-28bf08d101000026 . shopOw:dev-28bf08d101000026 a :TemperatureSensor; :position :workshop; - :graphiteName "system.house.temp.workshop" . + :influxMeasurement [ + :measurement "temperatureF"; + :predicate :temperatureF; + :tag [:key "host"; :value "slash"], [:key "location"; :value "workshop"]]. shopPwm:roomLights a :PwmBoard; :scl shopPwm:scl; diff -r 77f6117e002f -r 6ee834a6f970 service/arduinoNode/devices.py --- a/service/arduinoNode/devices.py Fri Sep 16 00:55:04 2016 -0700 +++ b/service/arduinoNode/devices.py Fri Sep 16 01:16:12 2016 -0700 @@ -286,6 +286,7 @@ DS18S20 pin 1: ground, pin 2: data and pull-up with 4.7k. """ deviceType = ROOM['OneWire'] + pollPeriod = 2 def hostStateInit(self): # eliminate this as part of removing watchPrefixes self._knownTempSubjects = set() @@ -343,6 +344,12 @@ addr = struct.unpack('>Q', read(8))[0] tempF = struct.unpack(' 180: + stmts.extend([ + (self.uri, ROOM['connectedTo'], sensorUri), + (sensorUri, RDF.type, ROOM['FailingTemperatureReading']), + ]) + continue stmts.extend([ (self.uri, ROOM['connectedTo'], sensorUri), # rounding may be working around a bug where the diff -r 77f6117e002f -r 6ee834a6f970 service/arduinoNode/static/output-widgets.html --- a/service/arduinoNode/static/output-widgets.html Fri Sep 16 00:55:04 2016 -0700 +++ b/service/arduinoNode/static/output-widgets.html Fri Sep 16 01:16:12 2016 -0700 @@ -1,7 +1,7 @@ - +