Mercurial > code > home > repos > homeauto
comparison service/arduinoNode/devices.py @ 305:6614416dd2c3
influx output for arduino, update web lib path
Ignore-this: 76b7fb15db86563ed3fa1ec5322b918c
author | drewp@bigasterisk.com |
---|---|
date | Fri, 16 Sep 2016 01:16:12 -0700 |
parents | 6103688dce6d |
children | a94f2a522d41 |
comparison
equal
deleted
inserted
replaced
304:e7cbf250188a | 305:6614416dd2c3 |
---|---|
284 self.uri is a resource representing the bus. | 284 self.uri is a resource representing the bus. |
285 | 285 |
286 DS18S20 pin 1: ground, pin 2: data and pull-up with 4.7k. | 286 DS18S20 pin 1: ground, pin 2: data and pull-up with 4.7k. |
287 """ | 287 """ |
288 deviceType = ROOM['OneWire'] | 288 deviceType = ROOM['OneWire'] |
289 pollPeriod = 2 | |
289 def hostStateInit(self): | 290 def hostStateInit(self): |
290 # eliminate this as part of removing watchPrefixes | 291 # eliminate this as part of removing watchPrefixes |
291 self._knownTempSubjects = set() | 292 self._knownTempSubjects = set() |
292 def generateIncludes(self): | 293 def generateIncludes(self): |
293 return ['OneWire.h', 'DallasTemperature.h'] | 294 return ['OneWire.h', 'DallasTemperature.h'] |
341 stmts = [] | 342 stmts = [] |
342 for i in range(count): | 343 for i in range(count): |
343 addr = struct.unpack('>Q', read(8))[0] | 344 addr = struct.unpack('>Q', read(8))[0] |
344 tempF = struct.unpack('<f', read(4))[0] | 345 tempF = struct.unpack('<f', read(4))[0] |
345 sensorUri = URIRef(os.path.join(self.uri, 'dev-%s' % hex(addr)[2:])) | 346 sensorUri = URIRef(os.path.join(self.uri, 'dev-%s' % hex(addr)[2:])) |
347 if tempF > 180: | |
348 stmts.extend([ | |
349 (self.uri, ROOM['connectedTo'], sensorUri), | |
350 (sensorUri, RDF.type, ROOM['FailingTemperatureReading']), | |
351 ]) | |
352 continue | |
346 stmts.extend([ | 353 stmts.extend([ |
347 (self.uri, ROOM['connectedTo'], sensorUri), | 354 (self.uri, ROOM['connectedTo'], sensorUri), |
348 # rounding may be working around a bug where the | 355 # rounding may be working around a bug where the |
349 # Literal gets two representations (at different | 356 # Literal gets two representations (at different |
350 # roundings), and this makes an extra value linger on | 357 # roundings), and this makes an extra value linger on |