Mercurial > code > home > repos > homeauto
comparison service/piNode/piNode.py @ 1443:99540f1a11f7
move bnode id optimization to its own file. more logging cleanups
Ignore-this: 1787f7268eafa52e7c094e327333021c
darcs-hash:3cf4550608b04f4ff91a76a3a00b129f0d9bcccb
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Mon, 12 Aug 2019 16:46:52 -0700 |
parents | 759841548982 |
children | 0a39cb133ce5 |
comparison
equal
deleted
inserted
replaced
1442:759841548982 | 1443:99540f1a11f7 |
---|---|
12 import pigpio | 12 import pigpio |
13 import treq | 13 import treq |
14 | 14 |
15 from patchablegraph import PatchableGraph, CycloneGraphHandler, CycloneGraphEventsHandler | 15 from patchablegraph import PatchableGraph, CycloneGraphHandler, CycloneGraphEventsHandler |
16 from cycloneerr import PrettyErrorHandler | 16 from cycloneerr import PrettyErrorHandler |
17 | 17 from standardservice.logsetup import log, verboseLogging |
18 from rdfdb.rdflibpatch import inContext | 18 from rdfdb.rdflibpatch import inContext |
19 from rdfdb.patch import Patch | 19 from rdfdb.patch import Patch |
20 | 20 from rdflib_pi_opt import patchRandid |
21 try: | 21 from export_to_influxdb import InfluxExporter |
22 import pigpio | |
23 except ImportError: | |
24 class pigpio(object): | |
25 @staticmethod | |
26 def pi(): | |
27 return None | |
28 | 22 |
29 import devices | 23 import devices |
30 from export_to_influxdb import InfluxExporter | |
31 | |
32 log = logging.getLogger() | |
33 logging.getLogger('serial').setLevel(logging.WARN) | |
34 | 24 |
35 ROOM = Namespace('http://projects.bigasterisk.com/room/') | 25 ROOM = Namespace('http://projects.bigasterisk.com/room/') |
36 HOST = Namespace('http://bigasterisk.com/ruler/host/') | 26 HOST = Namespace('http://bigasterisk.com/ruler/host/') |
37 | 27 |
38 hostname = socket.gethostname() | 28 hostname = socket.gethostname() |
299 | 289 |
300 -v Verbose | 290 -v Verbose |
301 --ow Just report onewire device URIs and readings, then exit. | 291 --ow Just report onewire device URIs and readings, then exit. |
302 --hub=HOST Hostname for etc3 and oneshot posts. [default: bang.vpn-home.bigasterisk.com] | 292 --hub=HOST Hostname for etc3 and oneshot posts. [default: bang.vpn-home.bigasterisk.com] |
303 """) | 293 """) |
304 log.setLevel(logging.WARN) | 294 verboseLogging(arg['-v']) |
305 if arg['-v']: | |
306 from twisted.python import log as twlog | |
307 twlog.startLogging(sys.stdout) | |
308 | |
309 log.setLevel(logging.DEBUG) | |
310 | 295 |
311 if arg['--ow']: | 296 if arg['--ow']: |
312 log.setLevel(logging.INFO) | 297 log.setLevel(logging.INFO) |
313 for stmt in devices.OneWire().poll(): | 298 for stmt in devices.OneWire().poll(): |
314 print(stmt) | 299 print(stmt) |
315 return | 300 return |
301 | |
302 patchRandid() | |
316 | 303 |
317 masterGraph = PatchableGraph() | 304 masterGraph = PatchableGraph() |
318 config = Config(masterGraph, arg['--hub']) | 305 config = Config(masterGraph, arg['--hub']) |
319 | 306 |
320 static = pkg_resources.resource_filename('homeauto_anynode', 'static/') | 307 static = pkg_resources.resource_filename('homeauto_anynode', 'static/') |