comparison service/arduinoNode/devices.py @ 1035:f01d9892ed79

update arduinoNode to support streamed graph output Ignore-this: fa35d1fae5b0e411b167650550c3e77d darcs-hash:c22c59acf2d4bbabfc467085f146a5de72b19f03
author drewp <drewp@bigasterisk.com>
date Thu, 28 Jan 2016 02:24:32 -0800
parents 3e6fac8569cd
children 4ebb5cc30002
comparison
equal deleted inserted replaced
1034:43a2170bbdb8 1035:f01d9892ed79
318 addr = struct.unpack('>Q', read(8))[0] 318 addr = struct.unpack('>Q', read(8))[0]
319 tempF = struct.unpack('<f', read(4))[0] 319 tempF = struct.unpack('<f', read(4))[0]
320 sensorUri = URIRef(os.path.join(self.uri, 'dev-%s' % hex(addr)[2:])) 320 sensorUri = URIRef(os.path.join(self.uri, 'dev-%s' % hex(addr)[2:]))
321 stmts.extend([ 321 stmts.extend([
322 (self.uri, ROOM['connectedTo'], sensorUri), 322 (self.uri, ROOM['connectedTo'], sensorUri),
323 (sensorUri, ROOM['temperatureF'], Literal(tempF))]) 323 # rounding may be working around a bug where the
324 # Literal gets two representations (at different
325 # roundings), and this makes an extra value linger on
326 # the client.
327 (sensorUri, ROOM['temperatureF'], Literal(round(tempF, 2)))])
324 self._knownTempSubjects.add(sensorUri) 328 self._knownTempSubjects.add(sensorUri)
325 329
326 log.debug("read temp in %.1fms" % ((time.time() - t1) * 1000)) 330 log.debug("read temp in %.1fms" % ((time.time() - t1) * 1000))
327 return stmts 331 return stmts
328 332