def __init__(self, dev, configGraph, masterGraph, uri): """ each connected thing has some pins. """ self.uri = uri self.configGraph = configGraph self.masterGraph = masterGraph self.dev = dev self.masterGraph.setToGraph(self.staticStmts()) # The order of this list needs to be consistent between the # deployToArduino call and the poll call. self._devs = devices.makeDevices(configGraph, self.uri) self._devCommandNum = dict((dev.uri, ACTION_BASE + devIndex) for devIndex, dev in enumerate(self._devs)) self._polledDevs = [d for d in self._devs if d.generatePollCode()] self._statementsFromInputs = {} # input device uri: latest statements self._lastPollTime = {} # input device uri: time() self._influx = InfluxExporter(self.configGraph) self.open() for d in self._devs: self.syncMasterGraphToHostStatements(d)
-v Verbose --overwrite_any_tag Rewrite any unknown tag with a new random body -n Fake reader """) log.setLevel(logging.INFO) if arg['-v']: enableTwistedLog() log.setLevel(logging.DEBUG) log.info(f'cyclone {cyclone.__version__}') defer.setDebugging(True) masterGraph = PatchableGraph() reader = NfcDevice() if not arg['-n'] else FakeNfc() ie = InfluxExporter(Graph()) ie.exportStats( STATS, [ 'root.cardReadPoll.count', 'root.cardReadPoll.95percentile', 'root.newCardReads', ], period_secs=10, retain_days=7, ) loop = ReadLoop(reader, masterGraph, overwrite_any_tag=arg['--overwrite_any_tag'])
"config_nightlight_ari.n3", "config_bed_bar.n3", "config_air_quality_indoor.n3", "config_air_quality_outdoor.n3", "config_living_lamps.n3", "config_kitchen.n3", ]: if not arg['--cs'] or arg['--cs'] in fn: config.parse(fn, format='n3') masterGraph = PatchableGraph() mqtt = MqttClient(clientId='mqtt_to_rdf', brokerHost='bang', brokerPort=1883) influx = InfluxExporter(config) srcs = [] for src in config.subjects(RDF.type, ROOM['MqttStatementSource']): srcs.append(MqttStatementSource(src, config, masterGraph, mqtt, influx)) log.info(f'set up {len(srcs)} sources') port = 10018 reactor.listenTCP( port, cyclone.web.Application([ (r"/()", cyclone.web.StaticFileHandler, { "path": ".", "default_filename": "index.html" }),